Skip to content

Commit

Permalink
Show owner name and email when accessing a locked private session (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinejaussoin authored Jul 18, 2023
1 parent 1a53390 commit ba8efaf
Show file tree
Hide file tree
Showing 26 changed files with 142 additions and 125 deletions.
6 changes: 4 additions & 2 deletions backend/src/common/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
StripeLocales,
AccessErrorType,
CoachMessage,
Session,
} from './types.js';

export interface RegisterPayload {
Expand Down Expand Up @@ -49,9 +50,10 @@ export interface CreateSessionPayload {
encryptedCheck?: string;
}

export interface UnauthorizedAccessPayload {
export type UnauthorizedAccessPayload = {
type?: AccessErrorType;
}
session?: Session;
};

export interface SelfHostedCheckPayload {
key: string;
Expand Down
1 change: 1 addition & 0 deletions backend/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface Product {
export interface User extends Entity {
name: string;
photo: string | null;
email: string | null;
}

export interface UserIdentity extends Entity {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/db/entities/SessionView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class SessionView {
this.id = id;
this.name = name;
this.created = new Date();
this.createdBy = { id: '0', name: '', photo: '' };
this.createdBy = { id: '0', name: '', photo: '', email: null };
this.encrypted = null;
this.locked = false;
this.numberOfActions = 0;
Expand Down
1 change: 1 addition & 0 deletions backend/src/db/entities/UserIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class UserEntity {
id: this.id,
name: this.name,
photo: this.photo,
email: this.email,
};
}
}
Expand Down
5 changes: 5 additions & 0 deletions backend/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export default (io: Server) => {
: {
id: socket,
name: `(Spectator #${i})`,
email: null,
photo: null,
pro: null,
}
Expand Down Expand Up @@ -372,6 +373,10 @@ export default (io: Server) => {
log(chalk`{red User not allowed, session locked}`);
const payload: UnauthorizedAccessPayload = {
type: userAllowed.reason,
session:
userAllowed.reason === 'locked'
? sessionEntity.toJson()
: undefined,
};
sendToSelf<UnauthorizedAccessPayload>(
socket,
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/common/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
StripeLocales,
AccessErrorType,
CoachMessage,
Session,
} from './types.js';

export interface RegisterPayload {
Expand Down Expand Up @@ -49,9 +50,10 @@ export interface CreateSessionPayload {
encryptedCheck?: string;
}

export interface UnauthorizedAccessPayload {
export type UnauthorizedAccessPayload = {
type?: AccessErrorType;
}
session?: Session;
};

export interface SelfHostedCheckPayload {
key: string;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface Product {
export interface User extends Entity {
name: string;
photo: string | null;
email: string | null;
}

export interface UserIdentity extends Entity {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/translations/locales/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
"allowGroupingHelp": "السماح بإنشاء مجموعات لتجميع المشاركات معا",
"allowReordering": "السماح بإعادة الطلب",
"allowReorderingHelp": "السماح بإعادة ترتيب المشاركات بسحب وإسقاط",
"restrictTitleEditToOwner": "تقييد تحرير العنوان إلى المالك",
"restrictTitleEditToOwnerHelp": "لا يستطيع تغيير ملكيته إلا مالك الارتداد",
"restrictReorderingToOwner": "تقييد إعادة الطلب إلى المالك",
"restrictReorderingToOwnerHelp": "لا يستطيع إعادة ترتيب الوظائف إلا مالك الكاتب بأثر رجعي",
"restrictGroupingToOwner": "تقييد التجميع إلى المالك",
"restrictGroupingToOwnerHelp": "لا يستطيع إنشاء مجموعات إلا مالك الارتداد",
"restrictTitleEditToOwner": "تقييد تحرير العنوان إلى المشرف",
"restrictTitleEditToOwnerHelp": "مدير إدارة رجعي هو وحده القادر على تغيير عنوانه",
"restrictReorderingToOwner": "تقييد إعادة الطلب إلى المشرف",
"restrictReorderingToOwnerHelp": "فقط مشرف وظيفة بأثر رجعي قادر على إعادة ترتيب الوظائف",
"restrictGroupingToOwner": "تقييد التجميع إلى المشرف",
"restrictGroupingToOwnerHelp": "فقط مشرف المشرف بأثر رجعي قادر على إنشاء مجموعات",
"blurCards": "طمس البطاقات",
"blurCardsHelp": "محتوى البطاقات غير واضح حتى يكشف المشرف عن المحتوى",
"template": "قالب",
Expand Down Expand Up @@ -473,7 +473,7 @@
"lockDescription": "أنت على وشك جعل الجلسة خاصة. سيسمح فقط للمشاركين الحاليين (المدرجة أدناه) بالدخول إلى هذه الجلسة بمجرد قفلهم.",
"cancelButton": "إلغاء",
"sessionLockedTitle": "هذه الجلسة سرية.",
"sessionLockedDescription": "من فضلك اطلب من المشرف فتح القفل حتى تتمكن من الانضمام. ثم قم بتحديث هذه الصفحة.",
"sessionLockedDescription": "من فضلك اطلب من المشرف ({{moderator}}, {{email}}) فتح القفل حتى تتمكن من الانضمام. ثم قم بتحديث هذه الصفحة.",
"sessionNonProTitle": "هذه الجلسة متاحة فقط للمستخدمين المحترفين",
"sessionNonProDescription": "هذه الجلسة تستخدم الميزات المتاحة فقط للمستخدمين المحترفين. الرجاء الطلب من المشرف أو صاحب الاشتراك أن يعطيك حساب محترف.",
"sessionIsPublic": "وهذه الجلسة علنية ويمكن لأي شخص الوصول إليها.",
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/translations/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
"allowGroupingHelp": "Erstelle Gruppen, um Beiträge zusammenzufassen",
"allowReordering": "Neu sortieren erlauben",
"allowReorderingHelp": "Erlaubt die Beiträge per Drag-and-Drop neu zu sortieren",
"restrictTitleEditToOwner": "Titelbearbeitung auf Eigentümer beschränken",
"restrictTitleEditToOwnerHelp": "Nur der Besitzer einer Retrospektive kann seinen Titel ändern",
"restrictReorderingToOwner": "Neubestellung auf Eigentümer beschränken",
"restrictReorderingToOwnerHelp": "Nur der Besitzer einer Retrospektive kann Beiträge neu bestellen",
"restrictGroupingToOwner": "Gruppierung auf Besitzer beschränken",
"restrictGroupingToOwnerHelp": "Nur der Besitzer einer Retrospektive kann Gruppen erstellen",
"restrictTitleEditToOwner": "Titelbearbeitung auf Moderator beschränken",
"restrictTitleEditToOwnerHelp": "Nur der Moderator einer Retrospektive kann seinen Titel ändern",
"restrictReorderingToOwner": "Erneute Bestellung auf den Moderator beschränken",
"restrictReorderingToOwnerHelp": "Nur der Moderator einer Retrospektive kann Beiträge neu bestellen",
"restrictGroupingToOwner": "Gruppierung auf den Moderator beschränken",
"restrictGroupingToOwnerHelp": "Nur der Moderator einer Retrospektive kann Gruppen erstellen",
"blurCards": "Unscharfe Karten",
"blurCardsHelp": "Karteninhalte werden verschwommen dargestellt, bis der Moderator den Inhalt aufdeckt",
"template": "Vorlage",
Expand Down Expand Up @@ -473,7 +473,7 @@
"lockDescription": "Sie sind dabei, die Sitzung privat zu machen. Nur die aktuellen Teilnehmer (unten aufgeführt) haben Zugang zu dieser Sitzung, sobald sie gesperrt sind.",
"cancelButton": "Abbrechen",
"sessionLockedTitle": "Diese Sitzung ist privat.",
"sessionLockedDescription": "Bitte den Moderator bitten, ihn zu entsperren, damit du beitreten kannst. Dann aktualisiere diese Seite.",
"sessionLockedDescription": "Bitte den Moderator ({{moderator}}, {{email}}) bitten, ihn zu entsperren, damit du beitreten kannst. Dann aktualisiere diese Seite.",
"sessionNonProTitle": "Diese Sitzung ist nur für Pro-Benutzer zugänglich",
"sessionNonProDescription": "Diese Sitzung verwendet Funktionen, die nur Pro-Nutzern zur Verfügung stehen. Bitte fragen Sie den Moderator oder den Abonnementhalter, Ihnen ein Pro-Konto zu erteilen.",
"sessionIsPublic": "Diese Sitzung ist öffentlich und für jedermann zugänglich.",
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/translations/locales/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
"allowGroupingHelp": "Allow the creation of groups to group posts together",
"allowReordering": "Allow Re-ordering",
"allowReorderingHelp": "Allow re-ordering posts by drag-and-drop",
"restrictTitleEditToOwner": "Restrict title editing to owner",
"restrictTitleEditToOwnerHelp": "Only the owner of a retrospective is able to change its title",
"restrictReorderingToOwner": "Restrict re-ordering to owner",
"restrictReorderingToOwnerHelp": "Only the owner of a retrospective is able to re-order posts",
"restrictGroupingToOwner": "Restrict grouping to owner",
"restrictGroupingToOwnerHelp": "Only the owner of a retrospective is able to create groups",
"restrictTitleEditToOwner": "Restrict title editing to moderator",
"restrictTitleEditToOwnerHelp": "Only the moderator of a retrospective is able to change its title",
"restrictReorderingToOwner": "Restrict re-ordering to the moderator",
"restrictReorderingToOwnerHelp": "Only the moderator of a retrospective is able to re-order posts",
"restrictGroupingToOwner": "Restrict grouping to the moderator",
"restrictGroupingToOwnerHelp": "Only the moderator of a retrospective is able to create groups",
"blurCards": "Blur Cards",
"blurCardsHelp": "Cards content is blurred until the moderator reveals the content",
"template": "Template",
Expand Down Expand Up @@ -467,7 +467,7 @@
"lockDescription": "You are about to make the session private. Only the current participants (listed below) will be allowed access to this session once locked.",
"cancelButton": "Cancel",
"sessionLockedTitle": "This session is private.",
"sessionLockedDescription": "Please ask its moderator to unlock it so you can join. Then, refresh this page.",
"sessionLockedDescription": "Please ask its moderator ({{moderator}}, {{email}}) to unlock it so you can join. Then, refresh this page.",
"sessionNonProTitle": "This session is only accessible to Pro users",
"sessionNonProDescription": "This session uses features only available to Pro users. Please ask the moderator or subscription holder to give you a Pro account.",
"sessionIsPublic": "This session is public and accessible to anyone.",
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/translations/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
"allowGroupingHelp": "Permitir la creación de grupos agrupar mensajes juntos",
"allowReordering": "Permitir reordenar",
"allowReorderingHelp": "Permitir reordenar mensajes por arrastrar y soltar",
"restrictTitleEditToOwner": "Restringir la edición del título al propietario",
"restrictTitleEditToOwnerHelp": "Sólo el propietario de una retrospectiva puede cambiar su título",
"restrictReorderingToOwner": "Restringir reordenar al propietario",
"restrictReorderingToOwnerHelp": "Sólo el propietario de un retrospective puede reordenar los posts",
"restrictGroupingToOwner": "Restringir agrupación al propietario",
"restrictGroupingToOwnerHelp": "Sólo el dueño de un retrospective puede crear grupos",
"restrictTitleEditToOwner": "Restringir la edición del título al moderador",
"restrictTitleEditToOwnerHelp": "Sólo el moderador de una retrospectiva es capaz de cambiar su título",
"restrictReorderingToOwner": "Restringir reordenar al moderador",
"restrictReorderingToOwnerHelp": "Sólo el moderador de un retrospective es capaz de reordenar los posts",
"restrictGroupingToOwner": "Restringir agrupación al moderador",
"restrictGroupingToOwnerHelp": "Sólo el moderador de un retrospective es capaz de crear grupos",
"blurCards": "Desenfocar tarjetas",
"blurCardsHelp": "El contenido de las tarjetas está desenfocado hasta que el moderador revele el contenido",
"template": "Plantilla",
Expand Down Expand Up @@ -473,7 +473,7 @@
"lockDescription": "Está a punto de hacer la sesión privada. Sólo los participantes actuales (listados a continuación) tendrán acceso a esta sesión una vez bloqueado.",
"cancelButton": "Cancelar",
"sessionLockedTitle": "Esta sesión es privada.",
"sessionLockedDescription": "Pídele a su moderador que lo desbloquee para poder unirte. Luego, actualiza esta página.",
"sessionLockedDescription": "Pídele a su moderador ({{moderator}}, {{email}}) que lo desbloquee para poder unirte. Luego, actualiza esta página.",
"sessionNonProTitle": "Esta sesión sólo es accesible para usuarios Pro",
"sessionNonProDescription": "Esta sesión utiliza características sólo disponibles para usuarios Pro. Por favor, pide al moderador o al titular de la suscripción que te dé una cuenta Pro.",
"sessionIsPublic": "Esta sesión es pública y accesible para cualquier persona.",
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/translations/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
"allowGroupingHelp": "Permettre aux utilisateurs de grouper les posts par groupes",
"allowReordering": "Re-organiser",
"allowReorderingHelp": "Permettre aux utilisateurs de réorganiser l'ordre des posts",
"restrictTitleEditToOwner": "Restreindre l'édition du titre à l'admin",
"restrictTitleEditToOwnerHelp": "Seul l'admin d'une rétrospective est en mesure de changer son titre",
"restrictReorderingToOwner": "Limiter la réorganisation (drag-and-drop) des posts à l'admin",
"restrictReorderingToOwnerHelp": "Seul l'admin d'une rétrospective est en mesure de réorganiser les posts",
"restrictGroupingToOwner": "Restreindre la création de groupes à l'admin",
"restrictGroupingToOwnerHelp": "Seul l'admin d'une rétrospective peut créer et réordonner des groupes",
"restrictTitleEditToOwner": "Restreindre l'édition du titre au modérateur",
"restrictTitleEditToOwnerHelp": "Seul le modérateur d'une rétrospective est en mesure de changer son titre",
"restrictReorderingToOwner": "Limiter la réorganisation (drag-and-drop) des posts au modérateur",
"restrictReorderingToOwnerHelp": "Seul le modérateur d'une rétrospective est en mesure de réorganiser les posts",
"restrictGroupingToOwner": "Limiter la réorganisation (drag-and-drop) des posts au modérateur",
"restrictGroupingToOwnerHelp": "Seul le modérateur d'une rétrospective peut créer et réordonner des groupes",
"blurCards": "Flouter",
"blurCardsHelp": "Les posts sont floutés, jusqu'à ce qu'un modérateur révèle les posts",
"template": "Modèles",
Expand Down Expand Up @@ -473,7 +473,7 @@
"lockDescription": "Vous êtes sur le point de privatiser la session. Seuls les utilisateurs ayant déjà accédé à cette session (dont la liste s'affiche ci-dessous) pourront accéder à cette session une fois verrouillée.",
"cancelButton": "Annuler",
"sessionLockedTitle": "Cette session est privée.",
"sessionLockedDescription": "Demandez à votre modérateur de la rendre publique pour que vous puissiez la rejoindre. Ensuite, rafraichissez la page.",
"sessionLockedDescription": "Demandez à votre modérateur ({{moderator}}, {{email}}) de la rendre publique pour que vous puissiez la rejoindre. Ensuite, rafraichissez la page.",
"sessionNonProTitle": "Cette session n'est accessible qu'aux utilisateurs Pro",
"sessionNonProDescription": "Cette session n'est ouverte qu'aux détenteurs d'un compte Retrospected Pro. Vous pouvez demander au modérateur ou au gérant de l'abonnement Pro de vous donner un accès.",
"sessionIsPublic": "Cette session est publique et accessible à tout le monde.",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/translations/locales/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"lockDescription": "A munkamenet priváttá tételére készül. Csak a jelenlegi résztvevők (az alábbiakban felsorolva) férhetnek hozzá ehhez a munkamenethez, miután lezárták.",
"cancelButton": "Megszünteti",
"sessionLockedTitle": "Ez a munkamenet privát.",
"sessionLockedDescription": "Kérd meg a moderátort, hogy oldja fel, hogy csatlakozhasson. Ezután frissítse ezt az oldalt.",
"sessionLockedDescription": "",
"sessionNonProTitle": "Ez a munkamenet csak a Pro felhasználók számára érhető el",
"sessionNonProDescription": "Ez a munkamenet csak a Pro felhasználók számára elérhető funkciókat használja. Kérje meg a moderátort vagy az előfizetés tulajdonosát, hogy adjon Pro-fiókot.",
"sessionIsPublic": "Ez az ülés nyilvános és bárki számára elérhető.",
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/translations/locales/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
"allowGroupingHelp": "Permetti la creazione di gruppi per raggruppare post",
"allowReordering": "Consenti il riordinamento",
"allowReorderingHelp": "Permetti il riordinamento dei post con il trascinamento",
"restrictTitleEditToOwner": "Limita la modifica del titolo al proprietario",
"restrictTitleEditToOwnerHelp": "Solo il proprietario di una retrospettiva è in grado di cambiare il suo titolo",
"restrictReorderingToOwner": "Limita riordinamento al proprietario",
"restrictReorderingToOwnerHelp": "Solo il proprietario di una retrospettiva è in grado di riordinare i post",
"restrictGroupingToOwner": "Limita raggruppamento al proprietario",
"restrictGroupingToOwnerHelp": "Solo il proprietario di una retrospettiva è in grado di creare gruppi",
"restrictTitleEditToOwner": "Limita la modifica del titolo al moderatore",
"restrictTitleEditToOwnerHelp": "Solo il moderatore di una retrospettiva è in grado di cambiare il suo titolo",
"restrictReorderingToOwner": "Limita riordinamento al moderatore",
"restrictReorderingToOwnerHelp": "Solo il moderatore di una retrospettiva è in grado di riordinare i post",
"restrictGroupingToOwner": "Limita il raggruppamento al moderatore",
"restrictGroupingToOwnerHelp": "Solo il moderatore di una retrospettiva è in grado di creare gruppi",
"blurCards": "Sfoca Carte",
"blurCardsHelp": "Il contenuto delle carte è sfocato finché il moderatore non rivela il contenuto",
"template": "Modello",
Expand Down Expand Up @@ -473,7 +473,7 @@
"lockDescription": "Stai per rendere la sessione privata. Solo i partecipanti attuali (elencati di seguito) avranno accesso a questa sessione una volta bloccato.",
"cancelButton": "Annulla",
"sessionLockedTitle": "Questa sessione è privata.",
"sessionLockedDescription": "Chiedi al suo moderatore di sbloccarlo in modo che tu possa entrare. Quindi, aggiorna questa pagina.",
"sessionLockedDescription": "Per favore chiedi al suo moderatore ({{moderator}}, {{email}}) di sbloccarlo in modo che tu possa entrare. Quindi, aggiorna questa pagina.",
"sessionNonProTitle": "Questa sessione è accessibile solo agli utenti Pro",
"sessionNonProDescription": "Questa sessione utilizza funzionalità disponibili solo per gli utenti Pro. Si prega di chiedere al moderatore o titolare di abbonamento di fornire un account Pro.",
"sessionIsPublic": "Questa sessione è pubblica e accessibile a chiunque.",
Expand Down
Loading

0 comments on commit ba8efaf

Please sign in to comment.