Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new forward parameter for CRs #3977

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TreeIdNode } from 'src/app/infrastructure/definitions/tree';
import { NullablePartial } from 'src/app/infrastructure/utils';
import { AgendaListTitle } from 'src/app/site/pages/meetings/pages/agenda';
import { ViewMotion } from 'src/app/site/pages/meetings/pages/motions';
import { MotionFormatResult } from 'src/app/site/pages/meetings/pages/motions/services/common/motion-format.service';
import { TreeService } from 'src/app/ui/modules/sorting/modules/sorting-tree/services';

import { Motion } from '../../../../domain/models/motions/motion';
Expand Down Expand Up @@ -61,7 +62,7 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
useOriginalSubmitter: boolean,
useOriginalNumber: boolean,
useOriginalVersion: boolean,
...motions: any[]
...motions: MotionFormatResult[]
): Promise<{ success: number; partial: number }> {
const payloads: any[][] = [];
motions.forEach(motion => {
Expand All @@ -72,6 +73,7 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
use_original_submitter: useOriginalSubmitter,
use_original_number: useOriginalNumber,
with_amendments: useOriginalVersion,
with_change_recommendations: useOriginalVersion,
...motion
};
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export class MotionForwardDialogService extends BaseDialogService<
const motionIds = toForward.map(motion => motion.id);
await this.modelRequest.fetch(getMotionForwardDataSubscriptionConfig(...motionIds));
const forwardMotions = toForward.map(motion =>
this.formatService.formatMotionForForward(this.repo.getViewModel(motion.id))
this.formatService.formatMotionForForward(
this.repo.getViewModel(motion.id),
dialogData.useOriginalVersion
)
);
const result = await this.repo.createForwarded(
toMeetingIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ViewMotion } from '../../../view-models';
import { AmendmentControllerService } from '../amendment-controller.service';
import { MotionLineNumberingService } from '../motion-line-numbering.service';

interface MotionFormatResult {
export interface MotionFormatResult {
origin_id: Id;
title: string;
text: string;
Expand Down Expand Up @@ -114,16 +114,21 @@ export class MotionFormatService {
* Format the motion for forwarding, tries to get the mod final version or the
* final version with all unified changes
*/
public formatMotionForForward(motion: ViewMotion): MotionFormatResult {
public formatMotionForForward(motion: ViewMotion, useOriginal?: boolean): MotionFormatResult {
const lineLength = this.settings.instant(`motions_line_length`);
const finalMotionText = this.getFinalMotionText(motion, lineLength!);
const textWithoutLines = this.lineNumberingService.stripLineNumbers(finalMotionText);
let title = motion.title;
let text = motion.text;
bastianjoel marked this conversation as resolved.
Show resolved Hide resolved
if (!useOriginal) {
title = this.getFinalTitle(motion, lineLength);
const finalMotionText = this.getFinalMotionText(motion, lineLength!);
text = this.lineNumberingService.stripLineNumbers(finalMotionText);
bastianjoel marked this conversation as resolved.
Show resolved Hide resolved
}

return {
origin_id: motion.id,
title: this.getFinalTitle(motion, lineLength),
reason: motion.reason || ``,
text: textWithoutLines
title,
text
};
}

Expand Down
Loading