From 799d11cd1728e468d2c6705f080854971974a20b Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Thu, 7 Feb 2019 11:46:19 +0100 Subject: [PATCH] small fixes - motion detail comments not always visible - fix tag/recommendation multiselect - fix display of prefixed categories in filter/dialogs - confirm dialog on email invitation - attempt at fixing history filter --- .../history-list/history-list.component.ts | 7 +- .../motion-comments.component.html | 80 +++++++++++-------- .../motion-comments.component.ts | 13 +++ .../motion-list/motion-list.component.html | 2 +- .../services/motion-multiselect.service.ts | 12 +-- .../user-list/user-list.component.ts | 9 ++- 6 files changed, 77 insertions(+), 46 deletions(-) diff --git a/client/src/app/site/history/components/history-list/history-list.component.ts b/client/src/app/site/history/components/history-list/history-list.component.ts index 0a98a7521..0ad72b4a7 100644 --- a/client/src/app/site/history/components/history-list/history-list.component.ts +++ b/client/src/app/site/history/components/history-list/history-list.component.ts @@ -156,7 +156,10 @@ export class HistoryListComponent extends ListViewBaseComponent imp */ private setFilters(): void { this.dataSource.filterPredicate = (data, filter) => { - filter = filter.toLowerCase(); + if (!data || !data.information) { + return false; + } + filter = filter ? filter.toLowerCase() : ''; if ( this.getElementInfo(data) .toLowerCase() @@ -164,7 +167,7 @@ export class HistoryListComponent extends ListViewBaseComponent imp ) { return true; } - if (data.user.full_name.toLowerCase().indexOf(filter) >= 0) { + if (data.user && data.user.full_name.toLowerCase().indexOf(filter) >= 0) { return true; } return ( diff --git a/client/src/app/site/motions/components/motion-comments/motion-comments.component.html b/client/src/app/site/motions/components/motion-comments/motion-comments.component.html index 9f57a3cd2..c842478b2 100644 --- a/client/src/app/site/motions/components/motion-comments/motion-comments.component.html +++ b/client/src/app/site/motions/components/motion-comments/motion-comments.component.html @@ -1,38 +1,48 @@ - - - {{ section.getTitle() }} - - - - -
-
- No comment -
+
+ + + {{ section.getTitle() }} -
- -

Comment

- -
- - - - - - -
+ + +
+
+ No comment +
+
+
+ +

Comment

+ +
+
+ + + + + + +
diff --git a/client/src/app/site/motions/components/motion-comments/motion-comments.component.ts b/client/src/app/site/motions/components/motion-comments/motion-comments.component.ts index 0d79a6363..63da260e7 100644 --- a/client/src/app/site/motions/components/motion-comments/motion-comments.component.ts +++ b/client/src/app/site/motions/components/motion-comments/motion-comments.component.ts @@ -155,6 +155,19 @@ export class MotionCommentsComponent extends BaseViewComponent { delete this.commentForms[section.id]; } + /** + * Check if a section is visible at all + * + * @param section + * @returns true if there is any content or the user is allowed to edit + */ + public sectionVisible(section: ViewMotionCommentSection): boolean { + if (!this.canEditSection(section) && (!this.comments[section.id] || !this.comments[section.id].comment)) { + return false; + } + return true; + } + /** * Returns true, if the comment is edited. * diff --git a/client/src/app/site/motions/components/motion-list/motion-list.component.html b/client/src/app/site/motions/components/motion-list/motion-list.component.html index df5e030af..b68c56e08 100644 --- a/client/src/app/site/motions/components/motion-list/motion-list.component.html +++ b/client/src/app/site/motions/components/motion-list/motion-list.component.html @@ -62,7 +62,7 @@ attach_file - + {{ motion.title }} diff --git a/client/src/app/site/motions/services/motion-multiselect.service.ts b/client/src/app/site/motions/services/motion-multiselect.service.ts index 5754ff3bd..8c27e902f 100644 --- a/client/src/app/site/motions/services/motion-multiselect.service.ts +++ b/client/src/app/site/motions/services/motion-multiselect.service.ts @@ -120,7 +120,7 @@ export class MotionMultiselectService { id: motion.id, recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number) })); - await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation', { + await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation/', { motions: requestData }); } @@ -171,7 +171,7 @@ export class MotionMultiselectService { submitters: submitterIds }; }); - await this.httpService.post('/rest/motions/motion/manage_multiple_submitters', { motions: requestData }); + await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData }); } else if (selectedChoice && selectedChoice.action === choices[1]) { const requestData = motions.map(motion => { const submitterIdsToRemove = selectedChoice.items as number[]; @@ -181,7 +181,7 @@ export class MotionMultiselectService { submitters: submitterIds }; }); - await this.httpService.post('/rest/motions/motion/manage_multiple_submitters', { motions: requestData }); + await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData }); } } @@ -203,7 +203,7 @@ export class MotionMultiselectService { tags: tagIds }; }); - await this.httpService.post('/rest/motions/motion/manage_multiple_tags', { motions: requestData }); + await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData }); } else if (selectedChoice && selectedChoice.action === choices[1]) { const requestData = motions.map(motion => { const tagIdsToRemove = selectedChoice.items as number[]; @@ -213,7 +213,7 @@ export class MotionMultiselectService { tags: tagIds }; }); - await this.httpService.post('/rest/motions/motion/manage_multiple_tags', { motions: requestData }); + await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData }); } else if (selectedChoice && selectedChoice.action === choices[2]) { const requestData = motions.map(motion => { return { @@ -221,7 +221,7 @@ export class MotionMultiselectService { tags: [] }; }); - await this.httpService.post('/rest/motions/motion/manage_multiple_tags', { motions: requestData }); + await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData }); } } diff --git a/client/src/app/site/users/components/user-list/user-list.component.ts b/client/src/app/site/users/components/user-list/user-list.component.ts index d24c813aa..560b61b69 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.ts +++ b/client/src/app/site/users/components/user-list/user-list.component.ts @@ -258,8 +258,13 @@ export class UserListComponent extends ListViewBaseComponent implement * Handler for bulk sending e-mail invitations. Uses selectedRows defined via * multiSelect mode. */ - public sendInvitationEmailSelected(): void { - this.repo.sendInvitationEmail(this.selectedRows).then(this.raiseError, this.raiseError); + public async sendInvitationEmailSelected(): Promise { + const content = + this.translate.instant('Send invitation e-Mails to the selected users?') + + ` (${this.selectedRows.length} E-Mails)`; + if (await this.promptService.open('Are you sure?', content)) { + this.repo.sendInvitationEmail(this.selectedRows).then(this.raiseError, this.raiseError); + } } /**