-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12010 from owncloud/feat/add-notifications-settings
feat: add notifications settings
- Loading branch information
Showing
9 changed files
with
502 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Enhancement: Add notifications settings | ||
|
||
We've added a new notifications settings section into the account screen. This section allows users to configure what notifications they wish to receive either in-app or via email, when to receive email notifications, and drops the previous notifications toggle. | ||
|
||
https://github.com/owncloud/web/pull/12010 | ||
https://github.com/owncloud/web/issues/9248 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/web-runtime/src/composables/notificationsSettings/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './useNotificationsSettings' |
65 changes: 65 additions & 0 deletions
65
packages/web-runtime/src/composables/notificationsSettings/useNotificationsSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { computed, Ref, unref } from 'vue' | ||
import { | ||
getSettingsValue, | ||
SETTINGS_EMAIL_NOTIFICATION_BUNDLE_IDS, | ||
SETTINGS_NOTIFICATION_BUNDLE_IDS, | ||
SettingsBundle, | ||
SettingsValue | ||
} from '../../helpers/settings' | ||
|
||
export const useNotificationsSettings = ( | ||
valueList: Ref<SettingsValue[]>, | ||
bundle: Ref<SettingsBundle> | ||
) => { | ||
const values = computed(() => { | ||
if (!unref(bundle)) { | ||
return {} | ||
} | ||
|
||
return unref(bundle).settings.reduce((acc, curr) => { | ||
if (!SETTINGS_NOTIFICATION_BUNDLE_IDS.includes(curr.id)) { | ||
return acc | ||
} | ||
|
||
acc[curr.id] = getSettingsValue(curr, unref(valueList)) | ||
|
||
return acc | ||
}, {}) | ||
}) | ||
|
||
const options = computed<SettingsBundle['settings']>(() => { | ||
if (!unref(bundle)) { | ||
return [] | ||
} | ||
|
||
return unref(bundle).settings.filter(({ id }) => SETTINGS_NOTIFICATION_BUNDLE_IDS.includes(id)) | ||
}) | ||
|
||
const emailOptions = computed<SettingsBundle['settings']>(() => { | ||
if (!unref(bundle)) { | ||
return [] | ||
} | ||
|
||
return unref(bundle).settings.filter(({ id }) => | ||
SETTINGS_EMAIL_NOTIFICATION_BUNDLE_IDS.includes(id) | ||
) | ||
}) | ||
|
||
const emailValues = computed(() => { | ||
if (!unref(bundle)) { | ||
return {} | ||
} | ||
|
||
return unref(bundle).settings.reduce((acc, curr) => { | ||
if (!SETTINGS_EMAIL_NOTIFICATION_BUNDLE_IDS.includes(curr.id)) { | ||
return acc | ||
} | ||
|
||
acc[curr.id] = getSettingsValue(curr, unref(valueList)) | ||
|
||
return acc | ||
}, {}) | ||
}) | ||
|
||
return { values, options, emailOptions, emailValues } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.