fix mention links

This commit is contained in:
Henry Jameson 2026-03-16 18:45:57 +02:00
commit f29710d0af

View file

@ -10,6 +10,7 @@ import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_i
import UserAvatar from '../user_avatar/user_avatar.vue' import UserAvatar from '../user_avatar/user_avatar.vue'
import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useSyncConfigStore } from 'src/stores/sync_config.js'
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
@ -100,23 +101,23 @@ const MentionLink = {
userNameFullUi() { userNameFullUi() {
return this.user && this.user.screen_name_ui return this.user && this.user.screen_name_ui
}, },
highlight() { highlightData() {
return this.user && this.mergedConfig.highlight[this.user.screen_name] return this.highlight[this.user?.screen_name]
}, },
highlightType() { highlightType() {
return this.highlight && '-' + this.highlight.type return this.highlightData && '-' + this.highlightData.type
}, },
highlightClass() { highlightClass() {
if (this.highlight) return highlightClass(this.user) return this.highlightData && highlightClass(this.user)
}, },
style() { style() {
if (this.highlight) { if (this.highlightData) {
const { const {
backgroundColor, backgroundColor,
backgroundPosition, backgroundPosition,
backgroundImage, backgroundImage,
...rest ...rest
} = highlightStyle(this.highlight) } = highlightStyle(this.highlightData)
return rest return rest
} }
}, },
@ -124,7 +125,7 @@ const MentionLink = {
return [ return [
{ {
'-you': this.isYou && this.shouldBoldenYou, '-you': this.isYou && this.shouldBoldenYou,
'-highlighted': this.highlight, '-highlighted': !!this.highlightData,
'-has-selection': this.hasSelection, '-has-selection': this.hasSelection,
}, },
this.highlightType, this.highlightType,
@ -160,6 +161,7 @@ const MentionLink = {
return this.mergedConfig.mentionLinkFadeDomain return this.mergedConfig.mentionLinkFadeDomain
}, },
...mapPiniaState(useSyncConfigStore, ['mergedConfig']), ...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
...mapPiniaState(useUserHighlightStore, ['highlight']),
...mapState({ ...mapState({
currentUser: (state) => state.users.currentUser, currentUser: (state) => state.users.currentUser,
}), }),