diff --git a/changelog.d/actions-extra-tap.fix b/changelog.d/actions-extra-tap.fix deleted file mode 100644 index cb54c2e35..000000000 --- a/changelog.d/actions-extra-tap.fix +++ /dev/null @@ -1 +0,0 @@ -fixed tapping "Mute..." and "Change visiblity" (admin action) in extra status actions closing the dropdown diff --git a/changelog.d/fix-domain-mute.fix b/changelog.d/fix-domain-mute.fix deleted file mode 100644 index 1cb910d22..000000000 --- a/changelog.d/fix-domain-mute.fix +++ /dev/null @@ -1 +0,0 @@ -domain mute fixedw diff --git a/changelog.d/followers-list.fix b/changelog.d/followers-list.fix deleted file mode 100644 index 51e96f90c..000000000 --- a/changelog.d/followers-list.fix +++ /dev/null @@ -1 +0,0 @@ -Fix followers list showing followed users as non-followed diff --git a/changelog.d/moderation-tools.fix b/changelog.d/moderation-tools.fix deleted file mode 100644 index 1417048a5..000000000 --- a/changelog.d/moderation-tools.fix +++ /dev/null @@ -1 +0,0 @@ -fix moderation tools button possibly not appearing for admins diff --git a/changelog.d/moderation.fix b/changelog.d/moderation.fix deleted file mode 100644 index c206a5ea8..000000000 --- a/changelog.d/moderation.fix +++ /dev/null @@ -1 +0,0 @@ -Fixed moderation actions requiring confirmation closing user popover diff --git a/changelog.d/streaming.add b/changelog.d/streaming.add deleted file mode 100644 index c6e7de171..000000000 --- a/changelog.d/streaming.add +++ /dev/null @@ -1 +0,0 @@ -More timelines now can utilize WebSocket streaming diff --git a/changelog.d/streaming.fix b/changelog.d/streaming.fix deleted file mode 100644 index 660a6694f..000000000 --- a/changelog.d/streaming.fix +++ /dev/null @@ -1 +0,0 @@ -switches between streaming and polling should be more reliable now diff --git a/changelog.d/streaming_indicator.add b/changelog.d/streaming_indicator.add deleted file mode 100644 index 547307384..000000000 --- a/changelog.d/streaming_indicator.add +++ /dev/null @@ -1 +0,0 @@ -Added an indicator next to instance's name showing WebSocket connection status (if enabled) diff --git a/changelog.d/theme-index-html-fallback.fix b/changelog.d/theme-index-html-fallback.fix deleted file mode 100644 index 90a23cacc..000000000 --- a/changelog.d/theme-index-html-fallback.fix +++ /dev/null @@ -1 +0,0 @@ -Fix theme lists failing to load when custom resource indexes are unavailable diff --git a/changelog.d/themes2-font.fix b/changelog.d/themes2-font.fix deleted file mode 100644 index 0842fae8a..000000000 --- a/changelog.d/themes2-font.fix +++ /dev/null @@ -1 +0,0 @@ -Fix Themes 2.0 applying incorrect fonts diff --git a/changelog.d/themes3.fix b/changelog.d/themes3.fix deleted file mode 100644 index a3192b263..000000000 --- a/changelog.d/themes3.fix +++ /dev/null @@ -1 +0,0 @@ -Fixed themes 3 not loading in appearance tab diff --git a/src/App.js b/src/App.js index ed3d43e4a..d7a63bd8a 100644 --- a/src/App.js +++ b/src/App.js @@ -21,7 +21,6 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j import { useInterfaceStore } from 'src/stores/interface.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useShoutStore } from 'src/stores/shout.js' -import { useUsersStore } from 'src/stores/users.js' // Helper to unwrap reactive proxies window.toValue = (x) => JSON.parse(JSON.stringify(x)) @@ -154,8 +153,11 @@ export default { ...(navbarColumnStretch ? ['-column-stretch'] : []), ] }, + currentUser() { + return this.$store.state.users.currentUser + }, userBackground() { - return this.currentUser?.background_image + return this.currentUser.background_image }, foreignProfileBackground() { return ( @@ -244,7 +246,6 @@ export default { 'styleDataUsed', 'layoutType', ]), - ...mapState(useUsersStore, ['currentUser']), ...mapState(useInstanceStore, ['styleDataUsed']), ...mapState(useInstanceCapabilitiesStore, [ 'suggestionsEnabled', diff --git a/src/App.vue b/src/App.vue index bd19c5c10..84a6f7d3d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,7 +26,7 @@ class="column -scrollable" :class="{ '-show-scrollbar': showScrollbars }" > - + + + diff --git a/src/components/domain_mute_card/domain_mute_card.js b/src/components/domain_mute_card/domain_mute_card.js index 274679b8d..d83896618 100644 --- a/src/components/domain_mute_card/domain_mute_card.js +++ b/src/components/domain_mute_card/domain_mute_card.js @@ -1,7 +1,5 @@ import ProgressButton from 'src/components/progress_button/progress_button.vue' -import { useUsersStore } from 'src/stores/users.js' - const DomainMuteCard = { props: ['domain'], components: { @@ -9,7 +7,7 @@ const DomainMuteCard = { }, computed: { user() { - return useUsersStore().currentUser + return this.$store.state.users.currentUser }, muted() { return this.user.domainMutes.includes(this.domain) @@ -17,10 +15,10 @@ const DomainMuteCard = { }, methods: { unmuteDomain() { - return useUsersStore().unmuteDomain(this.domain) + return this.$store.dispatch('unmuteDomain', this.domain) }, muteDomain() { - return useUsersStore().muteDomain(this.domain) + return this.$store.dispatch('muteDomain', this.domain) }, }, } diff --git a/src/components/draft/draft.js b/src/components/draft/draft.js index 1c7f419c6..49e186eae 100644 --- a/src/components/draft/draft.js +++ b/src/components/draft/draft.js @@ -6,7 +6,6 @@ import PostStatusForm from 'src/components/post_status_form/post_status_form.vue import StatusContent from 'src/components/status_content/status_content.vue' import { useMergedConfigStore } from 'src/stores/merged_config.js' -import { useStatusesStore } from 'src/stores/statuses.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faPollH } from '@fortawesome/free-solid-svg-icons' @@ -66,7 +65,7 @@ const Draft = { }, refStatus() { return this.draft.refId - ? useStatusesStore().allStatuses.get(this.draft.refId) + ? this.$store.state.statuses.allStatusesObject[this.draft.refId] : undefined }, localCollapseSubjectDefault() { diff --git a/src/components/edit_status_modal/edit_status_modal.js b/src/components/edit_status_modal/edit_status_modal.js index 12072d7a2..59c142d08 100644 --- a/src/components/edit_status_modal/edit_status_modal.js +++ b/src/components/edit_status_modal/edit_status_modal.js @@ -4,7 +4,6 @@ import { defineAsyncComponent } from 'vue' import Modal from 'src/components/modal/modal.vue' import { useEditStatusStore } from 'src/stores/editStatus.js' -import { useUsersStore } from 'src/stores/users.js' const EditStatusModal = { components: { @@ -20,7 +19,7 @@ const EditStatusModal = { }, computed: { isLoggedIn() { - return !!useUsersStore().currentUser + return !!this.$store.state.users.currentUser }, modalActivated() { return useEditStatusStore().modalActivated diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index 6a7dbff9a..c31cb6717 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -1,5 +1,3 @@ -import { useSearchStore } from 'src/stores/search.js' - /** * suggest - generates a suggestor function to be used by emoji-input * data: object providing source information for specific types of suggestions: @@ -79,7 +77,7 @@ export const suggestUsers = ({ dispatch, state }) => { let timeout = null let cancelUserSearch = null - const userSearch = (query) => useSearchStore().searchUsers({ query }) + const userSearch = (query) => dispatch('searchUsers', { query }) const debounceUserSearch = (query) => { cancelUserSearch?.() return new Promise((resolve, reject) => { diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js index 3077ed212..acb5404c0 100644 --- a/src/components/emoji_reactions/emoji_reactions.js +++ b/src/components/emoji_reactions/emoji_reactions.js @@ -3,8 +3,6 @@ import UserListPopover from 'src/components/user_list_popover/user_list_popover. import { useInstanceStore } from 'src/stores/instance.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' -import { useStatusesStore } from 'src/stores/statuses.js' -import { useUsersStore } from 'src/stores/users.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faCheck, faMinus, faPlus } from '@fortawesome/free-solid-svg-icons' @@ -42,7 +40,7 @@ const EmojiReactions = { }, {}) }, loggedIn() { - return !!useUsersStore().currentUser + return !!this.$store.state.users.currentUser }, remoteInteractionLink() { return useInstanceStore().getRemoteInteractionLink({ @@ -60,22 +58,25 @@ const EmojiReactions = { reactedWith(emoji) { return this.status.emoji_reactions.find((r) => r.name === emoji).me }, - async fetchEmojiReactionsIfMissing() { + async fetchEmojiReactionsByIfMissing() { const hasNoAccounts = this.status.emoji_reactions.find((r) => !r.accounts) - if (!hasNoAccounts) { - return await useStatusesStore().fetchEmojiReactions(this.status.id) + if (hasNoAccounts) { + return await this.$store.dispatch( + 'fetchEmojiReactionsBy', + this.status.id, + ) } }, reactWith(emoji) { - useStatusesStore().reactWithEmoji(this.status.id, emoji) + this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) }, unreact(emoji) { - useStatusesStore().unreactWithEmoji(this.status.id, emoji) + this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji }) }, async emojiOnClick(emoji) { if (!this.loggedIn) return - await this.fetchEmojiReactionsIfMissing() + await this.fetchEmojiReactionsByIfMissing() if (this.reactedWith(emoji)) { this.unreact(emoji) } else { diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue index a8100c0d4..16c69fa40 100644 --- a/src/components/emoji_reactions/emoji_reactions.vue +++ b/src/components/emoji_reactions/emoji_reactions.vue @@ -56,7 +56,7 @@ class="emoji-reaction-popover" :normal-button="true" :trigger-attrs="counterTriggerAttrs(reaction)" - @show="fetchEmojiReactionsIfMissing()" + @show="fetchEmojiReactionsByIfMissing()" > {{ reaction.count }} diff --git a/src/components/extra_notifications/extra_notifications.js b/src/components/extra_notifications/extra_notifications.js index 851656ae5..24ed074af 100644 --- a/src/components/extra_notifications/extra_notifications.js +++ b/src/components/extra_notifications/extra_notifications.js @@ -6,7 +6,6 @@ import { useChatsStore } from 'src/stores/chats.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useSyncConfigStore } from 'src/stores/sync_config.js' -import { useUsersStore } from 'src/stores/users.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -53,7 +52,7 @@ const ExtraNotifications = { ) }, currentUser() { - return useUsersStore().currentUser + return this.$store.state.users.currentUser }, ...mapGetters(['followRequestCount']), ...mapState(useAnnouncementsStore, { diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js index e4d243ff9..3fecc025f 100644 --- a/src/components/follow_button/follow_button.js +++ b/src/components/follow_button/follow_button.js @@ -1,8 +1,11 @@ import { defineAsyncComponent } from 'vue' -import { useMergedConfigStore } from 'src/stores/merged_config.js' -import { useUsersStore } from 'src/stores/users.js' +import { + requestFollow, + requestUnfollow, +} from '../../services/follow_manipulate/follow_manipulate' +import { useMergedConfigStore } from 'src/stores/merged_config.js' export default { props: ['relationship', 'user', 'labelFollowing', 'buttonClass'], components: { @@ -61,11 +64,9 @@ export default { }, follow() { this.inProgress = true - useUsersStore() - .followUser(this.relationship.id) - .finally(() => { - this.inProgress = false - }) + requestFollow(this.relationship.id, this.$store).then(() => { + this.inProgress = false + }) }, unfollow() { if (this.shouldConfirmUnfollow) { @@ -75,12 +76,15 @@ export default { } }, doUnfollow() { + const store = this.$store this.inProgress = true - useUsersStore() - .unfollowUser(this.relationship.id) - .finally(() => { - this.inProgress = false + requestUnfollow(this.relationship.id, store).then(() => { + this.inProgress = false + store.commit('removeStatus', { + timeline: 'friends', + userId: this.relationship.id, }) + }) this.hideConfirmUnfollow() }, diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js index 9a8b8746f..8fffbf730 100644 --- a/src/components/follow_card/follow_card.js +++ b/src/components/follow_card/follow_card.js @@ -3,8 +3,6 @@ import FollowButton from 'src/components/follow_button/follow_button.vue' import RemoteFollow from 'src/components/remote_follow/remote_follow.vue' import RemoveFollowerButton from 'src/components/remove_follower_button/remove_follower_button.vue' -import { useUsersStore } from 'src/stores/users.js' - const FollowCard = { props: ['user', 'noFollowsYou'], components: { @@ -15,13 +13,13 @@ const FollowCard = { }, computed: { isMe() { - return useUsersStore().currentUser.id === this.user.id + return this.$store.state.users.currentUser.id === this.user.id }, loggedIn() { - return useUsersStore().currentUser + return this.$store.state.users.currentUser }, relationship() { - return useUsersStore().relationships.get(this.user.id) + return this.$store.getters.relationship(this.user.id) }, }, } diff --git a/src/components/follow_card/follow_card.vue b/src/components/follow_card/follow_card.vue index d9a508a95..bdb6b8092 100644 --- a/src/components/follow_card/follow_card.vue +++ b/src/components/follow_card/follow_card.vue @@ -1,5 +1,5 @@ - + diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index c4b43811a..294dd2472 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -1,9 +1,9 @@ import { defineAsyncComponent } from 'vue' +import { notificationsFromStore } from '../../services/notification_utils/notification_utils.js' import BasicUserCard from '../basic_user_card/basic_user_card.vue' import { useMergedConfigStore } from 'src/stores/merged_config.js' -import { useNotificationsStore } from 'src/stores/notifications.js' import { useOAuthStore } from 'src/stores/oauth.js' import { approveUser, denyUser } from 'src/api/user.js' @@ -24,7 +24,7 @@ const FollowRequestCard = { }, methods: { findFollowRequestNotificationId() { - const notif = useNotificationsStore().data.find( + const notif = notificationsFromStore(this.$store).find( (notif) => notif.from_profile.id === this.user.id && notif.type === 'follow_request', @@ -55,11 +55,16 @@ const FollowRequestCard = { id: this.user.id, credentials: useOAuthStore().token, }) - // TODO fix this.$store.dispatch('removeFollowRequest', this.user) const notifId = this.findFollowRequestNotificationId() - useNotificationsStore().markSingleNotificationAsSeen(notifId) + this.$store.dispatch('markSingleNotificationAsSeen', { id: notifId }) + this.$store.dispatch('updateNotification', { + id: notifId, + updater: (notification) => { + notification.type = 'follow' + }, + }) this.hideApproveConfirmDialog() }, denyUser() { @@ -76,8 +81,7 @@ const FollowRequestCard = { id: this.user.id, credentials: useOAuthStore().token, }).then(() => { - useNotificationsStore().dismissNotificationLocal(notifId) - // TODO fix + this.$store.dispatch('dismissNotificationLocal', { id: notifId }) this.$store.dispatch('removeFollowRequest', this.user) }) this.hideDenyConfirmDialog() diff --git a/src/components/friends_timeline/friends_timeline.js b/src/components/friends_timeline/friends_timeline.js new file mode 100644 index 000000000..b6bee7305 --- /dev/null +++ b/src/components/friends_timeline/friends_timeline.js @@ -0,0 +1,14 @@ +import Timeline from 'src/components/timeline/timeline.vue' + +const FriendsTimeline = { + components: { + Timeline, + }, + computed: { + timeline() { + return this.$store.state.statuses.timelines.friends + }, + }, +} + +export default FriendsTimeline diff --git a/src/components/friends_timeline/friends_timeline.vue b/src/components/friends_timeline/friends_timeline.vue new file mode 100644 index 000000000..01a568123 --- /dev/null +++ b/src/components/friends_timeline/friends_timeline.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js index 37873605f..d008c4b30 100644 --- a/src/components/interactions/interactions.js +++ b/src/components/interactions/interactions.js @@ -1,8 +1,6 @@ import Notifications from 'src/components/notifications/notifications.vue' import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx' -import { useUsersStore } from 'src/stores/users.js' - const tabModeDict = { mentions: ['mention'], statuses: ['status'], @@ -16,9 +14,10 @@ const tabModeDict = { const Interactions = { data() { return { - allowFollowingMove: useUsersStore().currentUser.allow_following_move, + allowFollowingMove: + this.$store.state.users.currentUser.allow_following_move, filterMode: tabModeDict.mentions, - canSeeReports: useUsersStore().currentUser.privileges.has( + canSeeReports: this.$store.state.users.currentUser.privileges.has( 'reports_manage_reports', ), } diff --git a/src/components/list/list.js b/src/components/list/list.js index 20b7c5a78..c7b924258 100644 --- a/src/components/list/list.js +++ b/src/components/list/list.js @@ -98,13 +98,12 @@ const List = { this.fetchFunction(this.page) .then((result) => { - console.log(result) this.loading = false - this.bottomedOut = isEmpty(result) + this.bottomedOut = isEmpty(result.items) if (this.externalItems) return this.page += 1 - this.total = result.length - this.items.push(...result) + this.total = result.count + this.items.push(...result.items) }) .catch((error) => { this.loading = false diff --git a/src/components/lists_edit/lists_edit.js b/src/components/lists_edit/lists_edit.js index cea9236a5..7eb035091 100644 --- a/src/components/lists_edit/lists_edit.js +++ b/src/components/lists_edit/lists_edit.js @@ -1,4 +1,5 @@ -import { mapState } from 'pinia' +import { mapState as mapPiniaState } from 'pinia' +import { mapGetters, mapState } from 'vuex' import BasicUserCard from 'src/components/basic_user_card/basic_user_card.vue' import ListsUserSearch from 'src/components/lists_user_search/lists_user_search.vue' @@ -8,7 +9,6 @@ import UserAvatar from 'src/components/user_avatar/user_avatar.vue' import { useInterfaceStore } from 'src/stores/interface.js' import { useListsStore } from 'src/stores/lists.js' -import { useUsersStore } from 'src/stores/users.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faChevronLeft, faSearch } from '@fortawesome/free-solid-svg-icons' @@ -47,8 +47,8 @@ const ListsNew = { .fetchListAccounts({ listId: this.id }) .then(() => { this.membersUserIds = this.findListAccounts(this.id) - this.membersUserIds.forEach((id) => { - useUsersStore().fetchUserIfMissing({ id }) + this.membersUserIds.forEach((userId) => { + this.$store.dispatch('fetchUserIfMissing', userId) }) }) }, @@ -66,8 +66,11 @@ const ListsNew = { .map((userId) => this.findUser(userId)) .filter(Boolean) }, - ...mapState(useUsersStore, ['currentUser', 'findUser']), - ...mapState(useListsStore, ['findListTitle', 'findListAccounts']), + ...mapState({ + currentUser: (state) => state.users.currentUser, + }), + ...mapPiniaState(useListsStore, ['findListTitle', 'findListAccounts']), + ...mapGetters(['findUser']), }, methods: { onInput() { diff --git a/src/components/lists_menu/lists_menu_content.js b/src/components/lists_menu/lists_menu_content.js index 7c422d033..337ee4d4f 100644 --- a/src/components/lists_menu/lists_menu_content.js +++ b/src/components/lists_menu/lists_menu_content.js @@ -1,10 +1,10 @@ -import { mapState } from 'pinia' +import { mapState as mapPiniaState } from 'pinia' +import { mapState } from 'vuex' import { getListEntries } from 'src/components/navigation/filter.js' import NavigationEntry from 'src/components/navigation/navigation_entry.vue' import { useListsStore } from 'src/stores/lists.js' -import { useUsersStore } from 'src/stores/users.js' export const ListsMenuContent = { props: ['showPin'], @@ -12,10 +12,12 @@ export const ListsMenuContent = { NavigationEntry, }, computed: { - ...mapState(useListsStore, { + ...mapPiniaState(useListsStore, { lists: getListEntries, }), - ...mapState(useUsersStore, ['currentUser']), + ...mapState({ + currentUser: (state) => state.users.currentUser, + }), }, } diff --git a/src/components/lists_timeline/lists_timeline.js b/src/components/lists_timeline/lists_timeline.js new file mode 100644 index 000000000..a06220a37 --- /dev/null +++ b/src/components/lists_timeline/lists_timeline.js @@ -0,0 +1,47 @@ +import Timeline from 'src/components/timeline/timeline.vue' + +import { useListsStore } from 'src/stores/lists.js' + +const ListsTimeline = { + data() { + return { + listId: null, + } + }, + components: { + Timeline, + }, + computed: { + timeline() { + return this.$store.state.statuses.timelines.list + }, + }, + watch: { + $route: function (route) { + if (route.name === 'lists-timeline' && route.params.id !== this.listId) { + this.listId = route.params.id + this.$store.dispatch('stopFetchingTimeline', 'list') + this.$store.commit('clearTimeline', { timeline: 'list' }) + useListsStore().fetchList({ listId: this.listId }) + this.$store.dispatch('startFetchingTimeline', { + timeline: 'list', + listId: this.listId, + }) + } + }, + }, + created() { + this.listId = this.$route.params.id + useListsStore().fetchList({ listId: this.listId }) + this.$store.dispatch('startFetchingTimeline', { + timeline: 'list', + listId: this.listId, + }) + }, + unmounted() { + this.$store.dispatch('stopFetchingTimeline', 'list') + this.$store.commit('clearTimeline', { timeline: 'list' }) + }, +} + +export default ListsTimeline diff --git a/src/components/lists_timeline/lists_timeline.vue b/src/components/lists_timeline/lists_timeline.vue new file mode 100644 index 000000000..18156b812 --- /dev/null +++ b/src/components/lists_timeline/lists_timeline.vue @@ -0,0 +1,10 @@ + + + diff --git a/src/components/lists_user_search/lists_user_search.js b/src/components/lists_user_search/lists_user_search.js index 5ac6e679a..aed3f1ce7 100644 --- a/src/components/lists_user_search/lists_user_search.js +++ b/src/components/lists_user_search/lists_user_search.js @@ -32,8 +32,8 @@ const ListsUserSearch = { this.loading = true this.$emit('loading') this.userIds = [] - this.useSearchStore() - .search({ + this.$store + .dispatch('search', { q: query, resolve: true, type: 'accounts', diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js index 374e62259..0309079e8 100644 --- a/src/components/mention_link/mention_link.js +++ b/src/components/mention_link/mention_link.js @@ -1,4 +1,5 @@ -import { mapState } from 'pinia' +import { mapState as mapPiniaState } from 'pinia' +import { mapState } from 'vuex' import UnicodeDomainIndicator from 'src/components/unicode_domain_indicator/unicode_domain_indicator.vue' import UserAvatar from 'src/components/user_avatar/user_avatar.vue' @@ -11,7 +12,6 @@ import { import { useInstanceStore } from 'src/stores/instance.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { useUserHighlightStore } from 'src/stores/user_highlight.js' -import { useUsersStore } from 'src/stores/users.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' @@ -75,7 +75,7 @@ const MentionLink = { }, computed: { user() { - return this.url && useUsersStore().findUserByUrl(this.url) + return this.url && this.$store?.getters.findUserByUrl(this.url) }, isYou() { // FIXME why user !== currentUser??? @@ -156,9 +156,11 @@ const MentionLink = { shouldFadeDomain() { return this.mergedConfig.mentionLinkFadeDomain }, - ...mapState(useMergedConfigStore, ['mergedConfig']), - ...mapState(useUserHighlightStore, ['highlight']), - ...mapState(useUsersStore, ['currentUser']), + ...mapPiniaState(useMergedConfigStore, ['mergedConfig']), + ...mapPiniaState(useUserHighlightStore, ['highlight']), + ...mapState({ + currentUser: (state) => state.users.currentUser, + }), }, } diff --git a/src/components/mention_link/mention_link.vue b/src/components/mention_link/mention_link.vue index 33f0d9db7..0452cad58 100644 --- a/src/components/mention_link/mention_link.vue +++ b/src/components/mention_link/mention_link.vue @@ -31,7 +31,7 @@ @ + + + + diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 163c0e9aa..4eb956f64 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -5,15 +5,13 @@ import NavigationPins from 'src/components/navigation/navigation_pins.vue' import GestureService from '../../services/gesture_service/gesture_service' import { countExtraNotifications, - unseenNotifications, + unseenNotificationsFromStore, } from '../../services/notification_utils/notification_utils' import { useAnnouncementsStore } from 'src/stores/announcements.js' import { useChatsStore } from 'src/stores/chats.js' import { useInstanceStore } from 'src/stores/instance.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' -import { useNotificationsStore } from 'src/stores/notifications.js' -import { useUsersStore } from 'src/stores/users.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -55,10 +53,11 @@ const MobileNav = { }, computed: { currentUser() { - return useUsersStore().currentUser + return this.$store.state.users.currentUser }, unseenNotifications() { - return unseenNotifications( + return unseenNotificationsFromStore( + this.$store, useMergedConfigStore().mergedConfig.notificationVisibility, useMergedConfigStore().mergedConfig.ignoreInactionableSeen, ) @@ -146,11 +145,11 @@ const MobileNav = { }, doLogout() { this.$router.replace('/main/public') - useUsersStore().logout() + this.$store.dispatch('logout') this.hideConfirmLogout() }, markNotificationsAsSeen() { - useNotificationsStore().markNotificationsAsSeen() + this.$store.dispatch('markNotificationsAsSeen') }, onScroll({ target: { scrollTop, clientHeight, scrollHeight } }) { this.notificationsAtTop = scrollTop > 0 diff --git a/src/components/mobile_post_status_button/mobile_post_status_button.js b/src/components/mobile_post_status_button/mobile_post_status_button.js index d137331c9..4969352f6 100644 --- a/src/components/mobile_post_status_button/mobile_post_status_button.js +++ b/src/components/mobile_post_status_button/mobile_post_status_button.js @@ -2,7 +2,6 @@ import { debounce } from 'lodash' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { usePostStatusStore } from 'src/stores/post_status.js' -import { useUsersStore } from 'src/stores/users.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faPen } from '@fortawesome/free-solid-svg-icons' @@ -35,7 +34,7 @@ const MobilePostStatusButton = { }, computed: { isLoggedIn() { - return useUsersStore().loggedIn + return !!this.$store.state.users.currentUser }, isHidden() { if (HIDDEN_FOR_PAGES.has(this.$route.name)) { diff --git a/src/components/moderation_tools/moderation_tools.js b/src/components/moderation_tools/moderation_tools.js index 9b948e306..ba13afc8b 100644 --- a/src/components/moderation_tools/moderation_tools.js +++ b/src/components/moderation_tools/moderation_tools.js @@ -5,7 +5,6 @@ import Popover from 'src/components/popover/popover.vue' import { useAdminSettingsStore } from 'src/stores/admin_settings.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' -import { useUsersStore } from 'src/stores/users.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faChevronDown } from '@fortawesome/free-solid-svg-icons' @@ -406,7 +405,7 @@ const ModerationTools = { ) }, isAdmin() { - return useUsersStore().currentUser.role === 'admin' + return this.$store.state.users.currentUser.role === 'admin' }, }, methods: { @@ -453,7 +452,7 @@ const ModerationTools = { }, privileged(privilege) { if (this.isAdmin) return true - return useUsersStore().currentUser.privileges.has(privilege) + return this.$store.state.users.currentUser.privileges.has(privilege) }, setTag(tag, value) { useAdminSettingsStore().setUsersTags({ @@ -517,7 +516,8 @@ const ModerationTools = { setOpen(value) { this.open = value }, - maybeShowConfirm({ group, name, action, value }) { + maybeShowConfirm(close, { group, name, action, value }) { + close() this.confirmDialogName = name this.confirmDialogGroup = group this.confirmDialogAction = () => action() diff --git a/src/components/moderation_tools/moderation_tools.vue b/src/components/moderation_tools/moderation_tools.vue index e3da1a84d..4da0be0ee 100644 --- a/src/components/moderation_tools/moderation_tools.vue +++ b/src/components/moderation_tools/moderation_tools.vue @@ -9,7 +9,7 @@ @show="setOpen(true)" @close="setOpen(false)" > -