Skip to content

Commit

Permalink
feat: twitter showSymbolForRetweetAndReply param
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Mar 13, 2023
1 parent c4eb096 commit 12f3eff
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/v2/twitter/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
showQuotedAuthorAvatarInDesc: fallback(params.showQuotedAuthorAvatarInDesc, queryToBoolean(routeParams.get('showQuotedAuthorAvatarInDesc')), false),
showAuthorAvatarInDesc: fallback(params.showAuthorAvatarInDesc, queryToBoolean(routeParams.get('showAuthorAvatarInDesc')), false),
showEmojiForRetweetAndReply: fallback(params.showEmojiForRetweetAndReply, queryToBoolean(routeParams.get('showEmojiForRetweetAndReply')), false),
showSymbolForRetweetAndReply: fallback(params.showSymbolForRetweetAndReply, queryToBoolean(routeParams.get('showSymbolForRetweetAndReply')), true),
showRetweetTextInTitle: fallback(params.showRetweetTextInTitle, queryToBoolean(routeParams.get('showRetweetTextInTitle')), true),
addLinkForPics: fallback(params.addLinkForPics, queryToBoolean(routeParams.get('addLinkForPics')), false),
showTimestampInDescription: fallback(params.showTimestampInDescription, queryToBoolean(routeParams.get('showTimestampInDescription')), false),
Expand All @@ -69,6 +70,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
showQuotedAuthorAvatarInDesc,
showAuthorAvatarInDesc,
showEmojiForRetweetAndReply,
showSymbolForRetweetAndReply,
showRetweetTextInTitle,
addLinkForPics,
showTimestampInDescription,
Expand Down Expand Up @@ -228,7 +230,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
}
quote += formatMedia(quoteData);
picsPrefix += generatePicsPrefix(quoteData);
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : ' RT ';
quoteInTitle += showEmojiForRetweetAndReply ? ' 💬 ' : showSymbolForRetweetAndReply ? ' RT ' : '';
quoteInTitle += `${author.name}: ${formatText(quoteData.full_text, quoteData.entities.urls)}`;

if (readable) {
Expand Down Expand Up @@ -258,15 +260,15 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
const isQuote = item.is_quote_status;
if (!isRetweet && (!isQuote || showRetweetTextInTitle)) {
if (item.in_reply_to_screen_name) {
title += showEmojiForRetweetAndReply ? '↩️ ' : 'Re ';
title += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
}
title += replaceBreak(originalItem.full_text);
}
if (isRetweet) {
title += showEmojiForRetweetAndReply ? '🔁 ' : 'RT ';
title += showEmojiForRetweetAndReply ? '🔁 ' : showSymbolForRetweetAndReply ? 'RT ' : '';
title += item.user.name + ': ';
if (item.in_reply_to_screen_name) {
title += showEmojiForRetweetAndReply ? ' ↩️ ' : ' Re ';
title += showEmojiForRetweetAndReply ? ' ↩️ ' : showSymbolForRetweetAndReply ? ' Re ' : '';
}
title += replaceBreak(item.full_text);
}
Expand Down Expand Up @@ -298,7 +300,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
}
description += ' ';
}
description += showEmojiForRetweetAndReply ? '🔁' : 'RT';
description += showEmojiForRetweetAndReply ? '🔁' : showSymbolForRetweetAndReply ? 'RT' : '';
if (!showAuthorInDesc) {
description += ' ';
if (readable) {
Expand Down Expand Up @@ -341,7 +343,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
description += `: `;
}
if (item.in_reply_to_screen_name) {
description += showEmojiForRetweetAndReply ? '↩️ ' : 'Re ';
description += showEmojiForRetweetAndReply ? '↩️ ' : showSymbolForRetweetAndReply ? 'Re ' : '';
}

description += item.full_text;
Expand Down

0 comments on commit 12f3eff

Please sign in to comment.