diff options
| author | Henry Jameson <me@hjkos.com> | 2023-11-13 17:26:53 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-11-13 17:26:53 +0200 |
| commit | c059f4a7ee16c0128c348c43c9d468e7cfdb5ef7 (patch) | |
| tree | 12e816bd639f1ef6fa531c0df602e115b2a99ca7 /src/modules | |
| parent | e0b8ad9f141f418ab3d8ebc7a9e68bcb755c820a (diff) | |
| parent | 18c0cf1845a95db2d0e894d2455cdd4dc545aaf7 (diff) | |
Merge remote-tracking branch 'origin/develop' into notifications-thru-sw
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/config.js | 6 | ||||
| -rw-r--r-- | src/modules/instance.js | 5 | ||||
| -rw-r--r-- | src/modules/statuses.js | 17 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/modules/config.js b/src/modules/config.js index 83d34fc9..05c15998 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -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 } diff --git a/src/modules/instance.js b/src/modules/instance.js index 1ee64552..034348ff 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -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, diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 186bba3c..9b4cd175 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -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 |
