diff options
| author | Tusooa Zhu <tusooa@kazv.moe> | 2022-01-10 01:16:33 -0500 |
|---|---|---|
| committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-01-29 16:57:59 -0500 |
| commit | 1d4b1b296e8ee37f119f419df49791d99fef4774 (patch) | |
| tree | f2062ff46f28bb41a63802fef32184c9811d42de /src/components/mention_link/mention_link.js | |
| parent | 76547fe66d1771f5bff732a34b0547f890f4621a (diff) | |
Add pref for whether to display full user names and tooltips
Diffstat (limited to 'src/components/mention_link/mention_link.js')
| -rw-r--r-- | src/components/mention_link/mention_link.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js index 637641af..f71c7716 100644 --- a/src/components/mention_link/mention_link.js +++ b/src/components/mention_link/mention_link.js @@ -50,6 +50,10 @@ const MentionLink = { userName () { return this.user && this.userNameFullUi.split('@')[0] }, + serverName () { + // XXX assumed that domain does not contain @ + return this.user && (this.userNameFullUi.split('@')[1] || this.$store.getters.instanceDomain) + }, userNameFull () { return this.user && this.user.screen_name }, @@ -88,6 +92,22 @@ const MentionLink = { useAtIcon () { return this.mergedConfig.useAtIcon }, + isRemote () { + return this.userName !== this.userNameFull + }, + shouldShowFullUserName () { + const conf = this.mergedConfig.mentionLinkDisplay + if (conf === 'short') { + return false + } else if (conf === 'full') { + return true + } else { // full_for_remote + return this.isRemote + } + }, + shouldShowTooltip () { + return this.mergedConfig.mentionLinkShowTooltip && this.mergedConfig.mentionLinkDisplay === 'short' && this.isRemote + }, ...mapGetters(['mergedConfig']), ...mapState({ currentUser: state => state.users.currentUser |
