Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Add setting to hide pronouns on own accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
eramdam committed Apr 4, 2022
1 parent 9938d78 commit 256b494
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -523,5 +523,8 @@
},
"settings_dismiss_banner_paragraph": {
"message": "In some cases, the banner that shows up after a Better TweetDeck update can have trouble dismissing itself. Click the button below to fix it."
},
"settings_dont_show_pronouns_for_your_own_accounts": {
"message": "Don't show pronouns for your own accounts"
}
}
6 changes: 6 additions & 0 deletions src/components/settings/settingsTweetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ export const SettingsTweetContent: FC<SettingsMenuSectionProps> = (props) => {
);
},
},
{
initialValue: settings.dontShowPronounsOnOwnAccounts,
introducedIn: '4.8.6',
key: 'dontShowPronounsOnOwnAccounts',
label: <Trans id="settings_dont_show_pronouns_for_your_own_accounts" />,
},
]}>
<Trans id="settings_misc" />
</CheckboxSelectSettingsRow>
Expand Down
9 changes: 9 additions & 0 deletions src/features/pronounsDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ export const displayPronouns = makeBTDModule(({TD, settings}) => {
}

TD.services.TwitterUser.prototype.getPronouns = function getPronouns(): string | undefined {
const personalAccountIds = settings.dontShowPronounsOnOwnAccounts
? TD.controller.clients
.getClientsByService('twitter')
.map((c) => c.oauth.account.state.userId)
: [];

if (personalAccountIds.includes(this.id)) {
return undefined;
}
const cleanBio = removeUrlsFromBio(this.description, this.entities.description);
const maybePronouns =
extractPronouns(cleanBio) || extractPronouns(this.location) || extractPronouns(this.name);
Expand Down
1 change: 1 addition & 0 deletions src/types/btdSettingsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const RBetterTweetDeckSettings = t.type({

showProfileLabels: withDefault(t.boolean, false),
extractAndShowPronouns: withDefault(t.boolean, false),
dontShowPronounsOnOwnAccounts: withDefault(t.boolean, false),

/** Disable the `tweet` button if images don't have an alt text. */
disableTweetButtonIfAltIsMissing: withDefault(t.boolean, false),
Expand Down

0 comments on commit 256b494

Please sign in to comment.