diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/config.js | 7 | ||||
| -rw-r--r-- | src/modules/statuses.js | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/modules/config.js b/src/modules/config.js index 4365d554..8d850f2a 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -13,11 +13,14 @@ const config = { } }, actions: { - setOption ({ commit }, { name, value }) { + setPageTitle ({state}, option = '') { + document.title = `${state.name} ${option}` + }, + setOption ({ commit, dispatch }, { name, value }) { commit('setOption', {name, value}) switch (name) { case 'name': - document.title = value + dispatch('setPageTitle') break case 'theme': const fullPath = `/static/css/${value}` diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 871172b5..491d0024 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -173,7 +173,10 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us } const addNotification = ({type, status, action}) => { - state.notifications.push({type, status, action}) + // Only add a new notification if we don't have one for the same action + if (!find(state.notifications, (oldNotification) => oldNotification.action.id === action.id)) { + state.notifications.push({type, status, action, seen: false}) + } } const favoriteStatus = (favorite) => { @@ -276,6 +279,11 @@ export const mutations = { setNsfw (state, { id, nsfw }) { const newStatus = find(state.allStatuses, { id }) newStatus.nsfw = nsfw + }, + markNotificationsAsSeen (state, notifications) { + each(notifications, (notification) => { + notification.seen = true + }) } } |
