From cd9a7dd48802fff8942ae607a23677cfb43a7b14 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 12 Mar 2019 17:16:57 -0400 Subject: #436: integrate mastoAPI notifications --- src/services/api/api.service.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/services/api/api.service.js') diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 2de87026..9d3139ce 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -29,7 +29,6 @@ const BANNER_UPDATE_URL = '/api/account/update_profile_banner.json' const PROFILE_UPDATE_URL = '/api/account/update_profile.json' const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json' const QVITTER_USER_TIMELINE_URL = '/api/qvitter/statuses/user_timeline.json' -const QVITTER_USER_NOTIFICATIONS_URL = '/api/qvitter/statuses/notifications.json' const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json' const BLOCKING_URL = '/api/blocks/create.json' const UNBLOCKING_URL = '/api/blocks/destroy.json' @@ -43,6 +42,9 @@ const DENY_USER_URL = '/api/pleroma/friendships/deny' const SUGGESTIONS_URL = '/api/v1/suggestions' const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites' +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 { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js' @@ -345,7 +347,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use friends: FRIENDS_TIMELINE_URL, mentions: MENTIONS_URL, dms: DM_TIMELINE_URL, - notifications: QVITTER_USER_NOTIFICATIONS_URL, + notifications: MASTODON_USER_NOTIFICATIONS_URL, 'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL, user: QVITTER_USER_TIMELINE_URL, media: QVITTER_USER_TIMELINE_URL, @@ -575,6 +577,25 @@ const markNotificationsAsSeen = ({id, credentials}) => { }).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 = { verifyCredentials, fetchTimeline, @@ -615,7 +636,9 @@ const apiService = { approveUser, denyUser, suggestions, - markNotificationsAsSeen + markNotificationsAsSeen, + clearNotifications, + dismissNotifications } export default apiService -- cgit v1.2.3-70-g09d2 From 52326e65515317be4815aaef320965313f84d64b Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 14 Mar 2019 11:57:24 -0400 Subject: #436: remove clear & dismiss UI updates --- src/components/notification/notification.js | 3 --- src/components/notification/notification.vue | 5 ---- src/components/notifications/notifications.js | 3 --- src/components/notifications/notifications.vue | 3 +-- src/components/status/status.js | 6 +---- src/components/status/status.vue | 3 --- src/i18n/en.json | 2 -- src/modules/statuses.js | 36 +------------------------- src/services/api/api.service.js | 25 +----------------- 9 files changed, 4 insertions(+), 82 deletions(-) (limited to 'src/services/api/api.service.js') diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index c86f22bb..fe5b7018 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -21,9 +21,6 @@ const Notification = { }, userProfileLink (user) { return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) - }, - dismiss () { - this.$store.dispatch('dismissNotifications', { id: this.notification.id }) } }, computed: { diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 6e8e9844..fa931fb6 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -3,8 +3,6 @@ v-if="notification.type === 'mention'" :compact="true" :statusoid="notification.status" - isNotification="true" - @dismissNotification="dismiss" >
@@ -40,9 +38,6 @@
- - -
diff --git a/src/components/status/status.js b/src/components/status/status.js index 4cd26be3..9e18fe15 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -25,8 +25,7 @@ const Status = { 'replies', 'isPreview', 'noHeading', - 'inlineExpanded', - 'isNotification' + 'inlineExpanded' ], data () { return { @@ -366,9 +365,6 @@ const Status = { setMedia () { const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments return () => this.$store.dispatch('setMedia', attachments) - }, - dismissNotification () { - this.$emit('dismissNotification') } }, watch: { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 28a44346..1f6d0325 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -52,9 +52,6 @@ - - -