Merge branch 'setttingssync' into shigusegubu-themes3
This commit is contained in:
commit
e84fb2acad
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 { useInstanceStore } from 'src/stores/instance.js'
|
||||||
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'
|
||||||
|
|
||||||
|
|
@ -184,7 +185,7 @@ const Notification = {
|
||||||
userStyle() {
|
userStyle() {
|
||||||
const highlight = useSyncConfigStore().mergedConfig.highlight
|
const highlight = useSyncConfigStore().mergedConfig.highlight
|
||||||
const user = this.notification.from_profile
|
const user = this.notification.from_profile
|
||||||
return highlightStyle(highlight[user.screen_name])
|
return highlightStyle(useUserHighlightStore().get(user))
|
||||||
},
|
},
|
||||||
expandable() {
|
expandable() {
|
||||||
return new Set(['like', 'pleroma:emoji_reaction', 'repeat', 'poll']).has(
|
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 { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
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'
|
||||||
|
|
||||||
|
|
@ -199,16 +200,14 @@ const Status = {
|
||||||
},
|
},
|
||||||
repeaterStyle() {
|
repeaterStyle() {
|
||||||
const user = this.statusoid.user
|
const user = this.statusoid.user
|
||||||
const highlight = this.mergedConfig.highlight
|
return highlightStyle(useUserHighlightStore().get(user.screen_name))
|
||||||
return highlightStyle(highlight[user.screen_name])
|
|
||||||
},
|
},
|
||||||
userStyle() {
|
userStyle() {
|
||||||
if (this.noHeading) return
|
if (this.noHeading) return
|
||||||
const user = this.retweet
|
const user = this.retweet
|
||||||
? this.statusoid.retweeted_status.user
|
? this.statusoid.retweeted_status.user
|
||||||
: this.statusoid.user
|
: this.statusoid.user
|
||||||
const highlight = this.mergedConfig.highlight
|
return highlightStyle(useUserHighlightStore().get(user.screen_name))
|
||||||
return highlightStyle(highlight[user.screen_name])
|
|
||||||
},
|
},
|
||||||
userProfileLink() {
|
userProfileLink() {
|
||||||
return this.generateUserProfileLink(
|
return this.generateUserProfileLink(
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { usePostStatusStore } from 'src/stores/post_status'
|
import { usePostStatusStore } from 'src/stores/post_status'
|
||||||
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 { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
|
|
@ -226,39 +227,28 @@ export default {
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
userHighlightType: {
|
userHighlightType: {
|
||||||
get() {
|
get () {
|
||||||
const data =
|
return useUserHighlightStore().get(this.user.screen_name).type
|
||||||
useSyncConfigStore().mergedConfig.highlight[this.user.screen_name]
|
|
||||||
return (data && data.type) || 'disabled'
|
|
||||||
},
|
},
|
||||||
set(type) {
|
set (type) {
|
||||||
const data =
|
|
||||||
useSyncConfigStore().mergedConfig.highlight[this.user.screen_name]
|
|
||||||
if (type !== 'disabled') {
|
if (type !== 'disabled') {
|
||||||
this.$store.dispatch('setHighlight', {
|
useUserHighlightStore().setAndSave({
|
||||||
user: this.user.screen_name,
|
user: this.user.screen_name,
|
||||||
color: (data && data.color) || '#FFFFFF',
|
value: { type }
|
||||||
type,
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('setHighlight', {
|
useUserHighlightStore().unsetAndSave({ user: this.user.screen_name })
|
||||||
user: this.user.screen_name,
|
|
||||||
color: undefined,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...mapState(useSyncConfigStore, ['mergedConfig']),
|
|
||||||
},
|
},
|
||||||
userHighlightColor: {
|
userHighlightColor: {
|
||||||
get() {
|
get() {
|
||||||
const data =
|
return useUserHighlightStore().get(this.user.screen_name).color
|
||||||
useSyncConfigStore().mergedConfig.highlight[this.user.screen_name]
|
|
||||||
return data && data.color
|
|
||||||
},
|
},
|
||||||
set(color) {
|
set(color) {
|
||||||
this.$store.dispatch('setHighlight', {
|
useUserHighlightStore().setAndSave({
|
||||||
user: this.user.screen_name,
|
user: this.user.screen_name,
|
||||||
color,
|
value: { color }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
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 { declarations } from 'src/modules/config_declaration'
|
import { declarations } from 'src/modules/config_declaration'
|
||||||
|
|
||||||
|
|
@ -701,7 +702,8 @@ const users = {
|
||||||
user.domainMutes = []
|
user.domainMutes = []
|
||||||
commit('setCurrentUser', user)
|
commit('setCurrentUser', user)
|
||||||
|
|
||||||
useSyncConfigStore().setSyncConfig(user)
|
useSyncConfigStore().initSyncConfig(user)
|
||||||
|
useUserHighlightStore().initHighlight(user)
|
||||||
commit('addNewUsers', [user])
|
commit('addNewUsers', [user])
|
||||||
|
|
||||||
useEmojiStore().fetchEmoji()
|
useEmojiStore().fetchEmoji()
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ export const parseUser = (data) => {
|
||||||
if (data.pleroma) {
|
if (data.pleroma) {
|
||||||
if (data.pleroma.settings_store) {
|
if (data.pleroma.settings_store) {
|
||||||
output.storage = data.pleroma.settings_store['pleroma-fe']
|
output.storage = data.pleroma.settings_store['pleroma-fe']
|
||||||
|
output.user_highlight = data.pleroma.settings_store['user_highlight']
|
||||||
}
|
}
|
||||||
const relationship = data.pleroma.relationship
|
const relationship = data.pleroma.relationship
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -605,7 +605,8 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
this.raw.prefsStorage._journal = []
|
this.raw.prefsStorage._journal = []
|
||||||
this.pushSyncConfig()
|
this.pushSyncConfig()
|
||||||
},
|
},
|
||||||
setSyncConfig(userData) {
|
initSyncConfig(userData) {
|
||||||
|
console.log(userData)
|
||||||
const live = userData.storage
|
const live = userData.storage
|
||||||
this.raw = live
|
this.raw = live
|
||||||
let cache = this.cache
|
let cache = this.cache
|
||||||
|
|
@ -682,7 +683,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
window.vuex.state.api.backendInteractor
|
window.vuex.state.api.backendInteractor
|
||||||
.updateProfileJSON({ params })
|
.updateProfileJSON({ params })
|
||||||
.then((user) => {
|
.then((user) => {
|
||||||
this.setSyncConfig(user)
|
this.initSyncConfig(user)
|
||||||
this.dirty = false
|
this.dirty = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ describe('The SyncConfig module', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('mutations', () => {
|
describe('mutations', () => {
|
||||||
describe('setSyncConfig', () => {
|
describe('initSyncConfig', () => {
|
||||||
const user = {
|
const user = {
|
||||||
created_at: new Date('1999-02-09'),
|
created_at: new Date('1999-02-09'),
|
||||||
storage: {},
|
storage: {},
|
||||||
|
|
@ -30,7 +30,7 @@ describe('The SyncConfig module', () => {
|
||||||
|
|
||||||
it('should initialize storage if none present', () => {
|
it('should initialize storage if none present', () => {
|
||||||
const store = useSyncConfigStore()
|
const store = useSyncConfigStore()
|
||||||
store.setSyncConfig({ ...user })
|
store.initSyncConfig({ ...user })
|
||||||
expect(store.cache._version).to.eql(VERSION)
|
expect(store.cache._version).to.eql(VERSION)
|
||||||
expect(store.cache._timestamp).to.be.a('number')
|
expect(store.cache._timestamp).to.be.a('number')
|
||||||
expect(store.cache.flagStorage).to.eql(defaultState.flagStorage)
|
expect(store.cache.flagStorage).to.eql(defaultState.flagStorage)
|
||||||
|
|
@ -39,7 +39,7 @@ describe('The SyncConfig module', () => {
|
||||||
|
|
||||||
it('should initialize storage with proper flags for new users if none present', () => {
|
it('should initialize storage with proper flags for new users if none present', () => {
|
||||||
const store = useSyncConfigStore()
|
const store = useSyncConfigStore()
|
||||||
store.setSyncConfig({ ...user, created_at: new Date() })
|
store.initSyncConfig({ ...user, created_at: new Date() })
|
||||||
expect(store.cache._version).to.eql(VERSION)
|
expect(store.cache._version).to.eql(VERSION)
|
||||||
expect(store.cache._timestamp).to.be.a('number')
|
expect(store.cache._timestamp).to.be.a('number')
|
||||||
expect(store.cache.flagStorage).to.eql(newUserFlags)
|
expect(store.cache.flagStorage).to.eql(newUserFlags)
|
||||||
|
|
@ -54,7 +54,7 @@ describe('The SyncConfig module', () => {
|
||||||
...cloneDeep(defaultState),
|
...cloneDeep(defaultState),
|
||||||
}
|
}
|
||||||
|
|
||||||
store.setSyncConfig({
|
store.initSyncConfig({
|
||||||
...user,
|
...user,
|
||||||
storage: {
|
storage: {
|
||||||
_timestamp: 123,
|
_timestamp: 123,
|
||||||
|
|
@ -79,7 +79,7 @@ describe('The SyncConfig module', () => {
|
||||||
const store = useSyncConfigStore()
|
const store = useSyncConfigStore()
|
||||||
store.cache = null
|
store.cache = null
|
||||||
|
|
||||||
store.setSyncConfig({
|
store.initSyncConfig({
|
||||||
...user,
|
...user,
|
||||||
storage: {
|
storage: {
|
||||||
_timestamp: 123,
|
_timestamp: 123,
|
||||||
|
|
@ -97,7 +97,7 @@ describe('The SyncConfig module', () => {
|
||||||
|
|
||||||
it('should use remote version if local missing', () => {
|
it('should use remote version if local missing', () => {
|
||||||
const store = useSyncConfigStore()
|
const store = useSyncConfigStore()
|
||||||
store.setSyncConfig(store, user)
|
store.initSyncConfig(store, user)
|
||||||
expect(store.cache._version).to.eql(VERSION)
|
expect(store.cache._version).to.eql(VERSION)
|
||||||
expect(store.cache._timestamp).to.be.a('number')
|
expect(store.cache._timestamp).to.be.a('number')
|
||||||
expect(store.cache.flagStorage).to.eql(defaultState.flagStorage)
|
expect(store.cache.flagStorage).to.eql(defaultState.flagStorage)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue