From 6b6878bde06b375b1e715a3557f153acc73a8af0 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Mon, 18 Feb 2019 17:49:32 +0300 Subject: Added moderation menu --- .../backend_interactor_service.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/services/backend_interactor_service') diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 71e78d2f..badcbb06 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -62,6 +62,30 @@ const backendInteractorService = (credentials) => { return timelineFetcherService.startFetching({timeline, store, credentials, userId, tag}) } + const tagUser = ({screen_name}, tag) => { + return apiService.tagUser({screen_name, tag, credentials}) + } + + const untagUser = ({screen_name}, tag) => { + return apiService.untagUser({screen_name, tag, credentials}) + } + + const addRight = ({screen_name}, right) => { + return apiService.addRight({screen_name, right, credentials}) + } + + const deleteRight = ({screen_name}, right) => { + return apiService.deleteRight({screen_name, right, credentials}) + } + + const setActivationStatus = ({screen_name}, status) => { + return apiService.setActivationStatus({screen_name, status, credentials}) + } + + const deleteUser = ({screen_name}) => { + return apiService.deleteUser({screen_name, credentials}) + } + const fetchMutes = () => apiService.fetchMutes({credentials}) const muteUser = (id) => apiService.muteUser({credentials, id}) const unmuteUser = (id) => apiService.unmuteUser({credentials, id}) @@ -104,6 +128,12 @@ const backendInteractorService = (credentials) => { fetchBlocks, fetchOAuthTokens, revokeOAuthToken, + tagUser, + untagUser, + addRight, + deleteRight, + deleteUser, + setActivationStatus, register, getCaptcha, updateAvatar, -- cgit v1.2.3-70-g09d2 From ea27483f2728b5c2f1dd57228b8bf1ab9ae223ff Mon Sep 17 00:00:00 2001 From: jasper Date: Wed, 3 Apr 2019 09:04:46 -0700 Subject: Fix notification bugs --- src/components/notifications/notifications.js | 7 ---- src/modules/statuses.js | 43 ++++++++++++---------- src/modules/users.js | 6 ++- .../backend_interactor_service.js | 2 + 4 files changed, 31 insertions(+), 27 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index d3db4b29..d9ce7604 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -10,13 +10,6 @@ const Notifications = { props: [ 'noHeading' ], - created () { - const store = this.$store - const credentials = store.state.users.currentUser.credentials - - const fetcherId = notificationsFetcher.startFetching({ store, credentials }) - this.$store.commit('setNotificationFetcher', { fetcherId }) - }, data () { return { bottomedOut: false diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 8e0203e3..660d5c26 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -20,20 +20,22 @@ const emptyTl = (userId = 0) => ({ flushMarker: 0 }) +const emptyNotifications = () => ({ + desktopNotificationSilence: true, + maxId: 0, + minId: Number.POSITIVE_INFINITY, + data: [], + idStore: {}, + loading: false, + error: false, + fetcherId: null +}) + export const defaultState = () => ({ allStatuses: [], allStatusesObject: {}, maxId: 0, - notifications: { - desktopNotificationSilence: true, - maxId: 0, - minId: Number.POSITIVE_INFINITY, - data: [], - idStore: {}, - loading: false, - error: false, - fetcherId: null - }, + notifications: emptyNotifications(), favorites: new Set(), error: false, timelines: { @@ -340,9 +342,9 @@ export const mutations = { oldTimeline.visibleStatusesObject = {} each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status }) }, - setNotificationFetcher (state, { fetcherId }) { - state.notifications.fetcherId = fetcherId - }, + // setNotificationFetcher (state, { fetcherId }) { + // state.notifications.fetcherId = fetcherId + // }, resetStatuses (state) { const emptyState = defaultState() Object.entries(emptyState).forEach(([key, value]) => { @@ -352,6 +354,9 @@ export const mutations = { clearTimeline (state, { timeline }) { state.timelines[timeline] = emptyTl(state.timelines[timeline].userId) }, + clearNotifications (state) { + state.notifications = emptyNotifications() + }, setFavorited (state, { status, value }) { const newStatus = state.allStatusesObject[status.id] newStatus.favorited = value @@ -428,12 +433,12 @@ const statuses = { setNotificationsSilence ({ rootState, commit }, { value }) { commit('setNotificationsSilence', { value }) }, - stopFetchingNotifications ({ rootState, commit }) { - if (rootState.statuses.notifications.fetcherId) { - window.clearInterval(rootState.statuses.notifications.fetcherId) - } - commit('setNotificationFetcher', { fetcherId: null }) - }, + // stopFetchingNotifications ({ rootState, commit }) { + // if (rootState.statuses.notifications.fetcherId) { + // window.clearInterval(rootState.statuses.notifications.fetcherId) + // } + // commit('setNotificationFetcher', { fetcherId: null }) + // }, deleteStatus ({ rootState, commit }, status) { commit('setDeleted', { status }) apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials }) diff --git a/src/modules/users.js b/src/modules/users.js index 1a507d31..3cfae1fc 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -331,7 +331,8 @@ const users = { store.commit('setToken', false) store.dispatch('stopFetching', 'friends') store.commit('setBackendInteractor', backendInteractorService()) - store.dispatch('stopFetchingNotifications') + store.dispatch('stopFetching', 'notifications') + store.commit('clearNotifications') store.commit('resetStatuses') }, loginUser (store, accessToken) { @@ -365,6 +366,9 @@ const users = { // Start getting fresh posts. store.dispatch('startFetching', { timeline: 'friends' }) + // Start fetching notifications + store.dispatch('startFetching', { timeline: 'notifications' }) + // Get user mutes store.dispatch('fetchMutes') diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 71e78d2f..f28686f8 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -1,5 +1,6 @@ import apiService from '../api/api.service.js' import timelineFetcherService from '../timeline_fetcher/timeline_fetcher.service.js' +import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js' const backendInteractorService = (credentials) => { const fetchStatus = ({id}) => { @@ -59,6 +60,7 @@ const backendInteractorService = (credentials) => { } const startFetching = ({timeline, store, userId = false, tag}) => { + if (timeline === 'notifications') { return notificationsFetcher.startFetching({store, credentials}) } return timelineFetcherService.startFetching({timeline, store, credentials, userId, tag}) } -- cgit v1.2.3-70-g09d2 From a1275be4c0c83dc848e402bb631990d0cb27bb8c Mon Sep 17 00:00:00 2001 From: jasper Date: Thu, 4 Apr 2019 09:03:56 -0700 Subject: Separate timeline and notification --- .../public_and_external_timeline.js | 2 +- src/components/public_timeline/public_timeline.js | 2 +- src/components/tag_timeline/tag_timeline.js | 4 ++-- src/components/user_profile/user_profile.js | 6 ++--- src/modules/api.js | 27 ++++++++++++++-------- src/modules/users.js | 4 ++-- .../backend_interactor_service.js | 12 ++++++---- 7 files changed, 34 insertions(+), 23 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/public_and_external_timeline/public_and_external_timeline.js b/src/components/public_and_external_timeline/public_and_external_timeline.js index d45677e0..f614c13b 100644 --- a/src/components/public_and_external_timeline/public_and_external_timeline.js +++ b/src/components/public_and_external_timeline/public_and_external_timeline.js @@ -7,7 +7,7 @@ const PublicAndExternalTimeline = { timeline () { return this.$store.state.statuses.timelines.publicAndExternal } }, created () { - this.$store.dispatch('startFetching', { timeline: 'publicAndExternal' }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'publicAndExternal' }) }, destroyed () { this.$store.dispatch('stopFetching', 'publicAndExternal') diff --git a/src/components/public_timeline/public_timeline.js b/src/components/public_timeline/public_timeline.js index 64c951ac..8976a99c 100644 --- a/src/components/public_timeline/public_timeline.js +++ b/src/components/public_timeline/public_timeline.js @@ -7,7 +7,7 @@ const PublicTimeline = { timeline () { return this.$store.state.statuses.timelines.public } }, created () { - this.$store.dispatch('startFetching', { timeline: 'public' }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'public' }) }, destroyed () { this.$store.dispatch('stopFetching', 'public') diff --git a/src/components/tag_timeline/tag_timeline.js b/src/components/tag_timeline/tag_timeline.js index 41b09706..458eb1c5 100644 --- a/src/components/tag_timeline/tag_timeline.js +++ b/src/components/tag_timeline/tag_timeline.js @@ -3,7 +3,7 @@ import Timeline from '../timeline/timeline.vue' const TagTimeline = { created () { this.$store.commit('clearTimeline', { timeline: 'tag' }) - this.$store.dispatch('startFetching', { timeline: 'tag', tag: this.tag }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'tag', tag: this.tag }) }, components: { Timeline @@ -15,7 +15,7 @@ const TagTimeline = { watch: { tag () { this.$store.commit('clearTimeline', { timeline: 'tag' }) - this.$store.dispatch('startFetching', { timeline: 'tag', tag: this.tag }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'tag', tag: this.tag }) } }, destroyed () { diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 1df06fe6..bac729c0 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -90,7 +90,7 @@ const UserProfile = { methods: { startFetchFavorites () { if (this.isUs) { - this.$store.dispatch('startFetching', { timeline: 'favorites', userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'favorites', userId: this.userId }) } }, fetchUserId () { @@ -118,8 +118,8 @@ const UserProfile = { }, startUp () { if (this.userId) { - this.$store.dispatch('startFetching', { timeline: 'user', userId: this.userId }) - this.$store.dispatch('startFetching', { timeline: 'media', userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'user', userId: this.userId }) + this.$store.dispatch('startFetchingTimeline', { timeline: 'media', userId: this.userId }) this.startFetchFavorites() } }, diff --git a/src/modules/api.js b/src/modules/api.js index 31cb55c6..6242dfa1 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -13,11 +13,11 @@ const api = { setBackendInteractor (state, backendInteractor) { state.backendInteractor = backendInteractor }, - addFetcher (state, {timeline, fetcher}) { - state.fetchers[timeline] = fetcher + addFetcher (state, {fetcherName, fetcher}) { + state.fetchers[fetcherName] = fetcher }, - removeFetcher (state, {timeline}) { - delete state.fetchers[timeline] + removeFetcher (state, { fetcherName }) { + delete state.fetchers[fetcherName] }, setWsToken (state, token) { state.wsToken = token @@ -33,17 +33,24 @@ const api = { } }, actions: { - startFetching (store, {timeline = 'friends', tag = false, userId = false}) { + startFetchingTimeline (store, {timeline = 'friends', tag = false, userId = false}) { // Don't start fetching if we already are. if (store.state.fetchers[timeline]) return - const fetcher = store.state.backendInteractor.startFetching({ timeline, store, userId, tag }) - store.commit('addFetcher', { timeline, fetcher }) + const fetcher = store.state.backendInteractor.startFetchingTimeline({ timeline, store, userId, tag }) + store.commit('addFetcher', { fetcherName: timeline, fetcher }) }, - stopFetching (store, timeline) { - const fetcher = store.state.fetchers[timeline] + startFetchingNotifications (store) { + // Don't start fetching if we already are. + if (store.state.fetchers['notifications']) return + + const fetcher = store.state.backendInteractor.startFetchingNotifications({ store }) + store.commit('addFetcher', { fetcherName: 'notifications', fetcher }) + }, + stopFetching (store, fetcherName) { + const fetcher = store.state.fetchers[fetcherName] window.clearInterval(fetcher) - store.commit('removeFetcher', {timeline}) + store.commit('removeFetcher', { fetcherName }) }, setWsToken (store, token) { store.commit('setWsToken', token) diff --git a/src/modules/users.js b/src/modules/users.js index 3cfae1fc..b0c7f2f6 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -364,10 +364,10 @@ const users = { } // Start getting fresh posts. - store.dispatch('startFetching', { timeline: 'friends' }) + store.dispatch('startFetchingTimeline', { timeline: 'friends' }) // Start fetching notifications - store.dispatch('startFetching', { timeline: 'notifications' }) + store.dispatch('startFetchingNotifications') // Get user mutes store.dispatch('fetchMutes') diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index f28686f8..7dd139c6 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -59,9 +59,12 @@ const backendInteractorService = (credentials) => { return apiService.denyUser({credentials, id}) } - const startFetching = ({timeline, store, userId = false, tag}) => { - if (timeline === 'notifications') { return notificationsFetcher.startFetching({store, credentials}) } - return timelineFetcherService.startFetching({timeline, store, credentials, userId, tag}) + const startFetchingTimeline = ({ timeline, store, userId = false, tag }) => { + return timelineFetcherService.startFetching({ timeline, store, credentials, userId, tag }) + } + + const startFetchingNotifications = ({ store }) => { + return notificationsFetcher.startFetching({ store, credentials }) } const fetchMutes = () => apiService.fetchMutes({credentials}) @@ -99,7 +102,8 @@ const backendInteractorService = (credentials) => { fetchUserRelationship, fetchAllFollowing, verifyCredentials: apiService.verifyCredentials, - startFetching, + startFetchingTimeline, + startFetchingNotifications, fetchMutes, muteUser, unmuteUser, -- cgit v1.2.3-70-g09d2 From 2d339cd3b8b3ffc1509c954f68636d8ed4d37253 Mon Sep 17 00:00:00 2001 From: Brenden Bice Date: Mon, 1 Apr 2019 22:29:45 -0400 Subject: fetch favorited users --- src/components/conversation/conversation.js | 12 ++++++++++ src/components/status/status.js | 8 ++++++- src/modules/statuses.js | 11 +++++++++ src/services/api/api.service.js | 27 ++++++++++++++++++++++ .../backend_interactor_service.js | 4 +++- 5 files changed, 60 insertions(+), 2 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 30600f73..b3335f64 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -120,6 +120,8 @@ const conversation = { if (this.status) { this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id}) .then(({ancestors, descendants}) => { + const ancestorId = ancestors.length ? ancestors[0].id : this.status.id + this.fetchFavouritedByUsers(ancestorId) this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) }) @@ -148,6 +150,16 @@ const conversation = { if (!this.expanded) { this.setHighlight(null) } + }, + fetchFavouritedByUsers (id) { + this.$store.state.api.backendInteractor.fetchFavouritedByUsers({id: this.status.id}).then((response) => { + const favoritedByUsers = response.map(item => ({ + src: item.avatar_static, + name: item.display_name + })) + this.$store.dispatch('addFavoritedByUsers', { favoritedByUsers, id }) + }) + }, } } } diff --git a/src/components/status/status.js b/src/components/status/status.js index 0295cd04..e470eaeb 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -7,6 +7,7 @@ import UserCard from '../user_card/user_card.vue' import UserAvatar from '../user_avatar/user_avatar.vue' import Gallery from '../gallery/gallery.vue' import LinkPreview from '../link-preview/link-preview.vue' +import AvatarList from '../avatar_list/avatar_list.vue' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import fileType from 'src/services/file_type/file_type.service' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' @@ -257,6 +258,10 @@ const Status = { return this.status.statusnet_html } return this.status.summary_html + '
' + this.status.statusnet_html + }, + favouritedByUsers () { + return this.statusoid.favoritedBy ? this.statusoid.favoritedBy : [] + }, } }, components: { @@ -268,7 +273,8 @@ const Status = { UserCard, UserAvatar, Gallery, - LinkPreview + LinkPreview, + AvatarList }, methods: { visibilityIcon (visibility) { diff --git a/src/modules/statuses.js b/src/modules/statuses.js index e70c2400..8d2eb424 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -459,6 +459,13 @@ export const mutations = { }, queueFlush (state, { timeline, id }) { state.timelines[timeline].flushMarker = id + }, + addFavoritedByUsers (state, { favoritedByUsers, id }) { + state.allStatusesObject[id] = { + ...state.allStatusesObject[id], + favoritedBy: favoritedByUsers + } + }, } } @@ -524,6 +531,10 @@ const statuses = { id: rootState.statuses.notifications.maxId, credentials: rootState.users.currentUser.credentials }) + }, + addFavoritedByUsers ({ rootState, commit }, { favoritedByUsers, id }) { + commit('addFavoritedByUsers', { favoritedByUsers, id }) + }, } }, mutations diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 2dd52cb5..45eec566 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -49,6 +49,7 @@ const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute` const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute` const MASTODON_POST_STATUS_URL = '/api/v1/statuses' const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' +const MASTODON_STATUS_FAVOURITEDBY_URL = id => `/api/v1/statuses/${id}/favourited_by` import { each, map } from 'lodash' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' @@ -722,6 +723,32 @@ const markNotificationsAsSeen = ({id, credentials}) => { }).then((data) => data.json()) } +const fetchFavouritedByUsers = ({id}) => { + return fetch(MASTODON_STATUS_FAVOURITEDBY_URL(id), { + method: 'GET' + }) + .then(response => { + if (response.ok) { + return response.json() + } else { + throw new Error('Error fetching favorited by users') + } + }) +} + +const fetchRebloggedByUsers = ({id}) => { + return fetch(MASTODON_STATUS_REBLOGGEDBY_URL(id), { + method: 'GET' + }) + .then(response => { + if (response.ok) { + return response.json() + } else { + throw new Error('Error reblogged by users') + } + }) +} + const apiService = { verifyCredentials, fetchTimeline, diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 75bba92b..5faec9af 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -112,6 +112,7 @@ const backendInteractorService = (credentials) => { const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) + const fetchFavouritedByUsers = ({id}) => apiService.fetchFavouritedByUsers({id}) const backendInteractorServiceInstance = { fetchStatus, fetchConversation, @@ -152,7 +153,8 @@ const backendInteractorService = (credentials) => { changePassword, fetchFollowRequests, approveUser, - denyUser + denyUser, + fetchFavouritedByUsers, } return backendInteractorServiceInstance -- cgit v1.2.3-70-g09d2 From 85457fc9173d64d39b1d942496cae1366a0d95ab Mon Sep 17 00:00:00 2001 From: Brenden Bice Date: Mon, 1 Apr 2019 22:30:06 -0400 Subject: fetch reblogged users --- src/components/conversation/conversation.js | 9 ++++++++ src/components/status/status.js | 2 ++ src/components/status/status.vue | 25 ++++++++++++++++++++++ src/modules/statuses.js | 7 ++++++ src/services/api/api.service.js | 5 ++++- .../backend_interactor_service.js | 3 +++ 6 files changed, 50 insertions(+), 1 deletion(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index b3335f64..24d48dd8 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -122,6 +122,7 @@ const conversation = { .then(({ancestors, descendants}) => { const ancestorId = ancestors.length ? ancestors[0].id : this.status.id this.fetchFavouritedByUsers(ancestorId) + this.fetchRebloggedByUsers(ancestorId) this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) }) @@ -160,6 +161,14 @@ const conversation = { this.$store.dispatch('addFavoritedByUsers', { favoritedByUsers, id }) }) }, + fetchRebloggedByUsers (id) { + this.$store.state.api.backendInteractor.fetchRebloggedByUsers({id: this.status.id}).then((response) => { + const rebloggedByUsers = response.map(item => ({ + src: item.avatar_static, + name: item.display_name + })) + this.$store.dispatch('addRebloggedByUsers', { rebloggedByUsers, id }) + }) } } } diff --git a/src/components/status/status.js b/src/components/status/status.js index e470eaeb..eda96373 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -262,6 +262,8 @@ const Status = { favouritedByUsers () { return this.statusoid.favoritedBy ? this.statusoid.favoritedBy : [] }, + rebloggedByUsers () { + return this.statusoid.rebloggedBy ? this.statusoid.rebloggedBy : [] } }, components: { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 690e8318..6b8e0b3d 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -142,6 +142,16 @@ +
+
+

Boosted By {{rebloggedByUsers.length}}:

+ +
+
+

Favourited By {{favouritedByUsers.length}}:

+ +
+
@@ -612,6 +622,21 @@ a.unmute { } } +.boosted-users { + display: flex; + justify-content: space-between; + margin-top: 10px; + + .favourited-users, + .reblogged-users { + flex: 1; + + .title { + margin: 0 0 10px 0; + } + } +} + @media all and (max-width: 800px) { .status-el { .retweet-info { diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 8d2eb424..c749e60f 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -466,6 +466,11 @@ export const mutations = { favoritedBy: favoritedByUsers } }, + addRebloggedByUsers (state, { rebloggedByUsers, id }) { + state.allStatusesObject[id] = { + ...state.allStatusesObject[id], + rebloggedBy: rebloggedByUsers + } } } @@ -535,6 +540,8 @@ const statuses = { addFavoritedByUsers ({ rootState, commit }, { favoritedByUsers, id }) { commit('addFavoritedByUsers', { favoritedByUsers, id }) }, + addRebloggedByUsers ({ rootState, commit }, { rebloggedByUsers, id }) { + commit('addRebloggedByUsers', { rebloggedByUsers, id }) } }, mutations diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 45eec566..120398f0 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -50,6 +50,7 @@ const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute` const MASTODON_POST_STATUS_URL = '/api/v1/statuses' const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' const MASTODON_STATUS_FAVOURITEDBY_URL = id => `/api/v1/statuses/${id}/favourited_by` +const MASTODON_STATUS_REBLOGGEDBY_URL = id => `/api/v1/statuses/${id}/reblogged_by` import { each, map } from 'lodash' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' @@ -797,7 +798,9 @@ const apiService = { approveUser, denyUser, suggestions, - markNotificationsAsSeen + markNotificationsAsSeen, + fetchFavouritedByUsers, + fetchRebloggedByUsers } export default apiService diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 5faec9af..01663a64 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -113,6 +113,8 @@ const backendInteractorService = (credentials) => { const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) const fetchFavouritedByUsers = ({id}) => apiService.fetchFavouritedByUsers({id}) + const fetchRebloggedByUsers = ({id}) => apiService.fetchRebloggedByUsers({id}) + const backendInteractorServiceInstance = { fetchStatus, fetchConversation, @@ -155,6 +157,7 @@ const backendInteractorService = (credentials) => { approveUser, denyUser, fetchFavouritedByUsers, + fetchRebloggedByUsers } return backendInteractorServiceInstance -- cgit v1.2.3-70-g09d2 From 8c9bcdc6c16f3a6dad5131b8163ee9d933b6b952 Mon Sep 17 00:00:00 2001 From: Brenden Bice Date: Tue, 2 Apr 2019 12:13:55 -0400 Subject: rename favourite to favorite --- src/components/conversation/conversation.js | 6 +++--- src/components/status/status.vue | 4 ++-- src/modules/statuses.js | 4 ++-- src/services/api/api.service.js | 8 ++++---- .../backend_interactor_service/backend_interactor_service.js | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 851d30e9..ba90746e 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -121,7 +121,7 @@ const conversation = { this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id}) .then(({ancestors, descendants}) => { const ancestorId = ancestors.length ? ancestors[0].id : this.status.id - this.fetchFavouritedByUsers(ancestorId) + this.fetchFavoritedByUsers(ancestorId) this.fetchRebloggedByUsers(ancestorId) this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) @@ -152,8 +152,8 @@ const conversation = { this.setHighlight(null) } }, - fetchFavouritedByUsers (id) { - this.$store.dispatch('fetchFavouritedByUsers', { id }) + fetchFavoritedByUsers (id) { + this.$store.dispatch('fetchFavoritedByUsers', { id }) }, fetchRebloggedByUsers (id) { this.$store.dispatch('fetchRebloggedByUsers', { id }) diff --git a/src/components/status/status.vue b/src/components/status/status.vue index ce4b2554..a8042afe 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -133,7 +133,7 @@
-
+
@@ -616,7 +616,7 @@ a.unmute { } } -.favs-favourited-users { +.favs-favorited-users { margin-top: 10px; } diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 2cfc3ff1..44213e75 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -537,8 +537,8 @@ const statuses = { credentials: rootState.users.currentUser.credentials }) }, - fetchFavouritedByUsers ({ rootState, commit }, { id }) { - rootState.api.backendInteractor.fetchFavouritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id })) + fetchFavoritedByUsers ({ rootState, commit }, { id }) { + rootState.api.backendInteractor.fetchFavoritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id })) }, fetchRebloggedByUsers ({ rootState, commit }, { id }) { rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id })) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 1f9e9a88..90309edf 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -49,7 +49,7 @@ const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute` const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute` const MASTODON_POST_STATUS_URL = '/api/v1/statuses' const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' -const MASTODON_STATUS_FAVOURITEDBY_URL = id => `/api/v1/statuses/${id}/favourited_by` +const MASTODON_STATUS_FAVORITEDBY_URL = id => `/api/v1/statuses/${id}/favourited_by` const MASTODON_STATUS_REBLOGGEDBY_URL = id => `/api/v1/statuses/${id}/reblogged_by` import { each, map } from 'lodash' @@ -724,8 +724,8 @@ const markNotificationsAsSeen = ({id, credentials}) => { }).then((data) => data.json()) } -const fetchFavouritedByUsers = ({id}) => { - return promisedRequest(MASTODON_STATUS_FAVOURITEDBY_URL(id)).then((users) => users.map(parseUser)) +const fetchFavoritedByUsers = ({id}) => { + return promisedRequest(MASTODON_STATUS_FAVORITEDBY_URL(id)).then((users) => users.map(parseUser)) } const fetchRebloggedByUsers = ({id}) => { @@ -781,7 +781,7 @@ const apiService = { denyUser, suggestions, markNotificationsAsSeen, - fetchFavouritedByUsers, + fetchFavoritedByUsers, fetchRebloggedByUsers } diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 01663a64..0768c806 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -112,7 +112,7 @@ const backendInteractorService = (credentials) => { const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) - const fetchFavouritedByUsers = ({id}) => apiService.fetchFavouritedByUsers({id}) + const fetchFavoritedByUsers = ({id}) => apiService.fetchFavoritedByUsers({id}) const fetchRebloggedByUsers = ({id}) => apiService.fetchRebloggedByUsers({id}) const backendInteractorServiceInstance = { @@ -156,7 +156,7 @@ const backendInteractorService = (credentials) => { fetchFollowRequests, approveUser, denyUser, - fetchFavouritedByUsers, + fetchFavoritedByUsers, fetchRebloggedByUsers } -- cgit v1.2.3-70-g09d2 From 8ed4eb8a7ffe0e370cfc06017d2bce34b2c9d987 Mon Sep 17 00:00:00 2001 From: Brenden Bice Date: Tue, 9 Apr 2019 11:45:33 -0400 Subject: refactor showing favs and repeats logic --- src/components/conversation/conversation.js | 6 ++-- src/components/status/status.js | 7 +++- src/components/status/status.vue | 8 ++--- src/components/timeline/timeline.vue | 3 +- src/modules/statuses.js | 39 +++++----------------- .../backend_interactor_service.js | 4 +-- 6 files changed, 23 insertions(+), 44 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 5cc7f4ee..ffeb7244 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -41,8 +41,7 @@ const conversation = { props: [ 'statusoid', 'collapsable', - 'isPage', - 'timelineName' + 'isPage' ], created () { if (this.isPage) { @@ -121,8 +120,6 @@ const conversation = { if (this.status) { this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id}) .then(({ancestors, descendants}) => { - this.$store.dispatch('fetchFavoritedByUsers', { id: this.statusId, retweetedStatusId: this.status.id, timelineName: this.timelineName }) - this.$store.dispatch('fetchRebloggedByUsers', { id: this.statusId, retweetedStatusId: this.status.id, timelineName: this.timelineName }) this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) }) @@ -142,6 +139,7 @@ const conversation = { }, setHighlight (id) { this.highlight = id + this.$store.dispatch('fetchFavsAndRepeats', id) }, getHighlight () { return this.isExpanded ? this.highlight : null diff --git a/src/components/status/status.js b/src/components/status/status.js index 44caf3af..db234ec1 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -98,6 +98,10 @@ const Status = { return this.statusoid } }, + statusFromGlobalRepository () { + // NOTE: Consider to replace status with statusFromGlobalRepository + return this.$store.state.statuses.allStatusesObject[this.status.id] + }, loggedIn () { return !!this.$store.state.users.currentUser }, @@ -260,7 +264,8 @@ const Status = { return this.status.summary_html + '
' + this.status.statusnet_html }, combinedFavsAndRepeatsAvatars () { - const combinedAvatars = [].concat(this.statusoid.favoritedBy, this.statusoid.rebloggedBy).filter(_ => _) + // Use the status from the global status repository since favs and repeats are saved in it + const combinedAvatars = [].concat(this.statusFromGlobalRepository.favoritedBy, this.statusFromGlobalRepository.rebloggedBy).filter(_ => _) return uniqBy(combinedAvatars, 'id') } }, diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 34bb64d0..b0882964 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -136,13 +136,13 @@
    -
  • +
  • {{ $t('settings.notification_visibility_repeats') }} -
    {{ statusoid.rebloggedBy.length }}
    +
    {{ statusFromGlobalRepository.rebloggedBy.length }}
  • -
  • +
  • {{ $t('user_card.favorites') }} -
    {{ statusoid.favoritedBy.length }}
    +
    {{ statusFromGlobalRepository.favoritedBy.length }}
  • diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 147e8a1d..e6a8d458 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -16,13 +16,12 @@
-
diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 023f132e..527cafc2 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -460,32 +460,11 @@ export const mutations = { queueFlush (state, { timeline, id }) { state.timelines[timeline].flushMarker = id }, - addFavoritedByUsers (state, { favoritedByUsers, id, timelineName }) { - if (timelineName) { - state.timelines[timelineName].visibleStatusesObject[id] = { - ...state.timelines[timelineName].visibleStatusesObject[id], - favoritedBy: favoritedByUsers - } - state.timelines[timelineName].visibleStatuses = state.timelines[timelineName].visibleStatuses.map(visibleStatus => visibleStatus.id === id ? { ...visibleStatus, favoritedBy: favoritedByUsers } : visibleStatus) - } else { - state.allStatusesObject[id] = { - ...state.allStatusesObject[id], - favoritedBy: favoritedByUsers - } - } - }, - addRebloggedByUsers (state, { rebloggedByUsers, id, timelineName }) { - if (timelineName) { - state.timelines[timelineName].visibleStatusesObject[id] = { - ...state.timelines[timelineName].visibleStatusesObject[id], - rebloggedBy: rebloggedByUsers - } - state.timelines[timelineName].visibleStatuses = state.timelines[timelineName].visibleStatuses.map(visibleStatus => visibleStatus.id === id ? { ...visibleStatus, rebloggedBy: rebloggedByUsers } : visibleStatus) - } else { - state.allStatusesObject[id] = { - ...state.allStatusesObject[id], - rebloggedBy: rebloggedByUsers - } + addFavsAndRepeats (state, { id, favoritedByUsers, rebloggedByUsers }) { + state.allStatusesObject[id] = { + ...state.allStatusesObject[id], + favoritedBy: favoritedByUsers, + rebloggedBy: rebloggedByUsers } } } @@ -553,11 +532,9 @@ const statuses = { credentials: rootState.users.currentUser.credentials }) }, - fetchFavoritedByUsers ({ rootState, commit }, { id, retweetedStatusId, timelineName }) { - rootState.api.backendInteractor.fetchFavoritedByUsers({id}).then((favoritedByUsers) => commit('addFavoritedByUsers', { favoritedByUsers, id: retweetedStatusId, timelineName })) - }, - fetchRebloggedByUsers ({ rootState, commit }, { id, retweetedStatusId, timelineName }) { - rootState.api.backendInteractor.fetchRebloggedByUsers({id}).then((rebloggedByUsers) => commit('addRebloggedByUsers', { rebloggedByUsers, id: retweetedStatusId, timelineName })) + fetchFavsAndRepeats ({ rootState, commit }, id) { + Promise.all([rootState.api.backendInteractor.fetchFavoritedByUsers(id), rootState.api.backendInteractor.fetchRebloggedByUsers(id)]) + .then(([favoritedByUsers, rebloggedByUsers]) => commit('addFavsAndRepeats', { id, favoritedByUsers, rebloggedByUsers })) } }, mutations diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 0768c806..c6742d26 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -112,8 +112,8 @@ const backendInteractorService = (credentials) => { const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) - const fetchFavoritedByUsers = ({id}) => apiService.fetchFavoritedByUsers({id}) - const fetchRebloggedByUsers = ({id}) => apiService.fetchRebloggedByUsers({id}) + const fetchFavoritedByUsers = (id) => apiService.fetchFavoritedByUsers({id}) + const fetchRebloggedByUsers = (id) => apiService.fetchRebloggedByUsers({id}) const backendInteractorServiceInstance = { fetchStatus, -- cgit v1.2.3-70-g09d2 From 808e1ac11cbbe6779dcaa42d5b4cdec900339ccd Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 13 Mar 2019 13:12:56 -0400 Subject: Switch to mastoapi for updating avatar # Conflicts: # src/services/api/api.service.js --- src/components/user_settings/user_settings.js | 26 +++++++++++--------- src/services/api/api.service.js | 28 +++++++--------------- .../backend_interactor_service.js | 2 +- 3 files changed, 24 insertions(+), 32 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index e88ee612..1e2422bb 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -164,19 +164,23 @@ const UserSettings = { reader.readAsDataURL(file) }, submitAvatar (cropper, file) { - let img - if (cropper) { - img = cropper.getCroppedCanvas().toDataURL(file.type) - } else { - img = file - } + return new Promise((resolve, reject) => { + function updateAvatar (avatar) { + this.$store.state.api.backendInteractor.updateAvatar({ avatar }) + .then((user) => { + this.$store.commit('addNewUsers', [user]) + this.$store.commit('setCurrentUser', user) + resolve() + }) + .catch((err) => { + reject(new Error(this.$t('upload.error.base') + ' ' + err.message)) + }) + } - return this.$store.state.api.backendInteractor.updateAvatar({ params: { img } }).then((user) => { - if (!user.error) { - this.$store.commit('addNewUsers', [user]) - this.$store.commit('setCurrentUser', user) + if (cropper) { + cropper.getCroppedCanvas().toBlob(updateAvatar, file.type) } else { - throw new Error(this.$t('upload.error.base') + user.error) + updateAvatar(file) } }) }, diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 6b255e9f..0540b2d2 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -3,7 +3,6 @@ const LOGIN_URL = '/api/account/verify_credentials.json' const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing' const MENTIONS_URL = '/api/statuses/mentions.json' const REGISTRATION_URL = '/api/account/register.json' -const AVATAR_UPDATE_URL = '/api/qvitter/update_avatar.json' const BG_UPDATE_URL = '/api/qvitter/update_background_image.json' const BANNER_UPDATE_URL = '/api/account/update_profile_banner.json' const PROFILE_UPDATE_URL = '/api/account/update_profile.json' @@ -49,6 +48,7 @@ const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute` const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute` const MASTODON_POST_STATUS_URL = '/api/v1/statuses' const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' +const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials' import { each, map, concat, last } from 'lodash' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' @@ -78,28 +78,16 @@ const promisedRequest = (url, options) => { }) } -// Params -// cropH -// cropW -// cropX -// cropY -// img (base 64 encodend data url) -const updateAvatar = ({credentials, params}) => { - let url = AVATAR_UPDATE_URL - +const updateAvatar = ({credentials, avatar}) => { const form = new FormData() - - each(params, (value, key) => { - if (value) { - form.append(key, value) - } - }) - - return fetch(url, { + form.append('avatar', avatar) + return fetch(MASTODON_PROFILE_UPDATE_URL, { headers: authHeaders(credentials), - method: 'POST', + method: 'PATCH', body: form - }).then((data) => data.json()) + }) + .then((data) => data.json()) + .then((data) => parseUser(data)) } const updateBg = ({credentials, params}) => { diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 75bba92b..762ee08b 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -101,7 +101,7 @@ const backendInteractorService = (credentials) => { const getCaptcha = () => apiService.getCaptcha() const register = (params) => apiService.register(params) - const updateAvatar = ({params}) => apiService.updateAvatar({credentials, params}) + const updateAvatar = ({avatar}) => apiService.updateAvatar({credentials, avatar}) const updateBg = ({params}) => apiService.updateBg({credentials, params}) const updateBanner = ({params}) => apiService.updateBanner({credentials, params}) const updateProfile = ({params}) => apiService.updateProfile({credentials, params}) -- cgit v1.2.3-70-g09d2 From 909d11825d83201bf9ff0ec9491e6361f511ca0f Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 13 Mar 2019 13:56:28 -0400 Subject: Switch to mastoapi for updating banner --- src/components/user_settings/user_settings.js | 32 +++++++--------------- src/services/api/api.service.js | 27 +++++------------- .../backend_interactor_service.js | 2 +- 3 files changed, 18 insertions(+), 43 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 1e2422bb..bc824393 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -160,6 +160,7 @@ const UserSettings = { reader.onload = ({target}) => { const img = target.result this[slot + 'Preview'] = img + this[slot] = file } reader.readAsDataURL(file) }, @@ -190,30 +191,17 @@ const UserSettings = { submitBanner () { if (!this.bannerPreview) { return } - let banner = this.bannerPreview - // eslint-disable-next-line no-undef - let imginfo = new Image() - /* eslint-disable camelcase */ - let offset_top, offset_left, width, height - imginfo.src = banner - width = imginfo.width - height = imginfo.height - offset_top = 0 - offset_left = 0 this.bannerUploading = true - this.$store.state.api.backendInteractor.updateBanner({params: {banner, offset_top, offset_left, width, height}}).then((data) => { - if (!data.error) { - let clone = JSON.parse(JSON.stringify(this.$store.state.users.currentUser)) - clone.cover_photo = data.url - this.$store.commit('addNewUsers', [clone]) - this.$store.commit('setCurrentUser', clone) + this.$store.state.api.backendInteractor.updateBanner({banner: this.banner}) + .then((user) => { + this.$store.commit('addNewUsers', [user]) + this.$store.commit('setCurrentUser', user) this.bannerPreview = null - } else { - this.bannerUploadError = this.$t('upload.error.base') + data.error - } - this.bannerUploading = false - }) - /* eslint-enable camelcase */ + }) + .catch((err) => { + this.bannerUploadError = this.$t('upload.error.base') + ' ' + err.message + }) + .then(() => { this.bannerUploading = false }) }, submitBg () { if (!this.backgroundPreview) { return } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 0540b2d2..eaebb3f1 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -4,7 +4,6 @@ const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing' const MENTIONS_URL = '/api/statuses/mentions.json' const REGISTRATION_URL = '/api/account/register.json' const BG_UPDATE_URL = '/api/qvitter/update_background_image.json' -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_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json' @@ -108,28 +107,16 @@ const updateBg = ({credentials, params}) => { }).then((data) => data.json()) } -// Params -// height -// width -// offset_left -// offset_top -// banner (base 64 encodend data url) -const updateBanner = ({credentials, params}) => { - let url = BANNER_UPDATE_URL - +const updateBanner = ({credentials, banner}) => { const form = new FormData() - - each(params, (value, key) => { - if (value) { - form.append(key, value) - } - }) - - return fetch(url, { + form.append('header', banner) + return fetch(MASTODON_PROFILE_UPDATE_URL, { headers: authHeaders(credentials), - method: 'POST', + method: 'PATCH', body: form - }).then((data) => data.json()) + }) + .then((data) => data.json()) + .then((data) => parseUser(data)) } // Params diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 762ee08b..d61ff452 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -103,7 +103,7 @@ const backendInteractorService = (credentials) => { const register = (params) => apiService.register(params) const updateAvatar = ({avatar}) => apiService.updateAvatar({credentials, avatar}) const updateBg = ({params}) => apiService.updateBg({credentials, params}) - const updateBanner = ({params}) => apiService.updateBanner({credentials, params}) + const updateBanner = ({banner}) => apiService.updateBanner({credentials, banner}) const updateProfile = ({params}) => apiService.updateProfile({credentials, params}) const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials}) -- cgit v1.2.3-70-g09d2 From 903bce40c3b013ed2f2347c254ea184293b45b22 Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 29 Mar 2019 23:39:24 -0400 Subject: move formData generating logic to api.service --- src/components/importer/importer.js | 5 +---- src/services/api/api.service.js | 6 ++++-- .../backend_interactor_service/backend_interactor_service.js | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/importer/importer.js b/src/components/importer/importer.js index 8d6c8b3f..44d02c93 100644 --- a/src/components/importer/importer.js +++ b/src/components/importer/importer.js @@ -13,10 +13,7 @@ const Importer = { }, submit () { this.uploading = true - // eslint-disable-next-line no-undef - const formData = new FormData() - formData.append('list', this.file) - this.$store.state.api.backendInteractor.followImport({params: formData}) + this.$store.state.api.backendInteractor.followImport(this.file) .then((status) => { if (status) { this.success = true diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 6b255e9f..3f6ffccc 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -634,9 +634,11 @@ const uploadMedia = ({formData, credentials}) => { .then((data) => parseAttachment(data)) } -const followImport = ({params, credentials}) => { +const followImport = ({file, credentials}) => { + const formData = new FormData() + formData.append('list', file) return fetch(FOLLOW_IMPORT_URL, { - body: params, + body: formData, method: 'POST', headers: authHeaders(credentials) }) diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 75bba92b..2438c603 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -107,7 +107,7 @@ const backendInteractorService = (credentials) => { const updateProfile = ({params}) => apiService.updateProfile({credentials, params}) const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials}) - const followImport = ({params}) => apiService.followImport({params, credentials}) + const followImport = (file) => apiService.followImport({file, credentials}) const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) -- cgit v1.2.3-70-g09d2 From 6ea4154084b288f6f67ccf9c10829013c3cbe892 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sat, 30 Mar 2019 07:22:30 -0400 Subject: change api function name --- src/components/user_settings/user_settings.js | 2 +- src/services/api/api.service.js | 4 ++-- src/services/backend_interactor_service/backend_interactor_service.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 32e92dc4..fa252e59 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -235,7 +235,7 @@ const UserSettings = { }) }, importFollows (file) { - return this.$store.state.api.backendInteractor.followImport(file) + return this.$store.state.api.backendInteractor.importFollows(file) .then((status) => { if (!status) { throw new Error('failed') diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 3f6ffccc..dbcde41d 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -634,7 +634,7 @@ const uploadMedia = ({formData, credentials}) => { .then((data) => parseAttachment(data)) } -const followImport = ({file, credentials}) => { +const importFollows = ({file, credentials}) => { const formData = new FormData() formData.append('list', file) return fetch(FOLLOW_IMPORT_URL, { @@ -778,7 +778,7 @@ const apiService = { updateProfile, updateBanner, externalProfile, - followImport, + importFollows, deleteAccount, changePassword, fetchFollowRequests, diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 2438c603..726c8ced 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -107,7 +107,7 @@ const backendInteractorService = (credentials) => { const updateProfile = ({params}) => apiService.updateProfile({credentials, params}) const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials}) - const followImport = (file) => apiService.followImport({file, credentials}) + const importFollows = (file) => apiService.importFollows({file, credentials}) const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) @@ -147,7 +147,7 @@ const backendInteractorService = (credentials) => { updateBanner, updateProfile, externalProfile, - followImport, + importFollows, deleteAccount, changePassword, fetchFollowRequests, -- cgit v1.2.3-70-g09d2 From 0ab2f9dfa58c1f4caf01f083175a171d19272cda Mon Sep 17 00:00:00 2001 From: taehoon Date: Sat, 30 Mar 2019 07:27:53 -0400 Subject: add “block import” feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/user_settings/user_settings.js | 8 ++++++++ src/components/user_settings/user_settings.vue | 5 +++++ src/i18n/en.json | 4 ++++ src/services/api/api.service.js | 13 +++++++++++++ .../backend_interactor_service.js | 2 ++ 5 files changed, 32 insertions(+) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index fa252e59..c4214744 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -242,6 +242,14 @@ const UserSettings = { } }) }, + importBlocks (file) { + return this.$store.state.api.backendInteractor.importBlocks(file) + .then((status) => { + if (!status) { + throw new Error('failed') + } + }) + }, /* This function takes an Array of Users * and outputs a file with all the addresses for the user to download */ diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index fc40bdc0..520a3d8a 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -180,6 +180,11 @@

{{$t('settings.follow_export_processing')}}

+
+

{{$t('settings.block_import')}}

+

{{$t('settings.import_blocks_from_a_csv_file')}}

+ +
diff --git a/src/i18n/en.json b/src/i18n/en.json index 34d252b2..d4ec1134 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -131,6 +131,9 @@ "avatarRadius": "Avatars", "background": "Background", "bio": "Bio", + "block_import": "Block import", + "block_import_error": "Error importing blocks", + "blocks_imported": "Blocks imported! Processing them will take a while.", "blocks_tab": "Blocks", "btnRadius": "Buttons", "cBlue": "Blue (Reply, follow)", @@ -174,6 +177,7 @@ "hide_post_stats": "Hide post statistics (e.g. the number of favorites)", "hide_user_stats": "Hide user statistics (e.g. the number of followers)", "hide_filtered_statuses": "Hide filtered statuses", + "import_blocks_from_a_csv_file": "Import blocks from a csv file", "import_followers_from_a_csv_file": "Import follows from a csv file", "import_theme": "Load preset", "inputRadius": "Input fields", diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index dbcde41d..a6892959 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -9,6 +9,7 @@ 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_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json' +const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' @@ -634,6 +635,17 @@ const uploadMedia = ({formData, credentials}) => { .then((data) => parseAttachment(data)) } +const importBlocks = ({file, credentials}) => { + const formData = new FormData() + formData.append('list', file) + return fetch(BLOCKS_IMPORT_URL, { + body: formData, + method: 'POST', + headers: authHeaders(credentials) + }) + .then((response) => response.ok) +} + const importFollows = ({file, credentials}) => { const formData = new FormData() formData.append('list', file) @@ -778,6 +790,7 @@ const apiService = { updateProfile, updateBanner, externalProfile, + importBlocks, importFollows, deleteAccount, changePassword, diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 726c8ced..3256a921 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -107,6 +107,7 @@ const backendInteractorService = (credentials) => { const updateProfile = ({params}) => apiService.updateProfile({credentials, params}) const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials}) + const importBlocks = (file) => apiService.importBlocks({file, credentials}) const importFollows = (file) => apiService.importFollows({file, credentials}) const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) @@ -147,6 +148,7 @@ const backendInteractorService = (credentials) => { updateBanner, updateProfile, externalProfile, + importBlocks, importFollows, deleteAccount, changePassword, -- cgit v1.2.3-70-g09d2 From cea6ea42f0f882864e01f79a8af08c8bc59272fb Mon Sep 17 00:00:00 2001 From: taehoon Date: Wed, 20 Mar 2019 11:45:19 -0400 Subject: add api service function --- .../user_reporting_modal/user_reporting_modal.js | 6 +++--- src/modules/reports.js | 5 +++-- src/services/api/api.service.js | 22 +++++++++++++++++++++- .../backend_interactor_service.js | 4 +++- 4 files changed, 30 insertions(+), 7 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/components/user_reporting_modal/user_reporting_modal.js b/src/components/user_reporting_modal/user_reporting_modal.js index fb9ea16d..87b6fde9 100644 --- a/src/components/user_reporting_modal/user_reporting_modal.js +++ b/src/components/user_reporting_modal/user_reporting_modal.js @@ -44,12 +44,12 @@ const UserReportingModal = { this.$store.dispatch('closeUserReportingModal') }, reportUser () { - const payload = { + const params = { comment: this.comment, forward: this.forward, - statusIdsToReport: this.statusIdsToReport + statusIds: this.statusIdsToReport } - this.$store.dispatch('reportUser', payload) + this.$store.dispatch('reportUser', params) }, isChecked (statusId) { return this.statusIdsToReport.indexOf(statusId) !== -1 diff --git a/src/modules/reports.js b/src/modules/reports.js index b712cfeb..0470b3be 100644 --- a/src/modules/reports.js +++ b/src/modules/reports.js @@ -24,8 +24,9 @@ const reports = { closeUserReportingModal ({ commit }) { commit('closeUserReportingModal') }, - reportUser ({ commit }, payload) { - console.log('payload', payload) + reportUser ({ state, rootState, commit }, params) { + rootState.api.backendInteractor.reportUser({ userId: state.userId, ...params }) + .then(result => console.log(result)) } } } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index c5e2280d..9753049f 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -50,6 +50,7 @@ const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' const MASTODON_STATUS_FAVORITEDBY_URL = id => `/api/v1/statuses/${id}/favourited_by` const MASTODON_STATUS_REBLOGGEDBY_URL = id => `/api/v1/statuses/${id}/reblogged_by` const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials' +const MASTODON_REPORT_USER_URL = 'api/v1/reports' import { each, map, concat, last } from 'lodash' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' @@ -722,6 +723,24 @@ const fetchRebloggedByUsers = ({id}) => { return promisedRequest(MASTODON_STATUS_REBLOGGEDBY_URL(id)).then((users) => users.map(parseUser)) } +const reportUser = ({credentials, userId, statusIds, comment, forward}) => { + const payload = { + 'account_id': userId, + 'status_ids': statusIds, + comment, + forward + } + return fetch(MASTODON_REPORT_USER_URL, { + body: JSON.stringify(payload), + headers: { + ...authHeaders(credentials), + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + method: 'POST' + }).then((data) => data.json()) +} + const apiService = { verifyCredentials, fetchTimeline, @@ -773,7 +792,8 @@ const apiService = { suggestions, markNotificationsAsSeen, fetchFavoritedByUsers, - fetchRebloggedByUsers + fetchRebloggedByUsers, + reportUser } export default apiService diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index d2b581ca..58bb1248 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -115,6 +115,7 @@ const backendInteractorService = (credentials) => { const fetchFavoritedByUsers = (id) => apiService.fetchFavoritedByUsers({id}) const fetchRebloggedByUsers = (id) => apiService.fetchRebloggedByUsers({id}) + const reportUser = (params) => apiService.reportUser({credentials, ...params}) const backendInteractorServiceInstance = { fetchStatus, @@ -159,7 +160,8 @@ const backendInteractorService = (credentials) => { approveUser, denyUser, fetchFavoritedByUsers, - fetchRebloggedByUsers + fetchRebloggedByUsers, + reportUser } return backendInteractorServiceInstance -- cgit v1.2.3-70-g09d2 From 7d60ab322ed996b067242c3f047f90814f9c8f7c Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 7 May 2019 23:36:35 -0400 Subject: use backendInteractor --- src/modules/statuses.js | 11 ++++++----- .../backend_interactor_service/backend_interactor_service.js | 11 ++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/services/backend_interactor_service') diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 527789f8..4c92d4e1 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -524,24 +524,25 @@ const statuses = { favorite ({ rootState, commit }, status) { // Optimistic favoriting... commit('setFavorited', { status, value: true }) - apiService.favorite({ id: status.id, credentials: rootState.users.currentUser.credentials }) + rootState.api.backendInteractor.favorite(status.id) .then(status => commit('setFavoritedConfirm', { status, user: rootState.users.currentUser })) }, unfavorite ({ rootState, commit }, status) { - // Optimistic favoriting... + // Optimistic unfavoriting... commit('setFavorited', { status, value: false }) - apiService.unfavorite({ id: status.id, credentials: rootState.users.currentUser.credentials }) + rootState.api.backendInteractor.unfavorite(status.id) .then(status => commit('setFavoritedConfirm', { status, user: rootState.users.currentUser })) }, retweet ({ rootState, commit }, status) { // Optimistic retweeting... commit('setRetweeted', { status, value: true }) - apiService.retweet({ id: status.id, credentials: rootState.users.currentUser.credentials }) + rootState.api.backendInteractor.retweet(status.id) .then(status => commit('setRetweetedConfirm', { status: status.retweeted_status, user: rootState.users.currentUser })) }, unretweet ({ rootState, commit }, status) { + // Optimistic unretweeting... commit('setRetweeted', { status, value: false }) - apiService.unretweet({ id: status.id, credentials: rootState.users.currentUser.credentials }) + rootState.api.backendInteractor.unretweet(status.id) .then(status => commit('setRetweetedConfirm', { status, user: rootState.users.currentUser })) }, queueFlush ({ rootState, commit }, { timeline, id }) { diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 58bb1248..c2b93de4 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -117,6 +117,11 @@ const backendInteractorService = (credentials) => { const fetchRebloggedByUsers = (id) => apiService.fetchRebloggedByUsers({id}) const reportUser = (params) => apiService.reportUser({credentials, ...params}) + const favorite = (id) => apiService.favorite({id, credentials}) + const unfavorite = (id) => apiService.unfavorite({id, credentials}) + const retweet = (id) => apiService.retweet({id, credentials}) + const unretweet = (id) => apiService.unretweet({id, credentials}) + const backendInteractorServiceInstance = { fetchStatus, fetchConversation, @@ -161,7 +166,11 @@ const backendInteractorService = (credentials) => { denyUser, fetchFavoritedByUsers, fetchRebloggedByUsers, - reportUser + reportUser, + favorite, + unfavorite, + retweet, + unretweet } return backendInteractorServiceInstance -- cgit v1.2.3-70-g09d2 From 543604fd2d107d3c6b7123e5713ac923eb76f23c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 14 May 2019 22:38:16 +0300 Subject: removed unused masto api, added initial version of interactions timeline --- src/boot/routes.js | 4 ++-- src/components/interactions/interactions.js | 25 ++++++++++++++++++++++ src/components/interactions/interactions.vue | 25 ++++++++++++++++++++++ src/components/mentions/mentions.vue | 2 +- src/components/nav_panel/nav_panel.vue | 2 +- src/components/notifications/notifications.js | 8 +++++-- src/components/notifications/notifications.vue | 4 ++-- src/components/tab_switcher/tab_switcher.js | 13 ++++++++--- src/services/api/api.service.js | 11 ---------- .../backend_interactor_service.js | 5 ----- .../notification_utils/notification_utils.js | 6 ++++-- 11 files changed, 76 insertions(+), 29 deletions(-) create mode 100644 src/components/interactions/interactions.js create mode 100644 src/components/interactions/interactions.vue (limited to 'src/services/backend_interactor_service') diff --git a/src/boot/routes.js b/src/boot/routes.js index 7e54a98b..508c76df 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -3,7 +3,7 @@ import PublicAndExternalTimeline from 'components/public_and_external_timeline/p import FriendsTimeline from 'components/friends_timeline/friends_timeline.vue' import TagTimeline from 'components/tag_timeline/tag_timeline.vue' import ConversationPage from 'components/conversation-page/conversation-page.vue' -import Mentions from 'components/mentions/mentions.vue' +import Interactions from 'components/interactions/interactions.vue' import DMs from 'components/dm_timeline/dm_timeline.vue' import UserProfile from 'components/user_profile/user_profile.vue' import Settings from 'components/settings/settings.vue' @@ -34,7 +34,7 @@ export default (store) => { { name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline }, { name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } }, { name: 'external-user-profile', path: '/users/:id', component: UserProfile }, - { name: 'mentions', path: '/users/:username/mentions', component: Mentions }, + { name: 'mentions', path: '/users/:username/interactions', component: Interactions }, { name: 'dms', path: '/users/:username/dms', component: DMs }, { name: 'settings', path: '/settings', component: Settings }, { name: 'registration', path: '/registration', component: Registration }, diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js new file mode 100644 index 00000000..4c56a931 --- /dev/null +++ b/src/components/interactions/interactions.js @@ -0,0 +1,25 @@ +import Notifications from '../notifications/notifications.vue' + +const tabModeDict = { + mentions: ['mention'], + 'likes+repeats': ['repeat', 'like'], + follows: ['follow'] +} + +const Interactions = { + data () { + return { + filterMode: tabModeDict['mentions'] + } + }, + methods: { + onModeSwitch(index, dataset) { + this.filterMode = tabModeDict[dataset.filter] + } + }, + components: { + Notifications + } +} + +export default Interactions diff --git a/src/components/interactions/interactions.vue b/src/components/interactions/interactions.vue new file mode 100644 index 00000000..751e5d40 --- /dev/null +++ b/src/components/interactions/interactions.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/components/mentions/mentions.vue b/src/components/mentions/mentions.vue index bba06da6..6b4e96e0 100644 --- a/src/components/mentions/mentions.vue +++ b/src/components/mentions/mentions.vue @@ -1,5 +1,5 @@ diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index 7a7212fb..05097c45 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -9,7 +9,7 @@
  • - {{ $t("nav.mentions") }} + {{ $t("nav.interactions") }}
  • diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 5b13b98e..acc31986 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -8,7 +8,7 @@ import { const Notifications = { props: [ - 'noHeading' + 'noHeading', 'minimalMode', 'filterMode' ], data () { return { @@ -16,6 +16,9 @@ const Notifications = { } }, computed: { + mainClass () { + return this.minimalMode ? '' : 'panel panel-default' + }, notifications () { return notificationsFromStore(this.$store) }, @@ -26,7 +29,8 @@ const Notifications = { return unseenNotificationsFromStore(this.$store) }, visibleNotifications () { - return visibleNotificationsFromStore(this.$store) + console.log(this.filterMode) + return visibleNotificationsFromStore(this.$store, this.filterMode) }, unseenCount () { return this.unseenNotifications.length diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index 88775be1..3c3ae191 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -1,6 +1,6 @@