user highlight
This commit is contained in:
parent
eb7cff467e
commit
bc97016ea3
7 changed files with 28 additions and 34 deletions
|
|
@ -18,6 +18,7 @@ import UserPopover from '../user_popover/user_popover.vue'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.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'
|
||||
|
||||
|
|
@ -184,7 +185,7 @@ const Notification = {
|
|||
userStyle() {
|
||||
const highlight = useSyncConfigStore().mergedConfig.highlight
|
||||
const user = this.notification.from_profile
|
||||
return highlightStyle(highlight[user.screen_name])
|
||||
return highlightStyle(useUserHighlightStore().get(user))
|
||||
},
|
||||
expandable() {
|
||||
return new Set(['like', 'pleroma:emoji_reaction', 'repeat', 'poll']).has(
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import UserPopover from '../user_popover/user_popover.vue'
|
|||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.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'
|
||||
|
||||
|
|
@ -199,16 +200,14 @@ const Status = {
|
|||
},
|
||||
repeaterStyle() {
|
||||
const user = this.statusoid.user
|
||||
const highlight = this.mergedConfig.highlight
|
||||
return highlightStyle(highlight[user.screen_name])
|
||||
return highlightStyle(useUserHighlightStore().get(user.screen_name))
|
||||
},
|
||||
userStyle() {
|
||||
if (this.noHeading) return
|
||||
const user = this.retweet
|
||||
? this.statusoid.retweeted_status.user
|
||||
: this.statusoid.user
|
||||
const highlight = this.mergedConfig.highlight
|
||||
return highlightStyle(highlight[user.screen_name])
|
||||
return highlightStyle(useUserHighlightStore().get(user.screen_name))
|
||||
},
|
||||
userProfileLink() {
|
||||
return this.generateUserProfileLink(
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
|||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { usePostStatusStore } from 'src/stores/post_status'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||
|
||||
import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
|
|
@ -226,39 +227,28 @@ export default {
|
|||
}))
|
||||
},
|
||||
userHighlightType: {
|
||||
get() {
|
||||
const data =
|
||||
useSyncConfigStore().mergedConfig.highlight[this.user.screen_name]
|
||||
return (data && data.type) || 'disabled'
|
||||
get () {
|
||||
return useUserHighlightStore().get(this.user.screen_name).type
|
||||
},
|
||||
set(type) {
|
||||
const data =
|
||||
useSyncConfigStore().mergedConfig.highlight[this.user.screen_name]
|
||||
set (type) {
|
||||
if (type !== 'disabled') {
|
||||
this.$store.dispatch('setHighlight', {
|
||||
useUserHighlightStore().setAndSave({
|
||||
user: this.user.screen_name,
|
||||
color: (data && data.color) || '#FFFFFF',
|
||||
type,
|
||||
value: { type }
|
||||
})
|
||||
} else {
|
||||
this.$store.dispatch('setHighlight', {
|
||||
user: this.user.screen_name,
|
||||
color: undefined,
|
||||
})
|
||||
useUserHighlightStore().unsetAndSave({ user: this.user.screen_name })
|
||||
}
|
||||
},
|
||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||
},
|
||||
userHighlightColor: {
|
||||
get() {
|
||||
const data =
|
||||
useSyncConfigStore().mergedConfig.highlight[this.user.screen_name]
|
||||
return data && data.color
|
||||
return useUserHighlightStore().get(this.user.screen_name).color
|
||||
},
|
||||
set(color) {
|
||||
this.$store.dispatch('setHighlight', {
|
||||
useUserHighlightStore().setAndSave({
|
||||
user: this.user.screen_name,
|
||||
color,
|
||||
value: { color }
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue