@@ -125,6 +125,7 @@ export const USER_SETTINGS_FRAGMENT = gql`
|
||||
notificationBeforeEvent
|
||||
notificationPendingParticipation
|
||||
notificationPendingMembership
|
||||
groupNotifications
|
||||
location {
|
||||
range
|
||||
geohash
|
||||
@@ -154,6 +155,7 @@ export const SET_USER_SETTINGS = gql`
|
||||
$notificationBeforeEvent: Boolean
|
||||
$notificationPendingParticipation: NotificationPendingEnum
|
||||
$notificationPendingMembership: NotificationPendingEnum
|
||||
$groupNotifications: NotificationPendingEnum
|
||||
$location: LocationInput
|
||||
) {
|
||||
setUserSettings(
|
||||
@@ -163,6 +165,7 @@ export const SET_USER_SETTINGS = gql`
|
||||
notificationBeforeEvent: $notificationBeforeEvent
|
||||
notificationPendingParticipation: $notificationPendingParticipation
|
||||
notificationPendingMembership: $notificationPendingMembership
|
||||
groupNotifications: $groupNotifications
|
||||
location: $location
|
||||
) {
|
||||
...UserSettingFragment
|
||||
|
||||
@@ -1011,14 +1011,8 @@
|
||||
"Page not found": "Page not found",
|
||||
"{folder} - Resources": "{folder} - Resources",
|
||||
"General settings": "General settings",
|
||||
"Unsubscribe to WebPush": "Unsubscribe to WebPush",
|
||||
"WebPush": "WebPush",
|
||||
"You can't use webpush in this browser.": "You can't use webpush in this browser.",
|
||||
"Notify participants": "Notify participants",
|
||||
"Browser notifications": "Browser notifications",
|
||||
"Unsubscribe to browser notifications": "Unsubscribe to browser notifications",
|
||||
"Activate browser notification": "Activate browser notification",
|
||||
"You can't use notifications in this browser.": "You can't use notifications in this browser.",
|
||||
"Notification settings": "Notification settings",
|
||||
"Select the activities for which you wish to receive an email or a push notification.": "Select the activities for which you wish to receive an email or a push notification.",
|
||||
"Push": "Push",
|
||||
@@ -1054,5 +1048,12 @@
|
||||
"Join group {group}": "Join group {group}",
|
||||
"Public preview": "Public preview",
|
||||
"On {instance} and other federated instances": "On {instance} and other federated instances",
|
||||
"Error while subscribing to push notifications": "Error while subscribing to push notifications"
|
||||
"Error while subscribing to push notifications": "Error while subscribing to push notifications",
|
||||
"Unsubscribe to browser push notifications": "Unsubscribe to browser push notifications",
|
||||
"Activate browser push notifications": "Activate browser push notifications",
|
||||
"You can't use push notifications in this browser.": "You can't use push notifications in this browser.",
|
||||
"Send notification e-mails": "Send notification e-mails",
|
||||
"Announcements and mentions notifications are always sent straight away.": "Announcements and mentions notifications are always sent straight away.",
|
||||
"Weekly email summary": "Weekly email summary",
|
||||
"Receive one email for each activity": "Receive one email for each activity"
|
||||
}
|
||||
|
||||
@@ -967,7 +967,6 @@
|
||||
"We won’t change the world from Facebook. The tool we dream of, surveillance capitalism corporations won’t develop it, as they couldn’t profit from it. This is an opportunity to build something better, by taking another approach.": "No cambiaremos el mundo de Facebook. La herramienta con la que soñamos, las corporaciones de capitalismo de vigilancia no la desarrollarán ya que no podrían beneficiarse de ella. Esta es una oportunidad para construir algo mejor, adoptando otro enfoque.",
|
||||
"We'll send you an email one hour before the event begins, to be sure you won't forget about it.": "Le enviaremos un correo electrónico una hora antes de que comience el evento, para asegurarnos de que no lo olvide.",
|
||||
"We'll use your timezone settings to send a recap of the morning of the event.": "Usaremos la configuración de su zona horaria para enviarle un recordatorio la mañana del día evento.",
|
||||
"WebPush": "Webpush",
|
||||
"Website": "Sitio web",
|
||||
"Website / URL": "Sitio web / URL",
|
||||
"Welcome back {username}!": "¡Bienvenido de nuevo {username}!",
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
"Accessible through link": "Accessible uniquement par lien",
|
||||
"Account": "Compte",
|
||||
"Actions": "Actions",
|
||||
"Activate browser notification": "Activer les notifications du navigateur",
|
||||
"Activated": "Activé",
|
||||
"Active": "Actif·ive",
|
||||
"Activity": "Activité",
|
||||
@@ -77,7 +76,7 @@
|
||||
"An error has occurred.": "Une erreur est survenue.",
|
||||
"An ethical alternative": "Une alternative éthique",
|
||||
"An event I'm going to has been updated": "Un événement auquel je participe a été mis à jour",
|
||||
"An event I'm going to has posted an announcement": "Un événement auquel je participe a posté une mise à jour",
|
||||
"An event I'm going to has posted an announcement": "Un événement auquel je participe a posté une annonce",
|
||||
"An event I'm organizing has a new comment": "Un événement que j'organise a un nouveau commentaire",
|
||||
"An event I'm organizing has a new participation": "Un événement que j'organise a une nouvelle participation",
|
||||
"An event I'm organizing has a new pending participation": "Un événement que j'organise a une nouvelle participation en attente",
|
||||
@@ -858,8 +857,6 @@
|
||||
"Unknown value for the openness setting.": "Valeur inconnue pour le paramètre d'ouverture.",
|
||||
"Unsaved changes": "Modifications non enregistrées",
|
||||
"Unset group": "Déselectionner le groupe",
|
||||
"Unsubscribe to WebPush": "Se désinscrire de WebPush",
|
||||
"Unsubscribe to browser notifications": "Se désabonner des notifications du navigateur",
|
||||
"Unsuspend": "Annuler la suspension",
|
||||
"Upcoming": "À venir",
|
||||
"Upcoming events": "Événements à venir",
|
||||
@@ -901,7 +898,6 @@
|
||||
"We will redirect you to your instance in order to interact with this group": "Nous vous redirigerons vers votre instance afin que vous puissiez interagir avec ce groupe",
|
||||
"We'll send you an email one hour before the event begins, to be sure you won't forget about it.": "Nous vous enverrons un email une heure avant que l'événement débute, pour être sûr que vous ne l'oubliez pas.",
|
||||
"We'll use your timezone settings to send a recap of the morning of the event.": "Nous prendrons en compte votre fuseau horaire pour vous envoyer un récapitulatif de vos événements le matin.",
|
||||
"WebPush": "WebPush",
|
||||
"Website": "Site web",
|
||||
"Website / URL": "Site web / URL",
|
||||
"Welcome back {username}!": "Bon retour {username} !",
|
||||
@@ -935,8 +931,6 @@
|
||||
"You can't change your password because you are registered through {provider}.": "Vous ne pouvez pas changer votre mot de passe car vous vous êtes enregistré via {provider}.",
|
||||
"You can't remove your last identity.": "Vous ne pouvez pas supprimer votre dernière identité.",
|
||||
"You can't reset your password because you use a 3rd-party auth provider to login.": "Vous ne pouvez pas réinitialiser votre mot de passe car vous vous connectez via une méthode externe.",
|
||||
"You can't use notifications in this browser.": "Vous ne pouvez pas utiliser les notifications dans ce navigateur.",
|
||||
"You can't use webpush in this browser.": "Vous ne pouvez pas utiliser webpush dans ce navigateur.",
|
||||
"You changed your email or password": "Vous avez modifié votre email ou votre mot de passe",
|
||||
"You created the discussion {discussion}.": "Vous avez créé la discussion {discussion}.",
|
||||
"You created the event {event}.": "Vous avez créé l'événement {event}.",
|
||||
@@ -1145,5 +1139,12 @@
|
||||
"Join group {group}": "Rejoindre le groupe {group}",
|
||||
"Public preview": "Aperçu public",
|
||||
"On {instance} and other federated instances": "Sur {instance} et d'autres instances fédérées",
|
||||
"Error while subscribing to push notifications": "Erreur lors de la souscriptions aux notifications push"
|
||||
"Error while subscribing to push notifications": "Erreur lors de la souscriptions aux notifications push",
|
||||
"Unsubscribe to browser push notifications": "Se désinscrire des notifications push du navigateur",
|
||||
"Activate browser push notifications": "Activer les notifications push du navigateur",
|
||||
"You can't use push notifications in this browser.": "Vous ne pouvez pas utiliser les notifications push dans ce navigateur.",
|
||||
"Send notification e-mails": "Envoyer des e-mails de notification",
|
||||
"Announcements and mentions notifications are always sent straight away.": "Les notifications d'annonces et de mentions sont toujours envoyées directement.",
|
||||
"Weekly email summary": "Résumé hebdomadaire par e-mail",
|
||||
"Receive one email for each activity": "Recevoir un e-mail à chaque activité"
|
||||
}
|
||||
|
||||
@@ -893,7 +893,6 @@
|
||||
"We will redirect you to your instance in order to interact with this group": "Ímoste reenviar á túa instancia para que poidas interactuar con este grupo",
|
||||
"We'll send you an email one hour before the event begins, to be sure you won't forget about it.": "Enviarémosche un email unha hora antes do comezo do evento, para que non o esquezas.",
|
||||
"We'll use your timezone settings to send a recap of the morning of the event.": "Usaremos os axustes de zona horaria para enviar un recordatorio na mañán do evento.",
|
||||
"WebPush": "WebPush",
|
||||
"Website": "Sitio web",
|
||||
"Website / URL": "Sitio web / URL",
|
||||
"Welcome back {username}!": "Benvida {username}!",
|
||||
|
||||
@@ -834,7 +834,6 @@
|
||||
"We will redirect you to your instance in order to interact with this group": "Мы перенаправим вас на ваш узел, чтобы вы могли взаимодействовать с этой группой",
|
||||
"We'll send you an email one hour before the event begins, to be sure you won't forget about it.": "Мы отправим вам электронное письмо за час до начала мероприятия, чтобы вы не забыли про него.",
|
||||
"We'll use your timezone settings to send a recap of the morning of the event.": "Мы используем настройки вашего часового пояса, чтобы утром отправить вам напоминание о мероприятии.",
|
||||
"WebPush": "WebPush уведомления",
|
||||
"Website": "Веб-сайт",
|
||||
"Website / URL": "Веб-сайт / URL",
|
||||
"Welcome back {username}!": "С возвращением, {username}!",
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface IUserSettings {
|
||||
notificationBeforeEvent?: boolean;
|
||||
notificationPendingParticipation?: INotificationPendingEnum;
|
||||
notificationPendingMembership?: INotificationPendingEnum;
|
||||
groupNotifications?: INotificationPendingEnum;
|
||||
location?: IUserPreferredLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export enum INotificationPendingEnum {
|
||||
DIRECT = "DIRECT",
|
||||
ONE_DAY = "ONE_DAY",
|
||||
ONE_HOUR = "ONE_HOUR",
|
||||
ONE_WEEK = "ONE_WEEK",
|
||||
}
|
||||
|
||||
export enum IAuthProvider {
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
<h2>{{ $t("Browser notifications") }}</h2>
|
||||
</div>
|
||||
<b-button v-if="subscribed" @click="unsubscribeToWebPush()">{{
|
||||
$t("Unsubscribe to browser notifications")
|
||||
$t("Unsubscribe to browser push notifications")
|
||||
}}</b-button>
|
||||
<b-button
|
||||
icon-left="rss"
|
||||
@click="subscribeToWebPush"
|
||||
v-else-if="canShowWebPush()"
|
||||
>{{ $t("Activate browser notification") }}</b-button
|
||||
v-else-if="canShowWebPush"
|
||||
>{{ $t("Activate browser push notifications") }}</b-button
|
||||
>
|
||||
<span v-else>{{
|
||||
$t("You can't use notifications in this browser.")
|
||||
$t("You can't use push notifications in this browser.")
|
||||
}}</span>
|
||||
</section>
|
||||
<section>
|
||||
@@ -71,6 +71,28 @@
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<b-field
|
||||
:label="$t('Send notification e-mails')"
|
||||
:message="
|
||||
$t(
|
||||
'Announcements and mentions notifications are always sent straight away.'
|
||||
)
|
||||
"
|
||||
>
|
||||
<b-select
|
||||
v-model="groupNotifications"
|
||||
@input="updateSetting({ groupNotifications })"
|
||||
>
|
||||
<option
|
||||
v-for="(value, key) in groupNotificationsValues"
|
||||
:value="key"
|
||||
:key="key"
|
||||
>
|
||||
{{ value }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
</section>
|
||||
<section>
|
||||
<div class="setting-title">
|
||||
@@ -305,7 +327,11 @@ export default class Notifications extends Vue {
|
||||
notificationPendingParticipation: INotificationPendingEnum | undefined =
|
||||
INotificationPendingEnum.NONE;
|
||||
|
||||
groupNotifications: INotificationPendingEnum | undefined =
|
||||
INotificationPendingEnum.ONE_DAY;
|
||||
|
||||
notificationPendingParticipationValues: Record<string, unknown> = {};
|
||||
groupNotificationsValues: Record<string, unknown> = {};
|
||||
|
||||
RouteName = RouteName;
|
||||
|
||||
@@ -313,6 +339,8 @@ export default class Notifications extends Vue {
|
||||
|
||||
subscribed = false;
|
||||
|
||||
canShowWebPush = false;
|
||||
|
||||
notificationMethods = {
|
||||
email: this.$t("Email") as string,
|
||||
push: this.$t("Push") as string,
|
||||
@@ -508,7 +536,7 @@ export default class Notifications extends Vue {
|
||||
return merge(this.defaultNotificationValues, this.userNotificationValues);
|
||||
}
|
||||
|
||||
mounted(): void {
|
||||
async mounted(): Promise<void> {
|
||||
this.notificationPendingParticipationValues = {
|
||||
[INotificationPendingEnum.NONE]: this.$t("Do not receive any mail"),
|
||||
[INotificationPendingEnum.DIRECT]: this.$t(
|
||||
@@ -516,7 +544,18 @@ export default class Notifications extends Vue {
|
||||
),
|
||||
[INotificationPendingEnum.ONE_HOUR]: this.$t("Hourly email summary"),
|
||||
[INotificationPendingEnum.ONE_DAY]: this.$t("Daily email summary"),
|
||||
[INotificationPendingEnum.ONE_WEEK]: this.$t("Weekly email summary"),
|
||||
};
|
||||
this.groupNotificationsValues = {
|
||||
[INotificationPendingEnum.NONE]: this.$t("Do not receive any mail"),
|
||||
[INotificationPendingEnum.DIRECT]: this.$t(
|
||||
"Receive one email for each activity"
|
||||
),
|
||||
[INotificationPendingEnum.ONE_HOUR]: this.$t("Hourly email summary"),
|
||||
[INotificationPendingEnum.ONE_DAY]: this.$t("Daily email summary"),
|
||||
[INotificationPendingEnum.ONE_WEEK]: this.$t("Weekly email summary"),
|
||||
};
|
||||
this.canShowWebPush = await this.checkCanShowWebPush();
|
||||
}
|
||||
|
||||
@Watch("loggedUser")
|
||||
@@ -528,6 +567,7 @@ export default class Notifications extends Vue {
|
||||
this.loggedUser.settings.notificationBeforeEvent;
|
||||
this.notificationPendingParticipation =
|
||||
this.loggedUser.settings.notificationPendingParticipation;
|
||||
this.groupNotifications = this.loggedUser.settings.groupNotifications;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +622,7 @@ export default class Notifications extends Vue {
|
||||
|
||||
async subscribeToWebPush(): Promise<void> {
|
||||
try {
|
||||
if (this.canShowWebPush()) {
|
||||
if (this.canShowWebPush) {
|
||||
const subscription = await subscribeUserToPush();
|
||||
if (subscription) {
|
||||
const subscriptionJSON = subscription?.toJSON();
|
||||
@@ -628,8 +668,12 @@ export default class Notifications extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
canShowWebPush(): boolean {
|
||||
return window.isSecureContext && !!navigator.serviceWorker;
|
||||
async checkCanShowWebPush(): Promise<boolean> {
|
||||
if (!window.isSecureContext && !("serviceWorker" in navigator))
|
||||
return Promise.resolve(false);
|
||||
const registration = await navigator.serviceWorker.getRegistration();
|
||||
console.log("registration", registration);
|
||||
return registration !== undefined;
|
||||
}
|
||||
|
||||
async created(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user