Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(twitter): set title to author #17673

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading