From c9fc362d0c42fe35732edff93968280e9d0d3bd5 Mon Sep 17 00:00:00 2001 From: Bastian Rihm Date: Mon, 30 Sep 2024 12:02:04 +0200 Subject: [PATCH] Add missing fields --- .../pages/motions/motions.subscription.ts | 25 +++++++- .../origin-motion-meta-data.component.html | 33 ++++++++++ .../origin-motion-meta-data.component.ts | 60 +------------------ 3 files changed, 57 insertions(+), 61 deletions(-) diff --git a/client/src/app/site/pages/meetings/pages/motions/motions.subscription.ts b/client/src/app/site/pages/meetings/pages/motions/motions.subscription.ts index 1a3a461e598..58a5c4a8e5c 100644 --- a/client/src/app/site/pages/meetings/pages/motions/motions.subscription.ts +++ b/client/src/app/site/pages/meetings/pages/motions/motions.subscription.ts @@ -241,7 +241,14 @@ export const getMotionOriginDetailSubscriptionConfig: SubscriptionConfigGenerato }, { idField: `state_id`, - fieldset: [`name`, `css_class`, `meeting_id`] + fieldset: [ + `name`, + `css_class`, + `meeting_id`, + `show_state_extension_field`, + `show_recommendation_extension_field`, + `recommendation_label` + ] }, { idField: `poll_ids`, @@ -258,9 +265,23 @@ export const getMotionOriginDetailSubscriptionConfig: SubscriptionConfigGenerato { idField: `change_recommendation_ids`, fieldset: FULL_FIELDSET }, { idField: `category_id`, fieldset: [`name`, `parent_id`, `meeting_id`] }, { idField: `block_id`, fieldset: [`title`, `meeting_id`] }, - { idField: `meeting_id`, fieldset: [`name`, `motions_line_length`, `motions_default_line_numbering`] } + { idField: `recommendation_id`, fieldset: [`name`] }, + { + idField: `meeting_id`, + fieldset: [ + `name`, + `motions_line_length`, + `motions_default_line_numbering`, + `motions_recommendations_by` + ] + }, + { idField: `state_extension_reference_ids`, fieldset: [`number`, `title`, `meeting_id`] }, + { idField: `recommendation_extension_reference_ids`, fieldset: [`number`, `title`, `meeting_id`] } ], fieldset: [ + `state_extension`, + `recommendation_extension`, + `additional_submitter`, `workflow_timestamp`, `reason`, `number`, diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.html b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.html index 2460ff11468..cd240d1693b 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.html +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.html @@ -42,6 +42,39 @@

} + +@if (isRecommendationEnabled) { +
+ + + @if (motion.recommendation_extension_reference_ids?.length) { + @if (referencedMotions$ | async; as referencedMotions) { +
+ @for (motion of referencedMotions; track motion.id; let last = $last) { + + {{ motion.numberOrTitle }} + @if (!last) { +  ยท  + } + + } +
+ } + } +
+} + @if (motion.category) {
diff --git a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.ts b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.ts index f18575b1a90..d123b6b1515 100644 --- a/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.ts +++ b/client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/origin-motion-meta-data/origin-motion-meta-data.component.ts @@ -45,11 +45,7 @@ export class OriginMotionMetaDataComponent extends BaseMotionDetailChildComponen } public get isRecommendationEnabled(): boolean { - return ( - (this.perms.isAllowed(`change_metadata`) || !!this.motion.recommendation) && - !!this.recommender && - !!this.getPossibleRecommendations().length - ); + return !!this.motion.recommendation; } /** @@ -63,11 +59,6 @@ export class OriginMotionMetaDataComponent extends BaseMotionDetailChildComponen return this.changeRecoMode === ChangeRecoMode.Diff; } - /** - * Custom recommender as set in the settings - */ - public recommender: string | null = null; - public searchLists: SearchListDefinition[] = [ { observable: this.repo.getViewModelListObservable(), @@ -103,11 +94,6 @@ export class OriginMotionMetaDataComponent extends BaseMotionDetailChildComponen private _supportersSubject = new BehaviorSubject([]); - /** - * The subscription to the recommender config variable. - */ - private recommenderSubscription: Subscription | null = null; - public constructor( protected override translate: TranslateService, public perms: MotionPermissionService, @@ -136,10 +122,6 @@ export class OriginMotionMetaDataComponent extends BaseMotionDetailChildComponen super.ngOnDestroy(); } - protected override onAfterInit(): void { - this.setupRecommender(); - } - protected override onAfterSetMotion(previous: ViewMotion, current: ViewMotion): void { super.onAfterSetMotion(previous, current); this.updateSupportersSubject(); @@ -234,11 +216,6 @@ export class OriginMotionMetaDataComponent extends BaseMotionDetailChildComponen this.repo.followRecommendation(this.motion); } - public getPossibleRecommendations(): ViewMotionState[] { - const allStates = this.motion.state?.workflow?.states || []; - return allStates.filter(state => state.recommendation_label).sort((a, b) => a.weight - b.weight); - } - public getMeetingName(origin: ViewMotion | ViewMeeting): string { if (this.isViewMotion(origin)) { const motion = origin as ViewMotion; @@ -270,39 +247,4 @@ export class OriginMotionMetaDataComponent extends BaseMotionDetailChildComponen private isViewMotion(toTest: ViewMotion | ViewMeeting): boolean { return toTest.COLLECTION === Motion.COLLECTION; } - - /** - * Observes the repository for changes in the motion recommender - */ - private setupRecommender(): void { - if (this.motion) { - const configKey: keyof Settings = `motions_recommendations_by`; - if (this.recommenderSubscription) { - this.recommenderSubscription.unsubscribe(); - } - this.recommenderSubscription = this.meetingSettingsService.get(configKey).subscribe(recommender => { - this.recommender = recommender; - }); - } - } - - private async checkPresenter(): Promise<(Selectable & { name: string; toString: any })[]> { - const meetingId = this.activeMeetingService.meetingId; - const committees = - this.operator.hasPerms(Permission.motionCanManageMetadata) && !!meetingId - ? await this.presenter.call({ meeting_id: meetingId }) - : []; - const forwardingCommittees: (Selectable & { name: string; toString: any })[] = []; - for (let n = 0; n < committees.length; n++) { - forwardingCommittees.push({ - id: n + 1, - name: committees[n], - getTitle: () => committees[n], - getListTitle: () => ``, - toString: () => committees[n] - }); - } - - return forwardingCommittees; - } }