Merge remote-tracking branch 'origin/develop' into notifications-thru-sw
This commit is contained in:
commit
c059f4a7ee
57 changed files with 1296 additions and 86 deletions
|
|
@ -40,6 +40,7 @@ export const defaultState = {
|
|||
padEmoji: true,
|
||||
hideAttachments: false,
|
||||
hideAttachmentsInConv: false,
|
||||
hideScrobbles: false,
|
||||
maxThumbnails: 16,
|
||||
hideNsfw: true,
|
||||
preloadImage: true,
|
||||
|
|
@ -120,6 +121,11 @@ export const defaultState = {
|
|||
conversationTreeAdvanced: undefined, // instance default
|
||||
conversationOtherRepliesButton: undefined, // instance default
|
||||
conversationTreeFadeAncestors: undefined, // instance default
|
||||
showExtraNotifications: undefined, // instance default
|
||||
showExtraNotificationsTip: undefined, // instance default
|
||||
showChatsInExtraNotifications: undefined, // instance default
|
||||
showAnnouncementsInExtraNotifications: undefined, // instance default
|
||||
showFollowRequestsInExtraNotifications: undefined, // instance default
|
||||
maxDepthInThread: undefined, // instance default
|
||||
autocompleteSelect: undefined // instance default
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,11 @@ const defaultState = {
|
|||
conversationTreeAdvanced: false,
|
||||
conversationOtherRepliesButton: 'below',
|
||||
conversationTreeFadeAncestors: false,
|
||||
showExtraNotifications: true,
|
||||
showExtraNotificationsTip: true,
|
||||
showChatsInExtraNotifications: true,
|
||||
showAnnouncementsInExtraNotifications: true,
|
||||
showFollowRequestsInExtraNotifications: true,
|
||||
maxDepthInThread: 6,
|
||||
autocompleteSelect: false,
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const emptyNotifications = () => ({
|
|||
|
||||
export const defaultState = () => ({
|
||||
allStatuses: [],
|
||||
scrobblesNextFetch: {},
|
||||
allStatusesObject: {},
|
||||
conversationsObject: {},
|
||||
maxId: 0,
|
||||
|
|
@ -120,8 +121,24 @@ const sortTimeline = (timeline) => {
|
|||
return timeline
|
||||
}
|
||||
|
||||
const getLatestScrobble = (state, user) => {
|
||||
if (state.scrobblesNextFetch[user.id] && state.scrobblesNextFetch[user.id] > Date.now()) {
|
||||
return
|
||||
}
|
||||
|
||||
state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000
|
||||
apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => {
|
||||
if (scrobbles.length > 0) {
|
||||
user.latestScrobble = scrobbles[0]
|
||||
|
||||
state.scrobblesNextFetch[user.id] = Date.now() + 60 * 1000
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Add status to the global storages (arrays and objects maintaining statuses) except timelines
|
||||
const addStatusToGlobalStorage = (state, data) => {
|
||||
getLatestScrobble(state, data.user)
|
||||
const result = mergeOrAdd(state.allStatuses, state.allStatusesObject, data)
|
||||
if (result.new) {
|
||||
// Add to conversation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue