From c690fa798a0fc1568458cba718e6195c21cbac55 Mon Sep 17 00:00:00 2001 From: Rick Lahaye <6962786+ricklahaye@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:59:25 +0100 Subject: [PATCH] fix(twitter): set title to author --- lib/routes/twitter/namespace.ts | 1 + lib/routes/twitter/utils.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/routes/twitter/namespace.ts b/lib/routes/twitter/namespace.ts index 9c1cf533e702fc..e3a3ee2a089eee 100644 --- a/lib/routes/twitter/namespace.ts +++ b/lib/routes/twitter/namespace.ts @@ -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\` | diff --git a/lib/routes/twitter/utils.ts b/lib/routes/twitter/utils.ts index f78534875bb124..fd206ea424d7d0 100644 --- a/lib/routes/twitter/utils.ts +++ b/lib/routes/twitter/utils.ts @@ -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), @@ -74,6 +75,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => { readable, authorNameBold, showAuthorInTitle, + showAuthorAsTitleOnly, showAuthorInDesc, showQuotedAuthorAvatarInDesc, showAuthorAvatarInDesc, @@ -292,6 +294,10 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => { title += quoteInTitle; } + if (showAuthorAsTitleOnly) { + title = originalItem.user.name; + } + // Make description let description = ''; if (showAuthorInDesc && showAuthorAvatarInDesc) {