Skip to content

Commit

Permalink
Options to restrict title, grouping, ordering to owner (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinejaussoin authored Jul 18, 2023
1 parent fbb4680 commit 1a53390
Show file tree
Hide file tree
Showing 26 changed files with 343 additions and 49 deletions.
3 changes: 3 additions & 0 deletions backend/src/common/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const defaultOptions: SessionOptions = {
allowTimer: true,
timerDuration: 15 * 60,
readonlyOnTimerEnd: true,
restrictTitleEditToOwner: false,
restrictReorderingToOwner: false,
restrictGroupingToOwner: false,
};

export const defaultSession: Omit<Session, 'createdBy'> = {
Expand Down
3 changes: 3 additions & 0 deletions backend/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export interface SessionOptions {
allowGrouping: boolean;
allowReordering: boolean;
allowCancelVote: boolean;
restrictTitleEditToOwner: boolean;
restrictReorderingToOwner: boolean;
restrictGroupingToOwner: boolean;
blurCards: boolean;
newPostsFirst: boolean;
allowTimer: boolean;
Expand Down
10 changes: 10 additions & 0 deletions backend/src/db/entities/SessionOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default class SessionOptionsEntity {
public allowCancelVote: boolean;
@Column({ default: true })
public allowTimer: boolean;
@Column({ default: false })
public restrictTitleEditToOwner: boolean;
@Column({ default: false })
public restrictReorderingToOwner: boolean;
@Column({ default: false })
public restrictGroupingToOwner: boolean;
@Column({ type: 'numeric', default: 15 * 60 })
public timerDuration: number;
@Column({ default: true })
Expand Down Expand Up @@ -63,6 +69,10 @@ export default class SessionOptionsEntity {
this.allowTimer = optionsWithDefault.allowTimer;
this.timerDuration = optionsWithDefault.timerDuration;
this.readonlyOnTimerEnd = optionsWithDefault.readonlyOnTimerEnd;
this.restrictTitleEditToOwner = optionsWithDefault.restrictTitleEditToOwner;
this.restrictReorderingToOwner =
optionsWithDefault.restrictReorderingToOwner;
this.restrictGroupingToOwner = optionsWithDefault.restrictGroupingToOwner;
}
}

Expand Down
24 changes: 24 additions & 0 deletions backend/src/db/migrations/1689628225524-MoreOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class MoreOptions1689628225524 implements MigrationInterface {
name = 'MoreOptions1689628225524'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_title_edit_to_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_reordering_to_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_grouping_to_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_title_edit_to_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_reordering_to_owner" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_grouping_to_owner" boolean NOT NULL DEFAULT false`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_grouping_to_owner"`);
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_reordering_to_owner"`);
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_title_edit_to_owner"`);
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_grouping_to_owner"`);
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_reordering_to_owner"`);
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_title_edit_to_owner"`);
}

}
3 changes: 3 additions & 0 deletions frontend/src/common/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const defaultOptions: SessionOptions = {
allowTimer: true,
timerDuration: 15 * 60,
readonlyOnTimerEnd: true,
restrictTitleEditToOwner: false,
restrictReorderingToOwner: false,
restrictGroupingToOwner: false,
};

export const defaultSession: Omit<Session, 'createdBy'> = {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export interface SessionOptions {
allowGrouping: boolean;
allowReordering: boolean;
allowCancelVote: boolean;
restrictTitleEditToOwner: boolean;
restrictReorderingToOwner: boolean;
restrictGroupingToOwner: boolean;
blurCards: boolean;
newPostsFirst: boolean;
allowTimer: boolean;
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "السماح بإنشاء مجموعات لتجميع المشاركات معا",
"allowReordering": "السماح بإعادة الطلب",
"allowReorderingHelp": "السماح بإعادة ترتيب المشاركات بسحب وإسقاط",
"restrictTitleEditToOwner": "تقييد تحرير العنوان إلى المالك",
"restrictTitleEditToOwnerHelp": "لا يستطيع تغيير ملكيته إلا مالك الارتداد",
"restrictReorderingToOwner": "تقييد إعادة الطلب إلى المالك",
"restrictReorderingToOwnerHelp": "لا يستطيع إعادة ترتيب الوظائف إلا مالك الكاتب بأثر رجعي",
"restrictGroupingToOwner": "تقييد التجميع إلى المالك",
"restrictGroupingToOwnerHelp": "لا يستطيع إنشاء مجموعات إلا مالك الارتداد",
"blurCards": "طمس البطاقات",
"blurCardsHelp": "محتوى البطاقات غير واضح حتى يكشف المشرف عن المحتوى",
"template": "قالب",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +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",
"blurCards": "Unscharfe Karten",
"blurCardsHelp": "Karteninhalte werden verschwommen dargestellt, bis der Moderator den Inhalt aufdeckt",
"template": "Vorlage",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +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",
"blurCards": "Blur Cards",
"blurCardsHelp": "Cards content is blurred until the moderator reveals the content",
"template": "Template",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +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",
"blurCards": "Desenfocar tarjetas",
"blurCardsHelp": "El contenido de las tarjetas está desenfocado hasta que el moderador revele el contenido",
"template": "Plantilla",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +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",
"blurCards": "Flouter",
"blurCardsHelp": "Les posts sont floutés, jusqu'à ce qu'un modérateur révèle les posts",
"template": "Modèles",
Expand Down
18 changes: 12 additions & 6 deletions frontend/src/translations/locales/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"welcome": "",
"anonWarning": "",
"howDoesThatWork": "Hogyan működik?",
"login": "",
"login": "Belépés",
"searchNoMatch": "",
"proNotSetupWarning": "",
"proNotSetupWarningAction": ""
Expand Down Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "Csoportok létrehozásának engedélyezése a bejegyzések csoportosításához",
"allowReordering": "Újrarendelés engedélyezése",
"allowReorderingHelp": "A bejegyzések átrendezésének engedélyezése fogd és vidd módszerrel",
"restrictTitleEditToOwner": "",
"restrictTitleEditToOwnerHelp": "",
"restrictReorderingToOwner": "",
"restrictReorderingToOwnerHelp": "",
"restrictGroupingToOwner": "",
"restrictGroupingToOwnerHelp": "",
"blurCards": "Kártyák elmosódása",
"blurCardsHelp": "A kártyák tartalma elmosódik, amíg a moderátor fel nem fedi a tartalmat",
"template": "Sablon",
Expand Down Expand Up @@ -184,7 +190,7 @@
"Clients": {
"header": "Jelenleg itt van:",
"joined": "{{users}} csatlakozott.",
"left": "{{users}} maradt."
"left": "{{users}} távozott."
},
"Join": {
"welcome": "Üdv, ez itt a Retrospected",
Expand Down Expand Up @@ -222,7 +228,7 @@
"passwordField": "Jelszó",
"nameField": "Az Ön neve (megjelenítési célból)",
"noAuthWarning": "",
"or": "",
"or": "vagy",
"passwordScoreWords": [
"gyenge",
"gyenge",
Expand Down Expand Up @@ -271,7 +277,7 @@
"copySuccessful": "Sikeresen másolta az összefoglalót a vágólapra"
},
"SessionName": {
"defaultSessionName": "Retrospektívám"
"defaultSessionName": "Retro"
},
"Invite": {
"inviteButton": "Meghívás",
Expand Down Expand Up @@ -492,13 +498,13 @@
"stopTimerTitle": "",
"stopTimerDescription": "",
"stopTimerButton": "",
"stopTimerCancelButton": ""
"stopTimerCancelButton": "Megszünteti"
},
"Ai": {
"title": "",
"info": "",
"disabledAnonymous": "",
"close": "",
"close": "Bezárás",
"paidLimitWarning": "",
"freeLimitWarning": "",
"genericError": "",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +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",
"blurCards": "Sfoca Carte",
"blurCardsHelp": "Il contenuto delle carte è sfocato finché il moderatore non rivela il contenuto",
"template": "Modello",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "投稿をグループ化するグループの作成を許可する",
"allowReordering": "並べ替えを許可",
"allowReorderingHelp": "ドラッグ&ドロップで投稿の並べ替えを許可する",
"restrictTitleEditToOwner": "タイトル編集を所有者に制限",
"restrictTitleEditToOwnerHelp": "回顧展の所有者のみがタイトルを変更できます",
"restrictReorderingToOwner": "再順序を所有者に制限",
"restrictReorderingToOwnerHelp": "レトロスペクティブの所有者のみ投稿を再注文できます",
"restrictGroupingToOwner": "グループ化を所有者に制限",
"restrictGroupingToOwnerHelp": "レトロスペクティブの所有者のみがグループを作成できます",
"blurCards": "ぼかしカード",
"blurCardsHelp": "モデレーターがコンテンツを表示するまでカードの内容がぼかしています",
"template": "テンプレート",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "Aanmaken van groepen van retropunten toestaan.",
"allowReordering": "Herordenen toestaan",
"allowReorderingHelp": "Toestaan om retropunten mbv drag-en-drop te herordenen",
"restrictTitleEditToOwner": "Beperk titelbewerking tot eigenaar",
"restrictTitleEditToOwnerHelp": "Alleen de eigenaar van een retrospectief kan zijn titel wijzigen",
"restrictReorderingToOwner": "Beperk herschikken tot eigenaar",
"restrictReorderingToOwnerHelp": "Alleen de eigenaar van een retrospectief kan posts opnieuw bestellen",
"restrictGroupingToOwner": "Beperk groepering tot eigenaar",
"restrictGroupingToOwnerHelp": "Alleen de eigenaar van een retrospectief kan groepen maken",
"blurCards": "Vervaag Kaarten",
"blurCardsHelp": "Inhoud van kaarten wordt vervaagd totdat de moderator de inhoud onthult",
"template": "Sjabloon",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "Pozwól tworzyć grupy do grupowania postów",
"allowReordering": "Zezwalaj na ponowne zamawianie",
"allowReorderingHelp": "Zezwalaj na zmianę kolejności postów przez przeciąganie i upuszczanie",
"restrictTitleEditToOwner": "Ogranicz edycję tytułu do właściciela",
"restrictTitleEditToOwnerHelp": "Tylko właściciel retrospektywnie może zmienić swój tytuł",
"restrictReorderingToOwner": "Ogranicz kolejność do właściciela",
"restrictReorderingToOwnerHelp": "Tylko właściciel retrospektywnie może zmienić kolejność postów",
"restrictGroupingToOwner": "Ogranicz grupowanie do właściciela",
"restrictGroupingToOwnerHelp": "Tylko właściciel retrospektywnie jest w stanie tworzyć grupy",
"blurCards": "Rozmycie kart",
"blurCardsHelp": "Zawartość kart jest rozmyta aż moderator ujawni zawartość",
"template": "Szablon",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "Permitir a criação de grupos para agrupar postagens",
"allowReordering": "Permitir reordenação",
"allowReorderingHelp": "Permitir reordenação de postagens arrastando-se-e-soltar",
"restrictTitleEditToOwner": "Restringir edição do título ao proprietário",
"restrictTitleEditToOwnerHelp": "Somente o proprietário de um retrospectivo é capaz de alterar seu título",
"restrictReorderingToOwner": "Restringir reordenação ao proprietário",
"restrictReorderingToOwnerHelp": "Somente o proprietário de um retrospectivo é capaz de reordenar postagens",
"restrictGroupingToOwner": "Restringir agrupamento ao proprietário",
"restrictGroupingToOwnerHelp": "Somente o proprietário de um retrospectivo é capaz de criar grupos",
"blurCards": "Cartões de Desfoque",
"blurCardsHelp": "O conteúdo dos cartões fica desfocado até que o moderador revele o conteúdo",
"template": "Modelo",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "Permitir a criação de grupos para agrupar postagens",
"allowReordering": "Permitir reordenação",
"allowReorderingHelp": "Permitir reordenação de postagens arrastando-se-e-soltar",
"restrictTitleEditToOwner": "Restringir edição do título ao proprietário",
"restrictTitleEditToOwnerHelp": "Somente o proprietário de um retrospectivo é capaz de alterar seu título",
"restrictReorderingToOwner": "Restringir reordenação ao proprietário",
"restrictReorderingToOwnerHelp": "Somente o proprietário de um retrospectivo é capaz de reordenar postagens",
"restrictGroupingToOwner": "Restringir agrupamento ao proprietário",
"restrictGroupingToOwnerHelp": "Somente o proprietário de um retrospectivo é capaz de criar grupos",
"blurCards": "Cartões de Desfoque",
"blurCardsHelp": "O conteúdo dos cartões fica desfocado até que o moderador revele o conteúdo",
"template": "Modelo",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "Дозволити створення груп для групових повідомлень",
"allowReordering": "Дозволити повторне замовлення",
"allowReorderingHelp": "Дозволити перегрупування матеріалів перетягуванням",
"restrictTitleEditToOwner": "Обмежувати редагування заголовків власнику",
"restrictTitleEditToOwnerHelp": "Лише власник ретроспективу може змінити його назву",
"restrictReorderingToOwner": "Обмежити повторне замовлення власника",
"restrictReorderingToOwnerHelp": "Тільки власник ретроспективи може змінити порядок постів",
"restrictGroupingToOwner": "Обмежити групування власника",
"restrictGroupingToOwnerHelp": "Тільки власник ретроспективу здатний створювати групи",
"blurCards": "Розмиті картки",
"blurCardsHelp": "Зміст карт буде розмитим, поки модератор не отримає вміст",
"template": "Шаблон",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "允许创建群组将帖子一起分组",
"allowReordering": "允许重新排序",
"allowReorderingHelp": "允许通过拖放重新排序帖子",
"restrictTitleEditToOwner": "限制标题编辑到所有者",
"restrictTitleEditToOwnerHelp": "只有追溯性的所有者能够更改其标题",
"restrictReorderingToOwner": "限制重新排序到所有者",
"restrictReorderingToOwnerHelp": "只有追溯性的所有者可以重新排序帖子",
"restrictGroupingToOwner": "限制分组到所有者",
"restrictGroupingToOwnerHelp": "只有追溯性的所有者能够创建组",
"blurCards": "模糊卡",
"blurCardsHelp": "在版主显示内容之前,卡片内容是模糊的",
"template": "模板",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/translations/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
"allowGroupingHelp": "允許創建組以將帖子分組在一起",
"allowReordering": "允許重新訂購",
"allowReorderingHelp": "允許通過拖放重新排序帖子",
"restrictTitleEditToOwner": "",
"restrictTitleEditToOwnerHelp": "",
"restrictReorderingToOwner": "",
"restrictReorderingToOwnerHelp": "",
"restrictGroupingToOwner": "",
"restrictGroupingToOwnerHelp": "",
"blurCards": "模糊卡片",
"blurCardsHelp": "卡片內容模糊,直到版主顯示內容",
"template": "模板",
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/views/game/board/Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ const Column: React.FC<ColumnProps> = ({
</Group>
))}
</Groups>
<Droppable droppableId={'column#' + column.index} isCombineEnabled>
<Droppable
droppableId={'column#' + column.index}
isCombineEnabled
isDropDisabled={!permissions.canReorderPosts}
>
{(
dropProvided: DroppableProvided,
dropSnapshot: DroppableStateSnapshot
Expand Down Expand Up @@ -236,7 +240,8 @@ const PostsWrapper = styled.div<{
draggingOver: boolean;
draggingColor: string;
}>`
background-color: ${(props) => props.draggingOver ? props.draggingColor : 'unset'};
background-color: ${(props) =>
props.draggingOver ? props.draggingColor : 'unset'};
flex: 1;
min-height: 100px;
`;
Expand Down
Loading

0 comments on commit 1a53390

Please sign in to comment.