forked from AkkomaGang/akkoma-fe
#436: remove clear & dismiss UI updates
This commit is contained in:
parent
06fda27511
commit
52326e6551
9 changed files with 4 additions and 82 deletions
|
@ -21,9 +21,6 @@ const Notification = {
|
||||||
},
|
},
|
||||||
userProfileLink (user) {
|
userProfileLink (user) {
|
||||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||||
},
|
|
||||||
dismiss () {
|
|
||||||
this.$store.dispatch('dismissNotifications', { id: this.notification.id })
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
v-if="notification.type === 'mention'"
|
v-if="notification.type === 'mention'"
|
||||||
:compact="true"
|
:compact="true"
|
||||||
:statusoid="notification.status"
|
:statusoid="notification.status"
|
||||||
isNotification="true"
|
|
||||||
@dismissNotification="dismiss"
|
|
||||||
>
|
>
|
||||||
</status>
|
</status>
|
||||||
<div class="non-mention" :class="[userClass, { highlighted: userStyle }]" :style="[ userStyle ]"v-else>
|
<div class="non-mention" :class="[userClass, { highlighted: userStyle }]" :style="[ userStyle ]"v-else>
|
||||||
|
@ -40,9 +38,6 @@
|
||||||
<timeago :since="notification.action.created_at" :auto-update="240"></timeago>
|
<timeago :since="notification.action.created_at" :auto-update="240"></timeago>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<span class="button-icon" @click.prevent="dismiss">
|
|
||||||
<i class="button-icon icon-cancel delete-status"></i>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
<div class="follow-text" v-if="notification.type === 'follow'">
|
<div class="follow-text" v-if="notification.type === 'follow'">
|
||||||
<router-link :to="userProfileLink(notification.action.user)">
|
<router-link :to="userProfileLink(notification.action.user)">
|
||||||
|
|
|
@ -55,9 +55,6 @@ const Notifications = {
|
||||||
markAsSeen () {
|
markAsSeen () {
|
||||||
this.$store.dispatch('markNotificationsAsSeen')
|
this.$store.dispatch('markNotificationsAsSeen')
|
||||||
},
|
},
|
||||||
clear () {
|
|
||||||
this.$store.dispatch('clearNotifications')
|
|
||||||
},
|
|
||||||
fetchOlderNotifications () {
|
fetchOlderNotifications () {
|
||||||
const store = this.$store
|
const store = this.$store
|
||||||
const credentials = store.state.users.currentUser.credentials
|
const credentials = store.state.users.currentUser.credentials
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
<div @click.prevent class="loadmore-error alert error" v-if="error">
|
<div @click.prevent class="loadmore-error alert error" v-if="error">
|
||||||
{{$t('timeline.error_fetching')}}
|
{{$t('timeline.error_fetching')}}
|
||||||
</div>
|
</div>
|
||||||
<!-- <button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button> -->
|
<button v-if="unseenCount" @click.prevent="markAsSeen" class="read-button">{{$t('notifications.read')}}</button>
|
||||||
<button v-if="notifications.length" @click.prevent="clear" class="read-button">{{$t('notifications.clear')}}</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div v-for="notification in visibleNotifications" :key="notification.action.id + notification.id" class="notification" :class='{"unseen": !notification.seen}'>
|
<div v-for="notification in visibleNotifications" :key="notification.action.id + notification.id" class="notification" :class='{"unseen": !notification.seen}'>
|
||||||
|
|
|
@ -25,8 +25,7 @@ const Status = {
|
||||||
'replies',
|
'replies',
|
||||||
'isPreview',
|
'isPreview',
|
||||||
'noHeading',
|
'noHeading',
|
||||||
'inlineExpanded',
|
'inlineExpanded'
|
||||||
'isNotification'
|
|
||||||
],
|
],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -366,9 +365,6 @@ const Status = {
|
||||||
setMedia () {
|
setMedia () {
|
||||||
const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments
|
const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments
|
||||||
return () => this.$store.dispatch('setMedia', attachments)
|
return () => this.$store.dispatch('setMedia', attachments)
|
||||||
},
|
|
||||||
dismissNotification () {
|
|
||||||
this.$emit('dismissNotification')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
@ -52,9 +52,6 @@
|
||||||
<a :href="status.external_url" target="_blank" v-if="!status.is_local && !isPreview" class="source_url" title="Source">
|
<a :href="status.external_url" target="_blank" v-if="!status.is_local && !isPreview" class="source_url" title="Source">
|
||||||
<i class="button-icon icon-link-ext-alt"></i>
|
<i class="button-icon icon-link-ext-alt"></i>
|
||||||
</a>
|
</a>
|
||||||
<span class="button-icon" v-if="isNotification" @click.prevent="dismissNotification">
|
|
||||||
<i class="button-icon icon-cancel delete-status"></i>
|
|
||||||
</span>
|
|
||||||
<template v-if="expandable && !isPreview">
|
<template v-if="expandable && !isPreview">
|
||||||
<a href="#" @click.prevent="toggleExpanded" title="Expand">
|
<a href="#" @click.prevent="toggleExpanded" title="Expand">
|
||||||
<i class="button-icon icon-plus-squared"></i>
|
<i class="button-icon icon-plus-squared"></i>
|
||||||
|
|
|
@ -62,8 +62,6 @@
|
||||||
"load_older": "Load older notifications",
|
"load_older": "Load older notifications",
|
||||||
"notifications": "Notifications",
|
"notifications": "Notifications",
|
||||||
"read": "Read!",
|
"read": "Read!",
|
||||||
"clear": "Clear!",
|
|
||||||
"dismiss": "Dismiss!",
|
|
||||||
"repeated_you": "repeated your status",
|
"repeated_you": "repeated your status",
|
||||||
"no_more_notifications": "No more notifications"
|
"no_more_notifications": "No more notifications"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { remove, slice, each, find, findIndex, maxBy, minBy, merge, first, last, isArray } from 'lodash'
|
import { remove, slice, each, find, maxBy, minBy, merge, first, last, isArray } from 'lodash'
|
||||||
import apiService from '../services/api/api.service.js'
|
import apiService from '../services/api/api.service.js'
|
||||||
// import parse from '../services/status_parser/status_parser.js'
|
// import parse from '../services/status_parser/status_parser.js'
|
||||||
|
|
||||||
|
@ -390,27 +390,6 @@ export const mutations = {
|
||||||
notification.seen = true
|
notification.seen = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
clearNotifications (state) {
|
|
||||||
state.notifications.data = []
|
|
||||||
state.notifications.idStore = {}
|
|
||||||
state.notifications.maxId = 0
|
|
||||||
state.notifications.minId = 0
|
|
||||||
},
|
|
||||||
dismissNotifications (state, { id }) {
|
|
||||||
const { data } = state.notifications
|
|
||||||
const idx = findIndex(data, { id })
|
|
||||||
|
|
||||||
if (idx !== -1) {
|
|
||||||
const notification = data[idx]
|
|
||||||
data.splice(idx, 1)
|
|
||||||
delete state.notifications.idStore[id]
|
|
||||||
if (state.notifications.maxId === notification.id) {
|
|
||||||
state.notifications.maxId = data.length ? maxBy(data, 'id').id : 0
|
|
||||||
} else if (state.notifications.minId === notification.id) {
|
|
||||||
state.notifications.minId = data.length ? minBy(data, 'id').id : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
queueFlush (state, { timeline, id }) {
|
queueFlush (state, { timeline, id }) {
|
||||||
state.timelines[timeline].flushMarker = id
|
state.timelines[timeline].flushMarker = id
|
||||||
}
|
}
|
||||||
|
@ -495,19 +474,6 @@ const statuses = {
|
||||||
id: rootState.statuses.notifications.maxId,
|
id: rootState.statuses.notifications.maxId,
|
||||||
credentials: rootState.users.currentUser.credentials
|
credentials: rootState.users.currentUser.credentials
|
||||||
})
|
})
|
||||||
},
|
|
||||||
clearNotifications ({ rootState, commit }) {
|
|
||||||
commit('clearNotifications')
|
|
||||||
apiService.clearNotifications({
|
|
||||||
credentials: rootState.users.currentUser.credentials
|
|
||||||
})
|
|
||||||
},
|
|
||||||
dismissNotifications ({ rootState, commit }, { id }) {
|
|
||||||
commit('dismissNotifications', { id })
|
|
||||||
apiService.dismissNotifications({
|
|
||||||
id,
|
|
||||||
credentials: rootState.users.currentUser.credentials
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations
|
mutations
|
||||||
|
|
|
@ -43,8 +43,6 @@ const SUGGESTIONS_URL = '/api/v1/suggestions'
|
||||||
|
|
||||||
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
||||||
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
|
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
|
||||||
const MASTODON_USER_NOTIFICATIONS_CLEAR_URL = '/api/v1/notifications/clear'
|
|
||||||
const MASTODON_USER_NOTIFICATIONS_DISMISS_URL = '/api/v1/notifications/dismiss'
|
|
||||||
|
|
||||||
import { each, map } from 'lodash'
|
import { each, map } from 'lodash'
|
||||||
import { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js'
|
import { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js'
|
||||||
|
@ -577,25 +575,6 @@ const markNotificationsAsSeen = ({id, credentials}) => {
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearNotifications = ({ credentials }) => {
|
|
||||||
return fetch(MASTODON_USER_NOTIFICATIONS_CLEAR_URL, {
|
|
||||||
headers: authHeaders(credentials),
|
|
||||||
method: 'POST'
|
|
||||||
}).then((data) => data.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
const dismissNotifications = ({ id, credentials }) => {
|
|
||||||
const body = new FormData()
|
|
||||||
|
|
||||||
body.append('id', id)
|
|
||||||
|
|
||||||
return fetch(MASTODON_USER_NOTIFICATIONS_DISMISS_URL, {
|
|
||||||
body,
|
|
||||||
headers: authHeaders(credentials),
|
|
||||||
method: 'POST'
|
|
||||||
}).then((data) => data.json())
|
|
||||||
}
|
|
||||||
|
|
||||||
const apiService = {
|
const apiService = {
|
||||||
verifyCredentials,
|
verifyCredentials,
|
||||||
fetchTimeline,
|
fetchTimeline,
|
||||||
|
@ -636,9 +615,7 @@ const apiService = {
|
||||||
approveUser,
|
approveUser,
|
||||||
denyUser,
|
denyUser,
|
||||||
suggestions,
|
suggestions,
|
||||||
markNotificationsAsSeen,
|
markNotificationsAsSeen
|
||||||
clearNotifications,
|
|
||||||
dismissNotifications
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default apiService
|
export default apiService
|
||||||
|
|
Loading…
Reference in a new issue