mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Client: update urls (#9025)
* start to update urls * ability to unsubscribe from emails
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
span {{ $t('email') }}
|
span {{ $t('email') }}
|
||||||
th
|
th
|
||||||
span {{ $t('push') }}
|
span {{ $t('push') }}
|
||||||
tr(v-for='notification in notifications')
|
tr(v-for='notification in notificationsIds')
|
||||||
td
|
td
|
||||||
span {{ $t(notification) }}
|
span {{ $t(notification) }}
|
||||||
td
|
td
|
||||||
@@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'client/libs/store';
|
import { mapState } from 'client/libs/store';
|
||||||
|
import notificationsMixin from 'client/mixins/notifications';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [notificationsMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
notifications: [
|
notificationsIds: [
|
||||||
'newPM',
|
'newPM',
|
||||||
'wonChallenge',
|
'wonChallenge',
|
||||||
'giftedGems',
|
'giftedGems',
|
||||||
@@ -63,6 +65,28 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({user: 'user.data'}),
|
...mapState({user: 'user.data'}),
|
||||||
},
|
},
|
||||||
|
async mounted () {
|
||||||
|
// If ?unsubFrom param is passed with valid email type,
|
||||||
|
// automatically unsubscribe users from that email and
|
||||||
|
// show an alert
|
||||||
|
|
||||||
|
// A simple object to map the key stored in the db (user.preferences.emailNotification[key])
|
||||||
|
// to its string id but ONLY when the preferences' key and the string key don't match
|
||||||
|
const MAP_PREF_TO_EMAIL_STRING = {
|
||||||
|
importantAnnouncements: 'inactivityEmails',
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsubFrom = this.$route.query.unsubFrom;
|
||||||
|
|
||||||
|
if (unsubFrom) {
|
||||||
|
await this.$store.dispatch('user:set', {
|
||||||
|
[`preferences.emailNotifications.${unsubFrom}`]: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const emailTypeString = this.$t(MAP_PREF_TO_EMAIL_STRING[unsubFrom] || unsubFrom);
|
||||||
|
this.text(this.$t('correctlyUnsubscribedEmailType', {emailType: emailTypeString}));
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
set (preferenceType, notification) {
|
set (preferenceType, notification) {
|
||||||
let settings = {};
|
let settings = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user