Merge remote-tracking branch 'origin/develop' into settings-changed
* origin/develop: (306 commits) fallback if shadows aren't defined Translated using Weblate (Chinese (Traditional)) Translated using Weblate (Ukrainian) Translated using Weblate (Italian) Translated using Weblate (Ukrainian) Translated using Weblate (Portuguese) Translated using Weblate (Italian) Translated using Weblate (Russian) Translated using Weblate (Portuguese) Translated using Weblate (Russian) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) Translated using Weblate (Portuguese) ...
This commit is contained in:
commit
8958f386be
222 changed files with 11463 additions and 4132 deletions
|
@ -75,12 +75,18 @@ const api = {
|
|||
} else if (message.event === 'delete') {
|
||||
dispatch('deleteStatusById', message.id)
|
||||
} else if (message.event === 'pleroma:chat_update') {
|
||||
dispatch('addChatMessages', {
|
||||
chatId: message.chatUpdate.id,
|
||||
messages: [message.chatUpdate.lastMessage]
|
||||
})
|
||||
dispatch('updateChat', { chat: message.chatUpdate })
|
||||
maybeShowChatNotification(store, message.chatUpdate)
|
||||
// The setTimeout wrapper is a temporary band-aid to avoid duplicates for the user's own messages when doing optimistic sending.
|
||||
// The cause of the duplicates is the WS event arriving earlier than the HTTP response.
|
||||
// This setTimeout wrapper can be removed once the commit `8e41baff` is in the stable Pleroma release.
|
||||
// (`8e41baff` adds the idempotency key to the chat message entity, which PleromaFE uses when it's available, and it makes this artificial delay unnecessary).
|
||||
setTimeout(() => {
|
||||
dispatch('addChatMessages', {
|
||||
chatId: message.chatUpdate.id,
|
||||
messages: [message.chatUpdate.lastMessage]
|
||||
})
|
||||
dispatch('updateChat', { chat: message.chatUpdate })
|
||||
maybeShowChatNotification(store, message.chatUpdate)
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -16,7 +16,8 @@ const defaultState = {
|
|||
openedChats: {},
|
||||
openedChatMessageServices: {},
|
||||
fetcher: undefined,
|
||||
currentChatId: null
|
||||
currentChatId: null,
|
||||
lastReadMessageId: null
|
||||
}
|
||||
|
||||
const getChatById = (state, id) => {
|
||||
|
@ -92,9 +93,14 @@ const chats = {
|
|||
commit('setCurrentChatFetcher', { fetcher: undefined })
|
||||
},
|
||||
readChat ({ rootState, commit, dispatch }, { id, lastReadId }) {
|
||||
const isNewMessage = rootState.chats.lastReadMessageId !== lastReadId
|
||||
|
||||
dispatch('resetChatNewMessageCount')
|
||||
commit('readChat', { id })
|
||||
rootState.api.backendInteractor.readChat({ id, lastReadId })
|
||||
commit('readChat', { id, lastReadId })
|
||||
|
||||
if (isNewMessage) {
|
||||
rootState.api.backendInteractor.readChat({ id, lastReadId })
|
||||
}
|
||||
},
|
||||
deleteChatMessage ({ rootState, commit }, value) {
|
||||
rootState.api.backendInteractor.deleteChatMessage(value)
|
||||
|
@ -106,6 +112,9 @@ const chats = {
|
|||
},
|
||||
clearOpenedChats ({ rootState, commit, dispatch, rootGetters }) {
|
||||
commit('clearOpenedChats', { commit })
|
||||
},
|
||||
handleMessageError ({ commit }, value) {
|
||||
commit('handleMessageError', { commit, ...value })
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
@ -208,11 +217,16 @@ const chats = {
|
|||
}
|
||||
}
|
||||
},
|
||||
readChat (state, { id }) {
|
||||
readChat (state, { id, lastReadId }) {
|
||||
state.lastReadMessageId = lastReadId
|
||||
const chat = getChatById(state, id)
|
||||
if (chat) {
|
||||
chat.unread = 0
|
||||
}
|
||||
},
|
||||
handleMessageError (state, { chatId, fakeId, isRetry }) {
|
||||
const chatMessageService = state.openedChatMessageServices[chatId]
|
||||
chatService.handleMessageError(chatMessageService, fakeId, isRetry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ export const defaultState = {
|
|||
customTheme: undefined,
|
||||
customThemeSource: undefined,
|
||||
hideISP: false,
|
||||
hideInstanceWallpaper: false,
|
||||
// bad name: actually hides posts of muted USERS
|
||||
hideMutedPosts: undefined, // instance default
|
||||
collapseMessageWithSubject: undefined, // instance default
|
||||
|
|
|
@ -27,9 +27,10 @@ const defaultState = {
|
|||
hideSitename: false,
|
||||
hideUserStats: false,
|
||||
loginMethod: 'password',
|
||||
logo: '/static/logo.png',
|
||||
logo: '/static/logo.svg',
|
||||
logoMargin: '.2em',
|
||||
logoMask: true,
|
||||
logoLeft: false,
|
||||
minimalScopesMode: false,
|
||||
nsfwCensorImage: undefined,
|
||||
postContentType: 'text/plain',
|
||||
|
@ -126,7 +127,7 @@ const instance = {
|
|||
imageUrl: false,
|
||||
replacement: values[key]
|
||||
}
|
||||
}).sort((a, b) => a.displayText - b.displayText)
|
||||
}).sort((a, b) => a.name > b.name ? 1 : -1)
|
||||
commit('setInstanceOption', { name: 'emoji', value: emoji })
|
||||
} else {
|
||||
throw (res)
|
||||
|
@ -153,7 +154,7 @@ const instance = {
|
|||
}
|
||||
// Technically could use tags but those are kinda useless right now,
|
||||
// should have been "pack" field, that would be more useful
|
||||
}).sort((a, b) => a.displayText.toLowerCase() > b.displayText.toLowerCase() ? 1 : 0)
|
||||
}).sort((a, b) => a.displayText.toLowerCase() > b.displayText.toLowerCase() ? 1 : -1)
|
||||
commit('setInstanceOption', { name: 'customEmoji', value: emoji })
|
||||
} else {
|
||||
throw (res)
|
||||
|
|
|
@ -4,12 +4,14 @@ const reports = {
|
|||
state: {
|
||||
userId: null,
|
||||
statuses: [],
|
||||
preTickedIds: [],
|
||||
modalActivated: false
|
||||
},
|
||||
mutations: {
|
||||
openUserReportingModal (state, { userId, statuses }) {
|
||||
openUserReportingModal (state, { userId, statuses, preTickedIds }) {
|
||||
state.userId = userId
|
||||
state.statuses = statuses
|
||||
state.preTickedIds = preTickedIds
|
||||
state.modalActivated = true
|
||||
},
|
||||
closeUserReportingModal (state) {
|
||||
|
@ -17,9 +19,15 @@ const reports = {
|
|||
}
|
||||
},
|
||||
actions: {
|
||||
openUserReportingModal ({ rootState, commit }, userId) {
|
||||
const statuses = filter(rootState.statuses.allStatuses, status => status.user.id === userId)
|
||||
commit('openUserReportingModal', { userId, statuses })
|
||||
openUserReportingModal ({ rootState, commit }, { userId, statusIds = [] }) {
|
||||
const preTickedStatuses = statusIds.map(id => rootState.statuses.allStatusesObject[id])
|
||||
const preTickedIds = statusIds
|
||||
const statuses = preTickedStatuses.concat(
|
||||
filter(rootState.statuses.allStatuses,
|
||||
status => status.user.id === userId && !preTickedIds.includes(status.id)
|
||||
)
|
||||
)
|
||||
commit('openUserReportingModal', { userId, statuses, preTickedIds })
|
||||
},
|
||||
closeUserReportingModal ({ commit }) {
|
||||
commit('closeUserReportingModal')
|
||||
|
|
|
@ -39,8 +39,7 @@ const emptyNotifications = () => ({
|
|||
minId: Number.POSITIVE_INFINITY,
|
||||
data: [],
|
||||
idStore: {},
|
||||
loading: false,
|
||||
error: false
|
||||
loading: false
|
||||
})
|
||||
|
||||
export const defaultState = () => ({
|
||||
|
@ -50,8 +49,6 @@ export const defaultState = () => ({
|
|||
maxId: 0,
|
||||
notifications: emptyNotifications(),
|
||||
favorites: new Set(),
|
||||
error: false,
|
||||
errorData: null,
|
||||
timelines: {
|
||||
mentions: emptyTl(),
|
||||
public: emptyTl(),
|
||||
|
@ -462,18 +459,9 @@ export const mutations = {
|
|||
const newStatus = state.allStatusesObject[id]
|
||||
newStatus.nsfw = nsfw
|
||||
},
|
||||
setError (state, { value }) {
|
||||
state.error = value
|
||||
},
|
||||
setErrorData (state, { value }) {
|
||||
state.errorData = value
|
||||
},
|
||||
setNotificationsLoading (state, { value }) {
|
||||
state.notifications.loading = value
|
||||
},
|
||||
setNotificationsError (state, { value }) {
|
||||
state.notifications.error = value
|
||||
},
|
||||
setNotificationsSilence (state, { value }) {
|
||||
state.notifications.desktopNotificationSilence = value
|
||||
},
|
||||
|
@ -588,18 +576,9 @@ const statuses = {
|
|||
}
|
||||
commit('addNewNotifications', { dispatch, notifications, older, rootGetters, newNotificationSideEffects })
|
||||
},
|
||||
setError ({ rootState, commit }, { value }) {
|
||||
commit('setError', { value })
|
||||
},
|
||||
setErrorData ({ rootState, commit }, { value }) {
|
||||
commit('setErrorData', { value })
|
||||
},
|
||||
setNotificationsLoading ({ rootState, commit }, { value }) {
|
||||
commit('setNotificationsLoading', { value })
|
||||
},
|
||||
setNotificationsError ({ rootState, commit }, { value }) {
|
||||
commit('setNotificationsError', { value })
|
||||
},
|
||||
setNotificationsSilence ({ rootState, commit }, { value }) {
|
||||
commit('setNotificationsSilence', { value })
|
||||
},
|
||||
|
|
|
@ -137,11 +137,11 @@ export const mutations = {
|
|||
},
|
||||
saveFriendIds (state, { id, friendIds }) {
|
||||
const user = state.usersObject[id]
|
||||
user.friendIds = uniq(concat(user.friendIds, friendIds))
|
||||
user.friendIds = uniq(concat(user.friendIds || [], friendIds))
|
||||
},
|
||||
saveFollowerIds (state, { id, followerIds }) {
|
||||
const user = state.usersObject[id]
|
||||
user.followerIds = uniq(concat(user.followerIds, followerIds))
|
||||
user.followerIds = uniq(concat(user.followerIds || [], followerIds))
|
||||
},
|
||||
// Because frontend doesn't have a reason to keep these stuff in memory
|
||||
// outside of viewing someones user profile.
|
||||
|
@ -202,7 +202,9 @@ export const mutations = {
|
|||
},
|
||||
setPinnedToUser (state, status) {
|
||||
const user = state.usersObject[status.user.id]
|
||||
user.pinnedStatusIds = user.pinnedStatusIds || []
|
||||
const index = user.pinnedStatusIds.indexOf(status.id)
|
||||
|
||||
if (status.pinned && index === -1) {
|
||||
user.pinnedStatusIds.push(status.id)
|
||||
} else if (!status.pinned && index !== -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue