diff --git a/js/src/types/current-user.model.ts b/js/src/types/current-user.model.ts
index 5af6b016..ca752b06 100644
--- a/js/src/types/current-user.model.ts
+++ b/js/src/types/current-user.model.ts
@@ -29,9 +29,11 @@ export interface IUserSettings {
location?: IUserPreferredLocation;
}
+export type IActivitySettingMethod = "email" | "push";
+
export interface IActivitySetting {
key: string;
- method: string;
+ method: IActivitySettingMethod;
enabled: boolean;
}
diff --git a/js/src/views/Settings/Notifications.vue b/js/src/views/Settings/Notifications.vue
index 805e8bc8..1ce76667 100644
--- a/js/src/views/Settings/Notifications.vue
+++ b/js/src/views/Settings/Notifications.vue
@@ -66,14 +66,14 @@
updateNotificationValue(subType.id, key, e)"
- :disabled="notificationValues[subType.id].disabled"
+ :disabled="notificationValues[subType.id][key].disabled"
/>
|
@@ -291,7 +291,7 @@ import {
USER_NOTIFICATIONS,
UPDATE_ACTIVITY_SETTING,
} from "../../graphql/user";
-import { IUser } from "../../types/current-user.model";
+import { IActivitySettingMethod, IUser } from "../../types/current-user.model";
import RouteName from "../../router/name";
import { IFeedToken } from "@/types/feedtoken.model";
import { CREATE_FEED_TOKEN, DELETE_FEED_TOKEN } from "@/graphql/feed_tokens";
@@ -367,70 +367,68 @@ export default class Notifications extends Vue {
defaultNotificationValues = {
participation_event_updated: {
- email: true,
- push: true,
- disabled: true,
+ email: { enabled: true, disabled: true },
+ push: { enabled: true, disabled: true },
},
participation_event_comment: {
- email: true,
- push: true,
+ email: { enabled: true, disabled: false },
+ push: { enabled: true, disabled: false },
},
event_new_pending_participation: {
- email: true,
- push: true,
+ email: { enabled: true, disabled: false },
+ push: { enabled: true, disabled: false },
},
event_new_participation: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
event_created: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
event_updated: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
discussion_updated: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
post_published: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
post_updated: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
resource_updated: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
member_request: {
- email: true,
- push: true,
+ email: { enabled: true, disabled: false },
+ push: { enabled: true, disabled: false },
},
member_updated: {
- email: false,
- push: false,
+ email: { enabled: false, disabled: false },
+ push: { enabled: false, disabled: false },
},
user_email_password_updated: {
- email: true,
- push: false,
- disabled: true,
+ email: { enabled: true, disabled: true },
+ push: { enabled: false, disabled: true },
},
event_comment_mention: {
- email: true,
- push: true,
+ email: { enabled: true, disabled: false },
+ push: { enabled: true, disabled: false },
},
discussion_mention: {
- email: true,
- push: false,
+ email: { enabled: true, disabled: false },
+ push: { enabled: false, disabled: false },
},
event_new_comment: {
- email: true,
- push: false,
+ email: { enabled: true, disabled: false },
+ push: { enabled: false, disabled: false },
},
};
@@ -542,17 +540,34 @@ export default class Notifications extends Vue {
},
];
- get userNotificationValues(): Record> {
+ get userNotificationValues(): Record<
+ string,
+ Record
+ > {
return this.loggedUser.activitySettings.reduce((acc, activitySetting) => {
acc[activitySetting.key] = acc[activitySetting.key] || {};
acc[activitySetting.key][activitySetting.method] =
+ acc[activitySetting.key][activitySetting.method] || {};
+ acc[activitySetting.key][activitySetting.method].enabled =
activitySetting.enabled;
return acc;
- }, {} as Record>);
+ }, {} as Record>);
}
- get notificationValues(): Record> {
- return merge(this.defaultNotificationValues, this.userNotificationValues);
+ get notificationValues(): Record<
+ string,
+ Record
+ > {
+ const values = merge(
+ this.defaultNotificationValues,
+ this.userNotificationValues
+ );
+ for (const value in values) {
+ if (!this.canShowWebPush) {
+ values[value].push.disabled = true;
+ }
+ }
+ return values;
}
async mounted(): Promise {
|