From 7f51ea369eb4ae1252fcba9a82438fd00471e874 Mon Sep 17 00:00:00 2001 From: tusooa Date: Fri, 18 Aug 2023 20:34:27 -0400 Subject: Make extra notification display customizable --- src/modules/config.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/modules/config.js') diff --git a/src/modules/config.js b/src/modules/config.js index 56f8cba5..dda3d221 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -117,6 +117,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 } -- cgit v1.2.3-70-g09d2 From e0b8ad9f141f418ab3d8ebc7a9e68bcb755c820a Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 9 Nov 2023 01:58:33 +0200 Subject: add initial structure for notification settings --- src/modules/config.js | 3 +++ src/services/sw/sw.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modules/config.js') diff --git a/src/modules/config.js b/src/modules/config.js index 56f8cba5..83d34fc9 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -65,6 +65,9 @@ export const defaultState = { chatMention: true, polls: true }, + notificationSettings: { + nativeNotifications: ['follows', 'mentions', 'followRequest', 'reports', 'chatMention', 'polls'] + }, webPushNotifications: false, muteWords: [], highlight: {}, diff --git a/src/services/sw/sw.js b/src/services/sw/sw.js index 7de490fe..2875d36e 100644 --- a/src/services/sw/sw.js +++ b/src/services/sw/sw.js @@ -87,7 +87,7 @@ export async function initServiceWorker () { await getOrCreateServiceWorker() navigator.serviceWorker.addEventListener('message', (event) => { console.log('SW MESSAGE', event) - // TODO actually act upon click (open drawer on mobile for now) + // TODO actually act upon click (open drawer on mobile, open chat/thread etc) }) } -- cgit v1.2.3-70-g09d2 From 2c9930bd5b5c1279e0890aeba673ad6b5ce2af18 Mon Sep 17 00:00:00 2001 From: NEETzsche Date: Thu, 9 Nov 2023 15:03:21 -0700 Subject: Display the latest scrobble under a user's name --- changelog.d/show-recent-scrobble.skip | 1 + src/components/settings_modal/tabs/filtering_tab.vue | 5 +++++ src/components/status/status.js | 12 ++++++++++-- src/components/status/status.vue | 20 +++++++++++++++++++- src/i18n/en.json | 1 + src/modules/config.js | 1 + src/modules/statuses.js | 17 +++++++++++++++++ src/services/api/api.service.js | 19 +++++++++++++++++++ 8 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 changelog.d/show-recent-scrobble.skip (limited to 'src/modules/config.js') diff --git a/changelog.d/show-recent-scrobble.skip b/changelog.d/show-recent-scrobble.skip new file mode 100644 index 00000000..9227de06 --- /dev/null +++ b/changelog.d/show-recent-scrobble.skip @@ -0,0 +1 @@ +Shows the most recent scrobble under each post when available diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue index 41d1b54f..89fdef1a 100644 --- a/src/components/settings_modal/tabs/filtering_tab.vue +++ b/src/components/settings_modal/tabs/filtering_tab.vue @@ -91,6 +91,11 @@ {{ $t('settings.hide_attachments_in_convo') }} +
  • + + {{ $t('settings.hide_scrobbles') }} + +
  • name.charAt(0).toUpperCase() + name.slice(1) @@ -415,6 +417,12 @@ const Status = { }, shouldDisplayQuote () { return this.quotedStatus && this.displayQuote + }, + scrobblePresent () { + return !this.mergedConfig.hideScrobbles && this.status.user.latestScrobble && this.status.user.latestScrobble.artist + }, + scrobble () { + return this.status.user.latestScrobble } }, methods: { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index c49a9e7b..ad625643 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -249,6 +249,25 @@
    +
    + + {{ scrobble.artist }} — {{ scrobble.title }} + + + + +
    +
    - ({ 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 diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index c6bca10b..f45e3958 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -107,6 +107,7 @@ const PLEROMA_ANNOUNCEMENTS_URL = '/api/v1/pleroma/admin/announcements' const PLEROMA_POST_ANNOUNCEMENT_URL = '/api/v1/pleroma/admin/announcements' const PLEROMA_EDIT_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}` const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}` +const PLEROMA_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles` const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config' const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions' @@ -1765,6 +1766,23 @@ const installFrontend = ({ credentials, payload }) => { }) } +const fetchScrobbles = ({ accountId, limit = 1 }) => { + let url = PLEROMA_SCROBBLES_URL(accountId) + const params = [['limit', limit]] + const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') + url += `?${queryString}` + return fetch(url, {}) + .then((response) => { + if (response.ok) { + return response.json() + } else { + return { + error: response + } + } + }) +} + const apiService = { verifyCredentials, fetchTimeline, @@ -1878,6 +1896,7 @@ const apiService = { postAnnouncement, editAnnouncement, deleteAnnouncement, + fetchScrobbles, adminFetchAnnouncements, fetchInstanceDBConfig, fetchInstanceConfigDescriptions, -- cgit v1.2.3-70-g09d2 From e3ee3eaccae6a9ece674d7d76db8e67da499d6c3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 19 Nov 2023 15:24:34 +0200 Subject: added some settings for notifications --- src/components/mobile_nav/mobile_nav.js | 9 ++++++-- src/components/mobile_nav/mobile_nav.vue | 11 ++++++++++ src/components/notifications/notifications.js | 25 +++++++++++++++++++--- src/components/notifications/notifications.vue | 2 +- .../settings_modal/tabs/notifications_tab.vue | 23 ++++++++++++++++++++ src/i18n/en.json | 5 +++++ src/modules/config.js | 5 ++++- src/modules/instance.js | 3 +++ 8 files changed, 76 insertions(+), 7 deletions(-) (limited to 'src/modules/config.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index b5325116..6f4e35e5 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -14,7 +14,8 @@ import { faBell, faBars, faArrowUp, - faMinus + faMinus, + faCheckDouble } from '@fortawesome/free-solid-svg-icons' library.add( @@ -22,7 +23,8 @@ library.add( faBell, faBars, faArrowUp, - faMinus + faMinus, + faCheckDouble ) const MobileNav = { @@ -67,6 +69,9 @@ const MobileNav = { shouldConfirmLogout () { return this.$store.getters.mergedConfig.modalOnLogout }, + closingDrawerMarksAsSeen () { + return this.$store.getters.mergedConfig.closingDrawerMarksAsSeen + }, ...mapGetters(['unreadChatCount']) }, methods: { diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index c2746abe..ecd8290a 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -66,6 +66,17 @@ /> +