Merge pull request #849 from h3poteto/iss-843
closes #843 Add mentions timeline
This commit is contained in:
commit
bf1927fbb2
@ -63,6 +63,13 @@ const PublicStore = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MentionStore = {
|
||||||
|
namespaced: true,
|
||||||
|
actions: {
|
||||||
|
fetchMentions: jest.fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const contentsStore = {
|
const contentsStore = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
modules: {
|
modules: {
|
||||||
@ -70,7 +77,8 @@ const contentsStore = {
|
|||||||
Notifications: notificationStore,
|
Notifications: notificationStore,
|
||||||
DirectMessages: DMStore,
|
DirectMessages: DMStore,
|
||||||
Local: LocalStore,
|
Local: LocalStore,
|
||||||
Public: PublicStore
|
Public: PublicStore,
|
||||||
|
Mentions: MentionStore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import Home from '~/src/renderer/store/TimelineSpace/Contents/Home'
|
|||||||
jest.genMockFromModule('megalodon')
|
jest.genMockFromModule('megalodon')
|
||||||
jest.mock('megalodon')
|
jest.mock('megalodon')
|
||||||
|
|
||||||
const state = () => {
|
let state = () => {
|
||||||
return {
|
return {
|
||||||
lazyLoading: false,
|
lazyLoading: false,
|
||||||
heading: true,
|
heading: true,
|
||||||
@ -89,6 +89,22 @@ describe('Home', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('success', () => {
|
describe('success', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
state = () => {
|
||||||
|
return {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
timeline: [
|
||||||
|
{ id: 3 },
|
||||||
|
{ id: 4 }
|
||||||
|
],
|
||||||
|
unreadTimeline: [],
|
||||||
|
filter: '',
|
||||||
|
showReblogs: true,
|
||||||
|
showReplies: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
it('should be updated', async () => {
|
it('should be updated', async () => {
|
||||||
const mockClient = {
|
const mockClient = {
|
||||||
get: () => {
|
get: () => {
|
||||||
@ -106,6 +122,8 @@ describe('Home', () => {
|
|||||||
await store.dispatch('Home/lazyFetchTimeline', { id: 20 })
|
await store.dispatch('Home/lazyFetchTimeline', { id: 20 })
|
||||||
expect(store.state.Home.lazyLoading).toEqual(false)
|
expect(store.state.Home.lazyLoading).toEqual(false)
|
||||||
expect(store.state.Home.timeline).toEqual([
|
expect(store.state.Home.timeline).toEqual([
|
||||||
|
{ id: 3 },
|
||||||
|
{ id: 4 },
|
||||||
{ id: 19 },
|
{ id: 19 },
|
||||||
{ id: 18 }
|
{ id: 18 }
|
||||||
])
|
])
|
||||||
|
@ -0,0 +1,178 @@
|
|||||||
|
import Mastodon from 'megalodon'
|
||||||
|
import { createLocalVue } from '@vue/test-utils'
|
||||||
|
import Vuex from 'vuex'
|
||||||
|
import Mentions from '~/src/renderer/store/TimelineSpace/Contents/Mentions'
|
||||||
|
|
||||||
|
jest.genMockFromModule('megalodon')
|
||||||
|
jest.mock('megalodon')
|
||||||
|
|
||||||
|
let state = () => {
|
||||||
|
return {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
mentions: [],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const initStore = () => {
|
||||||
|
return {
|
||||||
|
namespaced: true,
|
||||||
|
state: state(),
|
||||||
|
actions: Mentions.actions,
|
||||||
|
mutations: Mentions.mutations,
|
||||||
|
getters: Mentions.getters
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const timelineState = {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
account: {
|
||||||
|
accessToken: 'token',
|
||||||
|
baseURL: 'http://localhost'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Mentions', () => {
|
||||||
|
let store
|
||||||
|
let localVue
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
localVue = createLocalVue()
|
||||||
|
localVue.use(Vuex)
|
||||||
|
store = new Vuex.Store({
|
||||||
|
modules: {
|
||||||
|
Mentions: initStore(),
|
||||||
|
TimelineSpace: timelineState
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mastodon.mockClear()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('fetchMentions', () => {
|
||||||
|
it('should be updated', async () => {
|
||||||
|
const mockClient = {
|
||||||
|
get: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve({
|
||||||
|
data: [
|
||||||
|
{ id: 1, type: 'mention' },
|
||||||
|
{ id: 2, type: 'favourite' },
|
||||||
|
{ id: 3, type: 'reblog' },
|
||||||
|
{ id: 4, type: 'follow' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Mastodon.mockImplementation(() => mockClient)
|
||||||
|
await store.dispatch('Mentions/fetchMentions')
|
||||||
|
expect(store.state.Mentions.mentions).toEqual([
|
||||||
|
{ id: 1, type: 'mention' },
|
||||||
|
{ id: 2, type: 'favourite' },
|
||||||
|
{ id: 3, type: 'reblog' },
|
||||||
|
{ id: 4, type: 'follow' }
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('lazyFetchMentions', () => {
|
||||||
|
describe('last is null', () => {
|
||||||
|
it('should not be updated', async () => {
|
||||||
|
const result = await store.dispatch('Mentions/lazyFetchMentions', null)
|
||||||
|
expect(result).toEqual(null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('loading', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
state = () => {
|
||||||
|
return {
|
||||||
|
lazyLoading: true,
|
||||||
|
heading: true,
|
||||||
|
mentions: [],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should not be updated', async () => {
|
||||||
|
const result = await store.dispatch('Mentions/lazyFetchMentions', {})
|
||||||
|
expect(result).toEqual(null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('success', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
state = () => {
|
||||||
|
return {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
mentions: [
|
||||||
|
{ id: 1, type: 'mention' },
|
||||||
|
{ id: 2, type: 'favourite' },
|
||||||
|
{ id: 3, type: 'reblog' },
|
||||||
|
{ id: 4, type: 'follow' }
|
||||||
|
],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should be updated', async () => {
|
||||||
|
const mockClient = {
|
||||||
|
get: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve({
|
||||||
|
data: [
|
||||||
|
{ id: 5, type: 'mention' },
|
||||||
|
{ id: 6, type: 'favourite' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Mastodon.mockImplementation(() => mockClient)
|
||||||
|
await store.dispatch('Mentions/lazyFetchMentions', { id: 1 })
|
||||||
|
expect(store.state.Mentions.mentions).toEqual([
|
||||||
|
{ id: 1, type: 'mention' },
|
||||||
|
{ id: 2, type: 'favourite' },
|
||||||
|
{ id: 3, type: 'reblog' },
|
||||||
|
{ id: 4, type: 'follow' },
|
||||||
|
{ id: 5, type: 'mention' },
|
||||||
|
{ id: 6, type: 'favourite' }
|
||||||
|
])
|
||||||
|
expect(store.state.Mentions.lazyLoading).toEqual(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('mentions', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
state = () => {
|
||||||
|
return {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
mentions: [
|
||||||
|
{ id: 1, type: 'mention' },
|
||||||
|
{ id: 2, type: 'favourite' },
|
||||||
|
{ id: 3, type: 'reblog' },
|
||||||
|
{ id: 4, type: 'follow' }
|
||||||
|
],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should return only mentions', () => {
|
||||||
|
const mentions = store.getters['Mentions/mentions']
|
||||||
|
expect(mentions).toEqual([
|
||||||
|
{ id: 1, type: 'mention' }
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
114
spec/renderer/unit/store/TimelineSpace/Contents/Mentions.spec.js
Normal file
114
spec/renderer/unit/store/TimelineSpace/Contents/Mentions.spec.js
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import Mentions from '@/store/TimelineSpace/Contents/Mentions'
|
||||||
|
|
||||||
|
describe('TimelineSpace/Contents/Mentions', () => {
|
||||||
|
describe('mutations', () => {
|
||||||
|
let state
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
mentions: [],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('appendMentions', () => {
|
||||||
|
describe('heading', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
mentions: [5, 4, 3, 2, 1],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should update mentions', () => {
|
||||||
|
Mentions.mutations.appendMentions(state, 6)
|
||||||
|
expect(state.mentions).toEqual([6, 5, 4, 3, 2, 1])
|
||||||
|
expect(state.unreadMentions).toEqual([])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
describe('not heading', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: false,
|
||||||
|
mentions: [5, 4, 3, 2, 1],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should update mentions', () => {
|
||||||
|
Mentions.mutations.appendMentions(state, 6)
|
||||||
|
expect(state.mentions).toEqual([5, 4, 3, 2, 1])
|
||||||
|
expect(state.unreadMentions).toEqual([6])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('mergeMentions', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: false,
|
||||||
|
mentions: [5, 4, 3, 2, 1],
|
||||||
|
unreadMentions: [8, 7, 6],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should be merged', () => {
|
||||||
|
Mentions.mutations.mergeMentions(state)
|
||||||
|
expect(state.mentions).toEqual([8, 7, 6, 5, 4, 3, 2, 1])
|
||||||
|
expect(state.unreadMentions).toEqual([])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('insertMentions', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: false,
|
||||||
|
mentions: [5, 4, 3, 2, 1],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should be inserted', () => {
|
||||||
|
Mentions.mutations.insertMentions(state, [-1, -2, -3, -4])
|
||||||
|
expect(state.mentions).toEqual([5, 4, 3, 2, 1, -1, -2, -3, -4])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('updateToot', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: false,
|
||||||
|
mentions: [
|
||||||
|
{ type: 'mention', status: { id: 20, favourited: false } },
|
||||||
|
{ type: 'favourite', status: { id: 19, favourited: false } },
|
||||||
|
{ type: 'reblog', status: { id: 18, favourited: false } },
|
||||||
|
{ type: 'follow', status: { id: 17, favourited: false } },
|
||||||
|
{ type: 'mention', status: { id: 16, favourited: false } }
|
||||||
|
],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it('should be updated', () => {
|
||||||
|
Mentions.mutations.updateToot(state, { id: 20, favourited: true })
|
||||||
|
expect(state.mentions).toEqual(
|
||||||
|
[
|
||||||
|
{ type: 'mention', status: { id: 20, favourited: true } },
|
||||||
|
{ type: 'favourite', status: { id: 19, favourited: false } },
|
||||||
|
{ type: 'reblog', status: { id: 18, favourited: false } },
|
||||||
|
{ type: 'follow', status: { id: 17, favourited: false } },
|
||||||
|
{ type: 'mention', status: { id: 16, favourited: false } }
|
||||||
|
]
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
@ -47,6 +47,7 @@
|
|||||||
"expand": "Expand",
|
"expand": "Expand",
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"notification": "Notification",
|
"notification": "Notification",
|
||||||
|
"mention": "Mention",
|
||||||
"direct": "Direct messages",
|
"direct": "Direct messages",
|
||||||
"favourite": "Favourite",
|
"favourite": "Favourite",
|
||||||
"local": "Local timeline",
|
"local": "Local timeline",
|
||||||
@ -58,6 +59,7 @@
|
|||||||
"header_menu": {
|
"header_menu": {
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"notification": "Notification",
|
"notification": "Notification",
|
||||||
|
"mention": "Mention",
|
||||||
"favourite": "Favourite",
|
"favourite": "Favourite",
|
||||||
"local": "Local timeline",
|
"local": "Local timeline",
|
||||||
"public": "Public timeline",
|
"public": "Public timeline",
|
||||||
|
@ -413,6 +413,11 @@ ipcMain.on('start-user-streaming', (event, obj) => {
|
|||||||
},
|
},
|
||||||
(notification) => {
|
(notification) => {
|
||||||
event.sender.send('notification-start-user-streaming', notification)
|
event.sender.send('notification-start-user-streaming', notification)
|
||||||
|
// Does not exist a endpoint for only mention. And mention is a part of notification.
|
||||||
|
// So we have to get mention from notification.
|
||||||
|
if (notification.type === 'mention') {
|
||||||
|
event.sender.send('mention-start-user-streaming', notification)
|
||||||
|
}
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
app.dock.setBadge('•')
|
app.dock.setBadge('•')
|
||||||
}
|
}
|
||||||
|
236
src/renderer/components/TimelineSpace/Contents/Mentions.vue
Normal file
236
src/renderer/components/TimelineSpace/Contents/Mentions.vue
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
<template>
|
||||||
|
<div id="mentions" v-shortkey="shortcutEnabled ? {next: ['j']} : {}" @shortkey="handleKey">
|
||||||
|
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
|
||||||
|
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
|
||||||
|
</div>
|
||||||
|
<transition-group name="timeline" tag="div">
|
||||||
|
<div class="mentions" v-for="message in mentions" :key="message.id">
|
||||||
|
<notification
|
||||||
|
:message="message"
|
||||||
|
:filter="filter"
|
||||||
|
:focused="message.id === focusedId"
|
||||||
|
:overlaid="modalOpened"
|
||||||
|
v-on:update="updateToot"
|
||||||
|
@focusNext="focusNext"
|
||||||
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
|
@selectNotification="focusNotification(message)"
|
||||||
|
>
|
||||||
|
</notification>
|
||||||
|
</div>
|
||||||
|
</transition-group>
|
||||||
|
<div class="loading-card" v-loading="lazyLoading" :element-loading-background="backgroundColor">
|
||||||
|
</div>
|
||||||
|
<div :class="openSideBar ? 'upper-with-side-bar' : 'upper'" v-show="!heading">
|
||||||
|
<el-button type="primary" icon="el-icon-arrow-up" @click="upper" circle>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState, mapGetters } from 'vuex'
|
||||||
|
import Notification from '~/src/renderer/components/molecules/Notification'
|
||||||
|
import scrollTop from '../../utils/scroll'
|
||||||
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'mentions',
|
||||||
|
components: { Notification },
|
||||||
|
mixins: [reloadable],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
focusedId: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState('App', {
|
||||||
|
backgroundColor: state => state.theme.background_color
|
||||||
|
}),
|
||||||
|
...mapState('TimelineSpace/HeaderMenu', {
|
||||||
|
startReload: state => state.reload
|
||||||
|
}),
|
||||||
|
...mapState('TimelineSpace/Contents/SideBar', {
|
||||||
|
openSideBar: state => state.openSideBar
|
||||||
|
}),
|
||||||
|
...mapState('TimelineSpace/Contents/Mentions', {
|
||||||
|
lazyLoading: state => state.lazyLoading,
|
||||||
|
heading: state => state.heading,
|
||||||
|
unread: state => state.unreadMentions,
|
||||||
|
filter: state => state.filter
|
||||||
|
}),
|
||||||
|
...mapGetters('TimelineSpace/Modals', [
|
||||||
|
'modalOpened'
|
||||||
|
]),
|
||||||
|
...mapGetters('TimelineSpace/Contents/Mentions', [
|
||||||
|
'mentions'
|
||||||
|
]),
|
||||||
|
shortcutEnabled: function () {
|
||||||
|
if (this.modalOpened) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!this.focusedId) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// Sometimes toots are deleted, so perhaps focused toot don't exist.
|
||||||
|
const currentIndex = this.mentions.findIndex(toot => this.focusedId === toot.id)
|
||||||
|
return currentIndex === -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadMentions', false)
|
||||||
|
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
||||||
|
Event.$on('focus-timeline', () => {
|
||||||
|
// If focusedId does not change, we have to refresh focusedId because Toot component watch change events.
|
||||||
|
const previousFocusedId = this.focusedId
|
||||||
|
this.focusedId = 0
|
||||||
|
this.$nextTick(function () {
|
||||||
|
this.focusedId = previousFocusedId
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeUpdate () {
|
||||||
|
if (this.$store.state.TimelineSpace.SideMenu.unreadMentions && this.heading) {
|
||||||
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadMentions', false)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
Event.$off('focus-timeline')
|
||||||
|
},
|
||||||
|
destroyed () {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/changeHeading', true)
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/mergeMentions')
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/archiveMentions')
|
||||||
|
if (document.getElementById('scrollable') !== undefined && document.getElementById('scrollable') !== null) {
|
||||||
|
document.getElementById('scrollable').removeEventListener('scroll', this.onScroll)
|
||||||
|
document.getElementById('scrollable').scrollTop = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
startReload: function (newState, oldState) {
|
||||||
|
if (!oldState && newState) {
|
||||||
|
this.reload()
|
||||||
|
.finally(() => {
|
||||||
|
this.$store.commit('TimelineSpace/HeaderMenu/changeReload', false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusedId: function (newState, oldState) {
|
||||||
|
if (newState && this.heading) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/changeHeading', false)
|
||||||
|
} else if (newState === null && !this.heading) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/changeHeading', true)
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/mergeMentions')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onScroll (event) {
|
||||||
|
// for lazyLoading
|
||||||
|
if (((event.target.clientHeight + event.target.scrollTop) >= document.getElementById('mentions').clientHeight - 10) && !this.lazyloading) {
|
||||||
|
this.$store.dispatch('TimelineSpace/Contents/Mentions/lazyFetchMentions', this.mentions[this.mentions.length - 1])
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
message: this.$t('message.timeline_fetch_error'),
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// for unread control
|
||||||
|
if ((event.target.scrollTop > 10) && this.heading) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/changeHeading', false)
|
||||||
|
} else if ((event.target.scrollTop <= 10) && !this.heading) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/changeHeading', true)
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/mergeMentions')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async reload () {
|
||||||
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
|
try {
|
||||||
|
await this.reloadable()
|
||||||
|
} finally {
|
||||||
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateToot (message) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/updateToot', message)
|
||||||
|
},
|
||||||
|
upper () {
|
||||||
|
scrollTop(
|
||||||
|
document.getElementById('scrollable'),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
this.focusedId = null
|
||||||
|
},
|
||||||
|
focusNext () {
|
||||||
|
const currentIndex = this.mentions.findIndex(toot => this.focusedId === toot.id)
|
||||||
|
if (currentIndex === -1) {
|
||||||
|
this.focusedId = this.mentions[0].id
|
||||||
|
} else if (currentIndex < this.mentions.length) {
|
||||||
|
this.focusedId = this.mentions[currentIndex + 1].id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusPrev () {
|
||||||
|
const currentIndex = this.mentions.findIndex(toot => this.focusedId === toot.id)
|
||||||
|
if (currentIndex === 0) {
|
||||||
|
this.focusedId = null
|
||||||
|
} else if (currentIndex > 0) {
|
||||||
|
this.focusedId = this.mentions[currentIndex - 1].id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusNotification (message) {
|
||||||
|
this.focusedId = message.id
|
||||||
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
|
handleKey (event) {
|
||||||
|
switch (event.srcKey) {
|
||||||
|
case 'next':
|
||||||
|
this.focusedId = this.mentions[0].id
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
#mentions {
|
||||||
|
.unread {
|
||||||
|
position: fixed;
|
||||||
|
right: 24px;
|
||||||
|
top: 48px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
color: #fff;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 0 0 2px 2px;
|
||||||
|
|
||||||
|
&:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-card {
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-card:empty {
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper-with-side-bar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: calc(20px + 360px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style src="@/assets/timeline-transition.scss"></style>
|
@ -10,6 +10,7 @@
|
|||||||
:filter="filter"
|
:filter="filter"
|
||||||
:focused="message.id === focusedId"
|
:focused="message.id === focusedId"
|
||||||
:overlaid="modalOpened"
|
:overlaid="modalOpened"
|
||||||
|
v-on:update="updateToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
@focusRight="focusSidebar"
|
@focusRight="focusSidebar"
|
||||||
@ -148,6 +149,9 @@ export default {
|
|||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updateToot (message) {
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Notifications/updateToot', message)
|
||||||
|
},
|
||||||
upper () {
|
upper () {
|
||||||
scrollTop(
|
scrollTop(
|
||||||
document.getElementById('scrollable'),
|
document.getElementById('scrollable'),
|
||||||
|
@ -103,6 +103,9 @@ export default {
|
|||||||
case 'favourites':
|
case 'favourites':
|
||||||
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.favourite'))
|
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.favourite'))
|
||||||
break
|
break
|
||||||
|
case 'mentions':
|
||||||
|
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.mention'))
|
||||||
|
break
|
||||||
case 'local':
|
case 'local':
|
||||||
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.local'))
|
this.$store.commit('TimelineSpace/HeaderMenu/updateTitle', this.$t('header_menu.local'))
|
||||||
break
|
break
|
||||||
@ -148,6 +151,7 @@ export default {
|
|||||||
switch (this.$route.name) {
|
switch (this.$route.name) {
|
||||||
case 'home':
|
case 'home':
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
|
case 'mentions':
|
||||||
case 'favourites':
|
case 'favourites':
|
||||||
case 'local':
|
case 'local':
|
||||||
case 'public':
|
case 'public':
|
||||||
@ -164,6 +168,7 @@ export default {
|
|||||||
switch (this.$route.name) {
|
switch (this.$route.name) {
|
||||||
case 'home':
|
case 'home':
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
|
case 'mentions':
|
||||||
case 'favourites':
|
case 'favourites':
|
||||||
case 'local':
|
case 'local':
|
||||||
case 'public':
|
case 'public':
|
||||||
@ -185,6 +190,9 @@ export default {
|
|||||||
case 'notifications':
|
case 'notifications':
|
||||||
this.filter = this.$store.state.TimelineSpace.Contents.Notifications.filter
|
this.filter = this.$store.state.TimelineSpace.Contents.Notifications.filter
|
||||||
break
|
break
|
||||||
|
case 'mentions':
|
||||||
|
this.filter = this.$store.state.TimelineSpace.Contents.Mentions.filter
|
||||||
|
break
|
||||||
case 'favourites':
|
case 'favourites':
|
||||||
this.filter = this.$store.state.TimelineSpace.Contents.Favourites.filter
|
this.filter = this.$store.state.TimelineSpace.Contents.Favourites.filter
|
||||||
break
|
break
|
||||||
@ -217,6 +225,9 @@ export default {
|
|||||||
case 'notifications':
|
case 'notifications':
|
||||||
this.$store.commit('TimelineSpace/Contents/Notifications/changeFilter', filter)
|
this.$store.commit('TimelineSpace/Contents/Notifications/changeFilter', filter)
|
||||||
break
|
break
|
||||||
|
case 'mentions':
|
||||||
|
this.$store.commit('TimelineSpace/Contents/Mentions/changeFilter', filter)
|
||||||
|
break
|
||||||
case 'favourites':
|
case 'favourites':
|
||||||
this.$store.commit('TimelineSpace/Contents/Favourites/changeFilter', filter)
|
this.$store.commit('TimelineSpace/Contents/Favourites/changeFilter', filter)
|
||||||
break
|
break
|
||||||
@ -244,6 +255,7 @@ export default {
|
|||||||
switch (this.$route.name) {
|
switch (this.$route.name) {
|
||||||
case 'home':
|
case 'home':
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
|
case 'mentions':
|
||||||
case 'favourites':
|
case 'favourites':
|
||||||
case 'local':
|
case 'local':
|
||||||
case 'public':
|
case 'public':
|
||||||
|
@ -52,9 +52,11 @@
|
|||||||
<el-badge is-dot :hidden="!unreadNotifications">
|
<el-badge is-dot :hidden="!unreadNotifications">
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item :index="`/${id()}/favourites`" role="menuitem" :title="$t('side_menu.favourite')">
|
<el-menu-item :index="`/${id()}/mentions`" role="menuitem" :title="$t('side_menu.mention')">
|
||||||
<icon name="star"></icon>
|
<icon name="at"></icon>
|
||||||
<span>{{ $t("side_menu.favourite") }}</span>
|
<span>{{ $t("side_menu.mention") }}</span>
|
||||||
|
<el-badge is-dot :hidden="!unreadMentions">
|
||||||
|
</el-badge>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item :index="`/${id()}/direct-messages`" role="menuitem">
|
<el-menu-item :index="`/${id()}/direct-messages`" role="menuitem">
|
||||||
<icon name="envelope"></icon>
|
<icon name="envelope"></icon>
|
||||||
@ -62,6 +64,10 @@
|
|||||||
<el-badge is-dot :hidden="!unreadDirectMessagesTimeline">
|
<el-badge is-dot :hidden="!unreadDirectMessagesTimeline">
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
<el-menu-item :index="`/${id()}/favourites`" role="menuitem" :title="$t('side_menu.favourite')">
|
||||||
|
<icon name="star"></icon>
|
||||||
|
<span>{{ $t("side_menu.favourite") }}</span>
|
||||||
|
</el-menu-item>
|
||||||
<el-menu-item :index="`/${id()}/local`" role="menuitem" :title="$t('side_menu.local')">
|
<el-menu-item :index="`/${id()}/local`" role="menuitem" :title="$t('side_menu.local')">
|
||||||
<icon name="users"></icon>
|
<icon name="users"></icon>
|
||||||
<span>{{ $t("side_menu.local") }}</span>
|
<span>{{ $t("side_menu.local") }}</span>
|
||||||
@ -118,6 +124,7 @@ export default {
|
|||||||
...mapState('TimelineSpace/SideMenu', {
|
...mapState('TimelineSpace/SideMenu', {
|
||||||
unreadHomeTimeline: state => state.unreadHomeTimeline,
|
unreadHomeTimeline: state => state.unreadHomeTimeline,
|
||||||
unreadNotifications: state => state.unreadNotifications,
|
unreadNotifications: state => state.unreadNotifications,
|
||||||
|
unreadMentions: state => state.unreadMentions,
|
||||||
unreadLocalTimeline: state => state.unreadLocalTimeline,
|
unreadLocalTimeline: state => state.unreadLocalTimeline,
|
||||||
unreadDirectMessagesTimeline: state => state.unreadDirectMessagesTimeline,
|
unreadDirectMessagesTimeline: state => state.unreadDirectMessagesTimeline,
|
||||||
unreadPublicTimeline: state => state.unreadPublicTimeline,
|
unreadPublicTimeline: state => state.unreadPublicTimeline,
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
:filter="filter"
|
:filter="filter"
|
||||||
:focused="focused"
|
:focused="focused"
|
||||||
:overlaid="overlaid"
|
:overlaid="overlaid"
|
||||||
|
v-on:update="updateToot"
|
||||||
|
v-on:delete="deleteToot"
|
||||||
@focusNext="$emit('focusNext')"
|
@focusNext="$emit('focusNext')"
|
||||||
@focusPrev="$emit('focusPrev')"
|
@focusPrev="$emit('focusPrev')"
|
||||||
@focusRight="$emit('focusRight')"
|
@focusRight="$emit('focusRight')"
|
||||||
@ -72,7 +74,15 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: { Favourite, Follow, Mention, Reblog }
|
components: { Favourite, Follow, Mention, Reblog },
|
||||||
|
methods: {
|
||||||
|
updateToot (message) {
|
||||||
|
return this.$emit('update', message)
|
||||||
|
},
|
||||||
|
deleteToot (message) {
|
||||||
|
return this.$emit('delete', message)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
:focused="focused"
|
:focused="focused"
|
||||||
:overlaid="overlaid"
|
:overlaid="overlaid"
|
||||||
v-on:update="updateToot"
|
v-on:update="updateToot"
|
||||||
|
v-on:delete="deleteToot"
|
||||||
@focusNext="$emit('focusNext')"
|
@focusNext="$emit('focusNext')"
|
||||||
@focusPrev="$emit('focusPrev')"
|
@focusPrev="$emit('focusPrev')"
|
||||||
@focusRight="$emit('focusRight')"
|
@focusRight="$emit('focusRight')"
|
||||||
@ -41,7 +42,10 @@ export default {
|
|||||||
components: { Toot },
|
components: { Toot },
|
||||||
methods: {
|
methods: {
|
||||||
updateToot (message) {
|
updateToot (message) {
|
||||||
this.$store.commit('TimelineSpace/Contents/Notifications/updateToot', message)
|
return this.$emit('update', message)
|
||||||
|
},
|
||||||
|
deleteToot (message) {
|
||||||
|
return this.$emit('delete', message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,11 @@ export default new Router({
|
|||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
component: require('@/components/TimelineSpace/Contents/Notifications').default
|
component: require('@/components/TimelineSpace/Contents/Notifications').default
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'mentions',
|
||||||
|
name: 'mentions',
|
||||||
|
component: require('@/components/TimelineSpace/Contents/Mentions').default
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'favourites',
|
path: 'favourites',
|
||||||
name: 'favourites',
|
name: 'favourites',
|
||||||
|
@ -189,6 +189,7 @@ const TimelineSpace = {
|
|||||||
async fetchContentsTimelines ({ dispatch, state }, account) {
|
async fetchContentsTimelines ({ dispatch, state }, account) {
|
||||||
await dispatch('TimelineSpace/Contents/Home/fetchTimeline', account, { root: true })
|
await dispatch('TimelineSpace/Contents/Home/fetchTimeline', account, { root: true })
|
||||||
await dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account, { root: true })
|
await dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account, { root: true })
|
||||||
|
await dispatch('TimelineSpace/Contents/Mentions/fetchMentions', {}, { root: true })
|
||||||
if (state.unreadNotification.direct) {
|
if (state.unreadNotification.direct) {
|
||||||
await dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline', {}, { root: true })
|
await dispatch('TimelineSpace/Contents/DirectMessages/fetchTimeline', {}, { root: true })
|
||||||
}
|
}
|
||||||
@ -205,6 +206,7 @@ const TimelineSpace = {
|
|||||||
commit('TimelineSpace/Contents/DirectMessages/clearTimeline', {}, { root: true })
|
commit('TimelineSpace/Contents/DirectMessages/clearTimeline', {}, { root: true })
|
||||||
commit('TimelineSpace/Contents/Notifications/clearNotifications', {}, { root: true })
|
commit('TimelineSpace/Contents/Notifications/clearNotifications', {}, { root: true })
|
||||||
commit('TimelineSpace/Contents/Public/clearTimeline', {}, { root: true })
|
commit('TimelineSpace/Contents/Public/clearTimeline', {}, { root: true })
|
||||||
|
commit('TimelineSpace/Contents/Mentions/clearMentions', {}, { root: true })
|
||||||
},
|
},
|
||||||
bindStreamings ({ dispatch, state }, account) {
|
bindStreamings ({ dispatch, state }, account) {
|
||||||
dispatch('bindUserStreaming', account)
|
dispatch('bindUserStreaming', account)
|
||||||
@ -267,6 +269,13 @@ const TimelineSpace = {
|
|||||||
}
|
}
|
||||||
commit('TimelineSpace/SideMenu/changeUnreadNotifications', true, { root: true })
|
commit('TimelineSpace/SideMenu/changeUnreadNotifications', true, { root: true })
|
||||||
})
|
})
|
||||||
|
ipcRenderer.on('mention-start-user-streaming', (event, mention) => {
|
||||||
|
commit('TimelineSpace/Contents/Mentions/appendMentions', mention, { root: true })
|
||||||
|
if (rootState.TimelineSpace.Contents.Mentions.heading && Math.random() > 0.8) {
|
||||||
|
commit('TimelineSpace/Contents/Mentions/archiveMentions', null, { root: true })
|
||||||
|
}
|
||||||
|
commit('TimelineSpace/SideMenu/changeUnreadMentions', true, { root: true })
|
||||||
|
})
|
||||||
},
|
},
|
||||||
startUserStreaming ({ state }) {
|
startUserStreaming ({ state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -8,6 +8,7 @@ import Search from './Contents/Search'
|
|||||||
import Lists from './Contents/Lists'
|
import Lists from './Contents/Lists'
|
||||||
import Hashtag from './Contents/Hashtag'
|
import Hashtag from './Contents/Hashtag'
|
||||||
import DirectMessages from './Contents/DirectMessages'
|
import DirectMessages from './Contents/DirectMessages'
|
||||||
|
import Mentions from './Contents/Mentions'
|
||||||
|
|
||||||
const Contents = {
|
const Contents = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
@ -18,6 +19,7 @@ const Contents = {
|
|||||||
Favourites,
|
Favourites,
|
||||||
Local,
|
Local,
|
||||||
DirectMessages,
|
DirectMessages,
|
||||||
|
Mentions,
|
||||||
Public,
|
Public,
|
||||||
Search,
|
Search,
|
||||||
Lists,
|
Lists,
|
||||||
|
100
src/renderer/store/TimelineSpace/Contents/Mentions.js
Normal file
100
src/renderer/store/TimelineSpace/Contents/Mentions.js
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
import Mastodon from 'megalodon'
|
||||||
|
|
||||||
|
const Mentions = {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
lazyLoading: false,
|
||||||
|
heading: true,
|
||||||
|
mentions: [],
|
||||||
|
unreadMentions: [],
|
||||||
|
filter: ''
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
changeLazyLoading (state, value) {
|
||||||
|
state.lazyLoading = value
|
||||||
|
},
|
||||||
|
changeHeading (state, value) {
|
||||||
|
state.heading = value
|
||||||
|
},
|
||||||
|
appendMentions (state, update) {
|
||||||
|
if (state.heading) {
|
||||||
|
state.mentions = [update].concat(state.mentions)
|
||||||
|
} else {
|
||||||
|
state.unreadMentions = [update].concat(state.unreadMentions)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateMentions (state, messages) {
|
||||||
|
state.mentions = messages
|
||||||
|
},
|
||||||
|
mergeMentions (state) {
|
||||||
|
state.mentions = state.unreadMentions.slice(0, 80).concat(state.mentions)
|
||||||
|
state.unreadMentions = []
|
||||||
|
},
|
||||||
|
insertMentions (state, messages) {
|
||||||
|
state.mentions = state.mentions.concat(messages)
|
||||||
|
},
|
||||||
|
archiveMentions (state) {
|
||||||
|
state.mentions = state.mentions.slice(0, 40)
|
||||||
|
},
|
||||||
|
clearMentions (state) {
|
||||||
|
state.mentions = []
|
||||||
|
state.unreadMentions = []
|
||||||
|
},
|
||||||
|
updateToot (state, message) {
|
||||||
|
state.mentions = state.mentions.map((mention) => {
|
||||||
|
if (mention.type === 'mention' && mention.status.id === message.id) {
|
||||||
|
const status = {
|
||||||
|
status: message
|
||||||
|
}
|
||||||
|
return Object.assign(mention, status)
|
||||||
|
} else {
|
||||||
|
return mention
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changeFilter (state, filter) {
|
||||||
|
state.filter = filter
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
fetchMentions ({ state, commit, rootState }) {
|
||||||
|
const client = new Mastodon(
|
||||||
|
rootState.TimelineSpace.account.accessToken,
|
||||||
|
rootState.TimelineSpace.account.baseURL + '/api/v1'
|
||||||
|
)
|
||||||
|
return client.get('/notifications', { limit: 30, exclude_types: ['follow', 'favourite', 'reblog'] })
|
||||||
|
.then(res => {
|
||||||
|
commit('updateMentions', res.data)
|
||||||
|
return res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
lazyFetchMentions ({ state, commit, rootState }, last) {
|
||||||
|
if (last === undefined || last === null) {
|
||||||
|
return Promise.resolve(null)
|
||||||
|
}
|
||||||
|
if (state.lazyLoading) {
|
||||||
|
return Promise.resolve(null)
|
||||||
|
}
|
||||||
|
commit('changeLazyLoading', true)
|
||||||
|
const client = new Mastodon(
|
||||||
|
rootState.TimelineSpace.account.accessToken,
|
||||||
|
rootState.TimelineSpace.account.baseURL + '/api/v1'
|
||||||
|
)
|
||||||
|
return client.get('/notifications', { max_id: last.id, limit: 30, exclude_types: ['follow', 'favourite', 'reblog'] })
|
||||||
|
.then(res => {
|
||||||
|
commit('insertMentions', res.data)
|
||||||
|
return res.data
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
commit('changeLazyLoading', false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
mentions (state) {
|
||||||
|
return state.mentions.filter(mention => mention.type === 'mention')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Mentions
|
@ -6,6 +6,7 @@ const SideMenu = {
|
|||||||
state: {
|
state: {
|
||||||
unreadHomeTimeline: false,
|
unreadHomeTimeline: false,
|
||||||
unreadNotifications: false,
|
unreadNotifications: false,
|
||||||
|
unreadMentions: false,
|
||||||
unreadLocalTimeline: false,
|
unreadLocalTimeline: false,
|
||||||
unreadDirectMessagesTimeline: false,
|
unreadDirectMessagesTimeline: false,
|
||||||
unreadPublicTimeline: false,
|
unreadPublicTimeline: false,
|
||||||
@ -20,6 +21,9 @@ const SideMenu = {
|
|||||||
changeUnreadNotifications (state, value) {
|
changeUnreadNotifications (state, value) {
|
||||||
state.unreadNotifications = value
|
state.unreadNotifications = value
|
||||||
},
|
},
|
||||||
|
changeUnreadMentions (state, value) {
|
||||||
|
state.unreadMentions = value
|
||||||
|
},
|
||||||
changeUnreadLocalTimeline (state, value) {
|
changeUnreadLocalTimeline (state, value) {
|
||||||
state.unreadLocalTimeline = value
|
state.unreadLocalTimeline = value
|
||||||
},
|
},
|
||||||
@ -55,6 +59,7 @@ const SideMenu = {
|
|||||||
clearUnread ({ commit }) {
|
clearUnread ({ commit }) {
|
||||||
commit('changeUnreadHomeTimeline', false)
|
commit('changeUnreadHomeTimeline', false)
|
||||||
commit('changeUnreadNotifications', false)
|
commit('changeUnreadNotifications', false)
|
||||||
|
commit('changeUnreadMentions', false)
|
||||||
commit('changeUnreadLocalTimeline', false)
|
commit('changeUnreadLocalTimeline', false)
|
||||||
commit('changeUnreadDirectMessagesTimeline', false)
|
commit('changeUnreadDirectMessagesTimeline', false)
|
||||||
commit('changeUnreadPublicTimeline', false)
|
commit('changeUnreadPublicTimeline', false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user