Skip to content

Commit

Permalink
fix(twitter): set title to author (#17673)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklahaye authored Nov 22, 2024
1 parent f1b270d commit 6dc521e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/routes/twitter/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const namespace: Namespace = {
| \`readable\` | Enable readable layout | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` |
| \`authorNameBold\` | Display author name in bold | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` |
| \`showAuthorInTitle\` | Show author name in title | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` (\`true\` in \`/twitter/followings\`) |
| \`showAuthorAsTitleOnly\` | Show only author name as title | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` |
| \`showAuthorInDesc\` | Show author name in description (RSS body) | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` (\`true\` in \`/twitter/followings\`) |
| \`showQuotedAuthorAvatarInDesc\` | Show avatar of quoted Tweet's author in description (RSS body) (Not recommended if your RSS reader extracts images from description) | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` |
| \`showAuthorAvatarInDesc\` | Show avatar of author in description (RSS body) (Not recommended if your RSS reader extracts images from description) | \`0\`/\`1\`/\`true\`/\`false\` | \`false\` |
Expand Down
6 changes: 6 additions & 0 deletions lib/routes/twitter/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
readable: fallback(params.readable, queryToBoolean(routeParams.get('readable')), false),
authorNameBold: fallback(params.authorNameBold, queryToBoolean(routeParams.get('authorNameBold')), false),
showAuthorInTitle: fallback(params.showAuthorInTitle, queryToBoolean(routeParams.get('showAuthorInTitle')), false),
showAuthorAsTitleOnly: fallback(params.showAuthorAsTitleOnly, queryToBoolean(routeParams.get('showAuthorAsTitleOnly')), false),
showAuthorInDesc: fallback(params.showAuthorInDesc, queryToBoolean(routeParams.get('showAuthorInDesc')), false),
showQuotedAuthorAvatarInDesc: fallback(params.showQuotedAuthorAvatarInDesc, queryToBoolean(routeParams.get('showQuotedAuthorAvatarInDesc')), false),
showAuthorAvatarInDesc: fallback(params.showAuthorAvatarInDesc, queryToBoolean(routeParams.get('showAuthorAvatarInDesc')), false),
Expand All @@ -74,6 +75,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
readable,
authorNameBold,
showAuthorInTitle,
showAuthorAsTitleOnly,
showAuthorInDesc,
showQuotedAuthorAvatarInDesc,
showAuthorAvatarInDesc,
Expand Down Expand Up @@ -292,6 +294,10 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
title += quoteInTitle;
}

if (showAuthorAsTitleOnly) {
title = originalItem.user.name;
}

// Make description
let description = '';
if (showAuthorInDesc && showAuthorAvatarInDesc) {
Expand Down

0 comments on commit 6dc521e

Please sign in to comment.