Merge pull request #2997 from h3poteto/fix/divide-use-marker
refs #574 Divide use marker settings for each timelines
This commit is contained in:
commit
80d90f7aa7
@ -17,7 +17,7 @@ const state = (): GeneralState => {
|
|||||||
cw: false,
|
cw: false,
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
hideAllAttachments: false,
|
hideAllAttachments: false,
|
||||||
useMarker: false
|
useMarkerTimeline: []
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
launch: false
|
launch: false
|
||||||
|
@ -148,7 +148,8 @@ const timelineState = {
|
|||||||
const appState = {
|
const appState = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
proxyConfiguration: false
|
proxyConfiguration: false,
|
||||||
|
useMarkerTimeline: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,8 @@ const timelineState = {
|
|||||||
const appState = {
|
const appState = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
proxyConfiguration: false
|
proxyConfiguration: false,
|
||||||
|
useMarkerTimeline: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ describe('Preferences/General', () => {
|
|||||||
cw: false,
|
cw: false,
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
hideAllAttachments: false,
|
hideAllAttachments: false,
|
||||||
useMarker: false
|
useMarkerTimeline: []
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
launch: false
|
launch: false
|
||||||
|
@ -163,8 +163,7 @@
|
|||||||
"cw": "Always ignore contents warnings",
|
"cw": "Always ignore contents warnings",
|
||||||
"nsfw": "Always ignore NSFW of medias",
|
"nsfw": "Always ignore NSFW of medias",
|
||||||
"hideAllAttachments": "Hide all medias",
|
"hideAllAttachments": "Hide all medias",
|
||||||
"useMarker": "Load timeline from the last reading position",
|
"useMarker": "Load timeline from the last reading position"
|
||||||
"useMarkerNotice": "This feature only supports home and notifications"
|
|
||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"title": "Other options",
|
"title": "Other options",
|
||||||
|
@ -21,7 +21,7 @@ const timeline: Timeline = {
|
|||||||
cw: false,
|
cw: false,
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
hideAllAttachments: false,
|
hideAllAttachments: false,
|
||||||
useMarker: false
|
useMarkerTimeline: ['notifications']
|
||||||
}
|
}
|
||||||
|
|
||||||
const other: Other = {
|
const other: Other = {
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
<el-switch id="hideAllAttachments" v-model="timeline_hide_attachments" active-color="#13ce66"> </el-switch>
|
<el-switch id="hideAllAttachments" v-model="timeline_hide_attachments" active-color="#13ce66"> </el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item for="useMarker" :label="$t('preferences.general.timeline.useMarker')">
|
<el-form-item for="useMarker" :label="$t('preferences.general.timeline.useMarker')">
|
||||||
<el-switch id="useMarker" v-model="timeline_use_marker" active-color="#13ce66"> </el-switch>
|
<el-checkbox-group v-model="timeline_use_marker">
|
||||||
|
<el-checkbox label="home" name="type"></el-checkbox>
|
||||||
|
<el-checkbox label="notifications" name="type"></el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<p class="notice">
|
|
||||||
{{ $t('preferences.general.timeline.useMarkerNotice') }}
|
|
||||||
</p>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-form class="other section" label-position="right" label-width="250px" size="small" v-if="notDarwin">
|
<el-form class="other section" label-position="right" label-width="250px" size="small" v-if="notDarwin">
|
||||||
<h3>{{ $t('preferences.general.other.title') }}</h3>
|
<h3>{{ $t('preferences.general.other.title') }}</h3>
|
||||||
@ -107,11 +107,12 @@ export default {
|
|||||||
},
|
},
|
||||||
timeline_use_marker: {
|
timeline_use_marker: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.Preferences.General.general.timeline.useMarker
|
return this.$store.state.Preferences.General.general.timeline.useMarkerTimeline
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
|
console.log(value)
|
||||||
this.$store.dispatch('Preferences/General/updateTimeline', {
|
this.$store.dispatch('Preferences/General/updateTimeline', {
|
||||||
useMarker: value
|
useMarkerTimeline: value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@ export type AppState = {
|
|||||||
hideAllAttachments: boolean
|
hideAllAttachments: boolean
|
||||||
tootPadding: number
|
tootPadding: number
|
||||||
userAgent: string
|
userAgent: string
|
||||||
useMarker: boolean
|
useMarkerTimeline: Array<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = (): AppState => ({
|
const state = (): AppState => ({
|
||||||
@ -53,7 +53,7 @@ const state = (): AppState => ({
|
|||||||
ignoreNSFW: false,
|
ignoreNSFW: false,
|
||||||
hideAllAttachments: false,
|
hideAllAttachments: false,
|
||||||
userAgent: 'Whalebird',
|
userAgent: 'Whalebird',
|
||||||
useMarker: false
|
useMarkerTimeline: ['notifications']
|
||||||
})
|
})
|
||||||
|
|
||||||
const MUTATION_TYPES = {
|
const MUTATION_TYPES = {
|
||||||
@ -106,8 +106,8 @@ const mutations: MutationTree<AppState> = {
|
|||||||
[MUTATION_TYPES.UPDATE_HIDE_ALL_ATTACHMENTS]: (state: AppState, hideAllAttachments: boolean) => {
|
[MUTATION_TYPES.UPDATE_HIDE_ALL_ATTACHMENTS]: (state: AppState, hideAllAttachments: boolean) => {
|
||||||
state.hideAllAttachments = hideAllAttachments
|
state.hideAllAttachments = hideAllAttachments
|
||||||
},
|
},
|
||||||
[MUTATION_TYPES.UPDATE_USE_MARKER]: (state: AppState, useMarker: boolean) => {
|
[MUTATION_TYPES.UPDATE_USE_MARKER]: (state: AppState, useMarkerTimeline: Array<string>) => {
|
||||||
state.useMarker = useMarker
|
state.useMarkerTimeline = useMarkerTimeline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ const actions: ActionTree<AppState, RootState> = {
|
|||||||
commit(MUTATION_TYPES.UPDATE_IGNORE_CW, conf.general.timeline.cw)
|
commit(MUTATION_TYPES.UPDATE_IGNORE_CW, conf.general.timeline.cw)
|
||||||
commit(MUTATION_TYPES.UPDATE_IGNORE_NSFW, conf.general.timeline.nsfw)
|
commit(MUTATION_TYPES.UPDATE_IGNORE_NSFW, conf.general.timeline.nsfw)
|
||||||
commit(MUTATION_TYPES.UPDATE_HIDE_ALL_ATTACHMENTS, conf.general.timeline.hideAllAttachments)
|
commit(MUTATION_TYPES.UPDATE_HIDE_ALL_ATTACHMENTS, conf.general.timeline.hideAllAttachments)
|
||||||
commit(MUTATION_TYPES.UPDATE_USE_MARKER, conf.general.timeline.useMarker)
|
commit(MUTATION_TYPES.UPDATE_USE_MARKER, conf.general.timeline.useMarkerTimeline)
|
||||||
return conf
|
return conf
|
||||||
},
|
},
|
||||||
updateTheme: async ({ commit }, appearance: Appearance) => {
|
updateTheme: async ({ commit }, appearance: Appearance) => {
|
||||||
|
@ -22,7 +22,7 @@ const state = (): GeneralState => ({
|
|||||||
cw: false,
|
cw: false,
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
hideAllAttachments: false,
|
hideAllAttachments: false,
|
||||||
useMarker: false
|
useMarkerTimeline: ['notifications']
|
||||||
},
|
},
|
||||||
other: {
|
other: {
|
||||||
launch: false
|
launch: false
|
||||||
|
@ -134,7 +134,7 @@ const actions: ActionTree<HomeState, RootState> = {
|
|||||||
console.error(err)
|
console.error(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (rootState.App.useMarker && localMarker !== null) {
|
if (rootState.App.useMarkerTimeline.includes('home') && localMarker !== null) {
|
||||||
const last = await client.getStatus(localMarker.last_read_id)
|
const last = await client.getStatus(localMarker.last_read_id)
|
||||||
const lastReadStatus = last.data
|
const lastReadStatus = last.data
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ const actions: ActionTree<HomeState, RootState> = {
|
|||||||
return res.data
|
return res.data
|
||||||
},
|
},
|
||||||
getMarker: async ({ rootState }): Promise<LocalMarker | null> => {
|
getMarker: async ({ rootState }): Promise<LocalMarker | null> => {
|
||||||
if (!rootState.App.useMarker) {
|
if (!rootState.App.useMarkerTimeline.includes('home')) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const client = generator(
|
const client = generator(
|
||||||
|
@ -120,7 +120,7 @@ const actions: ActionTree<NotificationsState, RootState> = {
|
|||||||
console.error(err)
|
console.error(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (rootState.App.useMarker && localMarker !== null) {
|
if (rootState.App.useMarkerTimeline.includes('notifications') && localMarker !== null) {
|
||||||
// The result does not contain max_id's notification, when we specify max_id parameter in get notifications.
|
// The result does not contain max_id's notification, when we specify max_id parameter in get notifications.
|
||||||
// So we need to get max_id's notification.
|
// So we need to get max_id's notification.
|
||||||
const last = await client.getNotification(localMarker.last_read_id)
|
const last = await client.getNotification(localMarker.last_read_id)
|
||||||
@ -224,7 +224,7 @@ const actions: ActionTree<NotificationsState, RootState> = {
|
|||||||
win.ipcRenderer.send('reset-badge')
|
win.ipcRenderer.send('reset-badge')
|
||||||
},
|
},
|
||||||
getMarker: async ({ rootState }): Promise<LocalMarker | null> => {
|
getMarker: async ({ rootState }): Promise<LocalMarker | null> => {
|
||||||
if (!rootState.App.useMarker) {
|
if (!rootState.App.useMarkerTimeline.includes('notifications')) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const client = generator(
|
const client = generator(
|
||||||
|
@ -2,5 +2,5 @@ export type Timeline = {
|
|||||||
cw: boolean
|
cw: boolean
|
||||||
nsfw: boolean
|
nsfw: boolean
|
||||||
hideAllAttachments: boolean
|
hideAllAttachments: boolean
|
||||||
useMarker: boolean
|
useMarkerTimeline: Array<string>
|
||||||
}
|
}
|
||||||
|
38
yarn.lock
38
yarn.lock
@ -1352,14 +1352,6 @@
|
|||||||
lodash "^4.17.15"
|
lodash "^4.17.15"
|
||||||
tmp-promise "^3.0.2"
|
tmp-promise "^3.0.2"
|
||||||
|
|
||||||
"@mapbox/stylelint-processor-arbitrary-tags@^0.4.0":
|
|
||||||
version "0.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@mapbox/stylelint-processor-arbitrary-tags/-/stylelint-processor-arbitrary-tags-0.4.0.tgz#da45723d8ce75140d08efe3bddd284eba3a3fe53"
|
|
||||||
integrity sha512-HTyW4vLgCVrAvmbV4TtXVpkrg3gkRR4WMEveNOo4OBxzA5wl5xQdxe0Iow8B5FRI3ose5yFLA8jvbfU8ZayPJQ==
|
|
||||||
dependencies:
|
|
||||||
execall "^1.0.0"
|
|
||||||
split-lines "^1.1.0"
|
|
||||||
|
|
||||||
"@nodelib/fs.scandir@2.1.3":
|
"@nodelib/fs.scandir@2.1.3":
|
||||||
version "2.1.3"
|
version "2.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
|
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
|
||||||
@ -3448,14 +3440,6 @@ clone-deep@^4.0.1:
|
|||||||
kind-of "^6.0.2"
|
kind-of "^6.0.2"
|
||||||
shallow-clone "^3.0.0"
|
shallow-clone "^3.0.0"
|
||||||
|
|
||||||
clone-regexp@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-1.0.1.tgz#051805cd33173375d82118fc0918606da39fd60f"
|
|
||||||
integrity sha512-Fcij9IwRW27XedRIJnSOEupS7RVcXtObJXbcUOX93UCLqqOdRpkvzKywOOSizmEK/Is3S/RHX9dLdfo6R1Q1mw==
|
|
||||||
dependencies:
|
|
||||||
is-regexp "^1.0.0"
|
|
||||||
is-supported-regexp-flag "^1.0.0"
|
|
||||||
|
|
||||||
clone-regexp@^2.1.0:
|
clone-regexp@^2.1.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-2.2.0.tgz#7d65e00885cd8796405c35a737e7a86b7429e36f"
|
resolved "https://registry.yarnpkg.com/clone-regexp/-/clone-regexp-2.2.0.tgz#7d65e00885cd8796405c35a737e7a86b7429e36f"
|
||||||
@ -5122,13 +5106,6 @@ execa@^5.0.0:
|
|||||||
signal-exit "^3.0.3"
|
signal-exit "^3.0.3"
|
||||||
strip-final-newline "^2.0.0"
|
strip-final-newline "^2.0.0"
|
||||||
|
|
||||||
execall@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/execall/-/execall-1.0.0.tgz#73d0904e395b3cab0658b08d09ec25307f29bb73"
|
|
||||||
integrity sha1-c9CQTjlbPKsGWLCNCewlMH8pu3M=
|
|
||||||
dependencies:
|
|
||||||
clone-regexp "^1.0.0"
|
|
||||||
|
|
||||||
execall@^2.0.0:
|
execall@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/execall/-/execall-2.0.0.tgz#16a06b5fe5099df7d00be5d9c06eecded1663b45"
|
resolved "https://registry.yarnpkg.com/execall/-/execall-2.0.0.tgz#16a06b5fe5099df7d00be5d9c06eecded1663b45"
|
||||||
@ -6812,11 +6789,6 @@ is-regex@^1.1.4:
|
|||||||
call-bind "^1.0.2"
|
call-bind "^1.0.2"
|
||||||
has-tostringtag "^1.0.0"
|
has-tostringtag "^1.0.0"
|
||||||
|
|
||||||
is-regexp@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069"
|
|
||||||
integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk=
|
|
||||||
|
|
||||||
is-regexp@^2.0.0:
|
is-regexp@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-2.1.0.tgz#cd734a56864e23b956bf4e7c66c396a4c0b22c2d"
|
resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-2.1.0.tgz#cd734a56864e23b956bf4e7c66c396a4c0b22c2d"
|
||||||
@ -6849,11 +6821,6 @@ is-string@^1.0.7:
|
|||||||
dependencies:
|
dependencies:
|
||||||
has-tostringtag "^1.0.0"
|
has-tostringtag "^1.0.0"
|
||||||
|
|
||||||
is-supported-regexp-flag@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.1.tgz#21ee16518d2c1dd3edd3e9a0d57e50207ac364ca"
|
|
||||||
integrity sha512-3vcJecUUrpgCqc/ca0aWeNu64UGgxcvO60K/Fkr1N6RSvfGCTU60UKN68JDmKokgba0rFFJs12EnzOQa14ubKQ==
|
|
||||||
|
|
||||||
is-symbol@^1.0.2:
|
is-symbol@^1.0.2:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937"
|
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937"
|
||||||
@ -10499,11 +10466,6 @@ specificity@^0.4.1:
|
|||||||
resolved "https://registry.yarnpkg.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019"
|
resolved "https://registry.yarnpkg.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019"
|
||||||
integrity sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==
|
integrity sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==
|
||||||
|
|
||||||
split-lines@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/split-lines/-/split-lines-1.1.0.tgz#3abba8f598614142f9db8d27ab6ab875662a1e09"
|
|
||||||
integrity sha1-Oruo9ZhhQUL5240nq2q4dWYqHgk=
|
|
||||||
|
|
||||||
split-string@^3.0.1, split-string@^3.0.2:
|
split-string@^3.0.1, split-string@^3.0.2:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user