diff --git a/index.html b/index.html index a2f928361..f279ed01a 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@ + diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 1b133a089..42cd14b0a 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -242,7 +242,8 @@ const resolveStaffAccounts = ({ store, accounts }) => { const getNodeInfo = async ({ store }) => { try { - const res = await preloadFetch('/nodeinfo/2.1.json') + let res = await preloadFetch('/nodeinfo/2.1.json') + if (!res.ok) res = await preloadFetch('/nodeinfo/2.0.json') if (res.ok) { const data = await res.json() const metadata = data.metadata diff --git a/src/components/announcement/announcement.js b/src/components/announcement/announcement.js index d1b8257d8..a1b20bf60 100644 --- a/src/components/announcement/announcement.js +++ b/src/components/announcement/announcement.js @@ -29,7 +29,7 @@ const Announcement = { currentUser: state => state.users.currentUser }), canEditAnnouncement () { - return this.currentUser && this.currentUser.privileges.includes('announcements_manage_announcements') + return this.currentUser && this.currentUser.privileges?.includes('announcements_manage_announcements') }, content () { return this.announcement.content diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js index fc441b908..458dca859 100644 --- a/src/components/interactions/interactions.js +++ b/src/components/interactions/interactions.js @@ -16,7 +16,7 @@ const Interactions = { return { allowFollowingMove: this.$store.state.users.currentUser.allow_following_move, filterMode: tabModeDict.mentions, - canSeeReports: this.$store.state.users.currentUser.privileges.includes('reports_manage_reports') + canSeeReports: this.$store.state.users.currentUser.privileges?.includes('reports_manage_reports') } }, methods: { diff --git a/src/components/moderation_tools/moderation_tools.js b/src/components/moderation_tools/moderation_tools.js index bd57a353a..a0c5884d4 100644 --- a/src/components/moderation_tools/moderation_tools.js +++ b/src/components/moderation_tools/moderation_tools.js @@ -59,7 +59,7 @@ const ModerationTools = { return this.tagsSet.has(tagName) }, privileged (privilege) { - return this.$store.state.users.currentUser.privileges.includes(privilege) + return this.$store.state.users.currentUser.privileges?.includes(privilege) }, toggleTag (tag) { const store = this.$store diff --git a/src/components/navigation/filter.js b/src/components/navigation/filter.js index 12ab9266e..8e5ace57b 100644 --- a/src/components/navigation/filter.js +++ b/src/components/navigation/filter.js @@ -19,11 +19,11 @@ export const getListEntries = store => store.allLists.map(list => ({ iconLetter: list.title[0] })) -export const getBookmarkFolderEntries = store => store.allFolders.map(folder => ({ +export const getBookmarkFolderEntries = store => store.allFolders ? store.allFolders.map(folder => ({ name: 'bookmark-folder-' + folder.id, routeObject: { name: 'bookmark-folder', params: { id: folder.id } }, labelRaw: folder.name, iconEmoji: folder.emoji, iconEmojiUrl: folder.emoji_url, iconLetter: folder.name[0] -})) +})) : [] diff --git a/src/components/settings_modal/tabs/notifications_tab.js b/src/components/settings_modal/tabs/notifications_tab.js index c53b5889d..76007773b 100644 --- a/src/components/settings_modal/tabs/notifications_tab.js +++ b/src/components/settings_modal/tabs/notifications_tab.js @@ -18,7 +18,7 @@ const NotificationsTab = { }, canReceiveReports () { if (!this.user) { return false } - return this.user.privileges.includes('reports_manage_reports') + return this.user.privileges?.includes('reports_manage_reports') }, ...SharedComputedObject() }, diff --git a/src/components/status_action_buttons/buttons_definitions.js b/src/components/status_action_buttons/buttons_definitions.js index bc1e45a98..4e07839a2 100644 --- a/src/components/status_action_buttons/buttons_definitions.js +++ b/src/components/status_action_buttons/buttons_definitions.js @@ -204,7 +204,7 @@ export const BUTTONS = [{ if ({ status, loggedIn, currentUser }) { return loggedIn && ( status.user.id === currentUser.id || - currentUser.privileges.includes('messages_delete') + currentUser.privileges?.includes('messages_delete') ) }, confirm: ({ getters }) => getters.mergedConfig.modalOnDelete, diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index be81b8ad5..634d48502 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -134,7 +134,10 @@ export default { }, showModerationMenu () { const privileges = this.loggedIn.privileges - return this.loggedIn.role === 'admin' || privileges.includes('users_manage_activation_state') || privileges.includes('users_delete') || privileges.includes('users_manage_tags') + return this.loggedIn.role === 'admin' || + privileges?.includes('users_manage_activation_state') || + privileges?.includes('users_delete')|| + privileges?.includes('users_manage_tags') }, hasNote () { return this.relationship.note diff --git a/src/modules/api.js b/src/modules/api.js index 69c8282b8..78f4e010c 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -281,6 +281,7 @@ const api = { // Bookmark folders startFetchingBookmarkFolders (store) { if (store.state.fetchers.bookmarkFolders) return + if (!store.rootState.instance.pleromaBookmarkFoldersAvailable) return const fetcher = store.state.backendInteractor.startFetchingBookmarkFolders({ store }) store.commit('addFetcher', { fetcherName: 'bookmarkFolders', fetcher }) }, diff --git a/src/modules/statuses.js b/src/modules/statuses.js index d08b3334c..8b09263e0 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -38,6 +38,7 @@ export const defaultState = () => ({ allStatusesObject: {}, conversationsObject: {}, maxId: 0, + scrobblesUnsupported: false, favorites: new Set(), timelines: { mentions: emptyTl(), @@ -112,8 +113,14 @@ const getLatestScrobble = (state, user) => { return } + if (state.scrobblesUnsupported) return + state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000 apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => { + if (scrobbles?.error?.status === 501) { + state.scrobblesUnsupported = true + } + if (scrobbles.length > 0) { user.latestScrobble = scrobbles[0] diff --git a/src/modules/users.js b/src/modules/users.js index 01936c716..c59c04dff 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -599,6 +599,7 @@ const users = { return new Promise((resolve, reject) => { const commit = store.commit const dispatch = store.dispatch + const rootState = store.rootState commit('beginLogin') store.rootState.api.backendInteractor.verifyCredentials(accessToken) .then((data) => { @@ -665,8 +666,10 @@ const users = { // Start fetching notifications dispatch('startFetchingNotifications') - // Start fetching chats - dispatch('startFetchingChats') + if (rootState.instance.pleromaChatMessagesAvailable) { + // Start fetching chats + dispatch('startFetchingChats') + } } dispatch('startFetchingLists') diff --git a/src/stores/announcements.js b/src/stores/announcements.js index 5ee279835..02b5b7cdd 100644 --- a/src/stores/announcements.js +++ b/src/stores/announcements.js @@ -25,7 +25,7 @@ export const useAnnouncementsStore = defineStore('announcements', { } const currentUser = window.vuex.state.users.currentUser - const isAdmin = currentUser && currentUser.privileges.includes('announcements_manage_announcements') + const isAdmin = currentUser && currentUser.privileges?.includes('announcements_manage_announcements') const getAnnouncements = async () => { if (!isAdmin) {