Skip to content
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 @@ -187,7 +187,12 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont

public createTextBased(
partialMotion: Partial<
Motion & { workflow_id: Id; attachment_mediafile_ids?: Id[]; supporter_meeting_user_ids?: Id[] }
Motion & {
workflow_id: Id;
attachment_mediafile_ids?: Id[];
supporter_meeting_user_ids?: Id[];
submitter_meeting_user_ids: Id[];
}
>
): Action<CreateResponse> {
const payload = {
Expand All @@ -196,7 +201,7 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
title: partialMotion.title,
text: partialMotion.text,
origin_id: partialMotion.origin_id,
submitter_ids: partialMotion.submitter_ids,
submitter_meeting_user_ids: partialMotion.submitter_meeting_user_ids,
workflow_id: partialMotion.workflow_id,
category_id: partialMotion.category_id,
attachment_mediafile_ids: partialMotion.attachment_mediafile_ids,
Expand All @@ -212,15 +217,20 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont

public createParagraphBased(
partialMotion: Partial<
Motion & { workflow_id: Id; attachment_mediafile_ids?: Id[]; supporter_meeting_user_ids?: Id[] }
Motion & {
workflow_id: Id;
attachment_mediafile_ids?: Id[];
supporter_meeting_user_ids?: Id[];
submitter_meeting_user_ids: Id[];
}
>
): Action<CreateResponse> {
const payload = {
meeting_id: this.activeMeetingIdService.meetingId,
lead_motion_id: partialMotion.lead_motion_id,
title: partialMotion.title,
origin_id: partialMotion.origin_id,
submitter_ids: partialMotion.submitter_ids === null ? [] : partialMotion.submitter_ids,
submitter_meeting_user_ids: partialMotion.submitter_meeting_user_ids,
workflow_id: partialMotion.workflow_id,
category_id: partialMotion.category_id,
attachment_mediafile_ids:
Expand Down Expand Up @@ -320,7 +330,7 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
title: partialMotion.title,
text: partialMotion.text,
origin_id: partialMotion.origin_id,
submitter_ids: partialMotion.submitter_ids,
submitter_meeting_user_ids: partialMotion.submitter_meeting_user_ids,
additional_submitter: partialMotion.additional_submitter,
workflow_id: partialMotion.workflow_id,
category_id: partialMotion.category_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
<mat-icon class="menu-icon">done</mat-icon>
<span class="menu-text">{{ 'Present' | translate }}</span>
</div>
} @else if (!isinMeeting) {
<div mat-menu-item>
<mat-icon class="menu-icon">clear</mat-icon>
<span class="menu-text">{{ 'Not part of meeting' | translate }}</span>
</div>
} @else {
<div mat-menu-item>
<mat-icon class="menu-icon">clear</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ export class AccountButtonComponent extends BaseUiComponent implements OnInit {

private _langTriggerSubscription: Subscription;

public get isinMeeting(): boolean {
return this.hasActiveMeeting && this.operator.isInMeeting(this.activeMeetingId) && !this.operator.isAnonymous;
}

public get isPresent(): boolean {
return this.hasActiveMeeting && this.operator.isInMeeting(this.activeMeetingId) && !this.operator.isAnonymous
? this.user.isPresentInMeeting()
: false;
return this.isinMeeting && this.user.isPresentInMeeting();
}

public get isAllowedSelfSetPresent(): boolean {
return this._isAllowedSelfSetPresent && this.operator.isInMeeting(this.activeMeetingId);
return this.isinMeeting && this._isAllowedSelfSetPresent;
}

public get hasActiveMeeting(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@if (poll && isReady) {
<!-- own voting -->
@if (isUserPresent) {
@if (!isUserInMeeting) {
<div class="text-center">
{{ 'You are not part of the meeting' | translate }}
</div>
} @else if (isUserPresent) {
<ng-container [ngTemplateOutlet]="votingArea" />
} @else {
<div class="text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export abstract class BasePollVoteComponent<C extends PollContentObject = any> e
return this.user?.isPresentInMeeting();
}

public get isUserInMeeting(): boolean {
return this.user?.isInActiveMeeting;
}

public get isMobile(): boolean {
return this.viewport.isMobile;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnDestroy } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { MatSnackBar } from '@angular/material/snack-bar';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, Subscription } from 'rxjs';
import { Id } from 'src/app/domain/definitions/key-types';
Expand Down Expand Up @@ -162,7 +163,8 @@ export class AssignmentDetailComponent extends BaseMeetingComponent implements O
private pollDialog: AssignmentPollDialogService,
private assignmentPollService: AssignmentPollService,
private pollController: PollControllerService,
private userRepo: UserControllerService
private userRepo: UserControllerService,
private snackBar: MatSnackBar
) {
super();
this.assignmentForm = formBuilder.group({
Expand Down Expand Up @@ -355,7 +357,12 @@ export class AssignmentDetailComponent extends BaseMeetingComponent implements O
* Adds the operator to list of candidates
*/
public async addSelf(): Promise<void> {
await this.addCandidate({ userId: this.operator.operatorId! });
if (!this.operator.isInMeeting(this.activeMeetingIdService.meetingId)) {
const infoMessage = this.translate.instant(`Action not possible. You have to be part of the meeting.`);
this.snackBar.open(infoMessage, this.translate.instant(`Ok`));
} else {
await this.addCandidate({ userId: this.operator.operatorId! });
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<mat-form-field appearance="outline" class="chat-form-field full-width" (keydown)="onKeyDown($event)">
<mat-form-field
appearance="outline"
class="chat-form-field full-width"
[color]="isPartOfMeeting() ? 'accent' : 'warn'"
(keydown)="onKeyDown($event)"
>
@if (currentMessage) {
<div class="chat-form-field-prefix flex-vertical-center" matPrefix>
<span>{{ 'Edit' | translate }}</span>
Expand All @@ -25,14 +30,21 @@
</mat-hint>
}
<button
color="accent"
mat-icon-button
matSuffix
matTooltip=" {{ 'Send' | translate }}"
type="button"
[color]="isPartOfMeeting() ? 'accent' : 'warn'"
[disabled]="!isMessageFormValid"
(click)="sendChatMessage()"
>
<mat-icon>send</mat-icon>
</button>
@if (!isPartOfMeeting()) {
<mat-hint>
<span class="warn">
{{ 'You have to be part of the meeting to write messages.' | translate }}
</span>
</mat-hint>
}
</mat-form-field>
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { UntypedFormBuilder, UntypedFormControl, Validators } from '@angular/forms';
import { MatSnackBar } from '@angular/material/snack-bar';
import { TranslateService } from '@ngx-translate/core';
import { CHAT_MESSAGE_MAX_LENGTH } from 'src/app/gateways/repositories/chat/chat-message-repository.service';
import { KeyCode } from 'src/app/infrastructure/utils/key-code';
import { ViewChatMessage } from 'src/app/site/pages/meetings/pages/chat';
import { ActiveMeetingIdService } from 'src/app/site/pages/meetings/services/active-meeting-id.service';
import { OperatorService } from 'src/app/site/services/operator.service';

@Component({
selector: `os-chat-group-detail-message-form`,
Expand Down Expand Up @@ -37,7 +41,13 @@ export class ChatGroupDetailMessageFormComponent {

private _currentMessage: ViewChatMessage | null = null;

public constructor(fb: UntypedFormBuilder) {
public constructor(
fb: UntypedFormBuilder,
private operator: OperatorService,
private activeMeetingIdService: ActiveMeetingIdService,
private translate: TranslateService,
private snackBar: MatSnackBar
) {
this.messageForm = fb.control(``, [Validators.maxLength(CHAT_MESSAGE_MAX_LENGTH)]);
}

Expand All @@ -49,9 +59,14 @@ export class ChatGroupDetailMessageFormComponent {
}

public sendChatMessage(): void {
const content = this.messageForm.value?.trim() as string;
this.messageSent.emit(content);
this.resetMessageForm();
if (!this.isPartOfMeeting()) {
const infoMessage = this.translate.instant(`Action not possible. You have to be part of the meeting.`);
this.snackBar.open(infoMessage, this.translate.instant(`Ok`));
} else {
const content = this.messageForm.value?.trim() as string;
this.messageSent.emit(content);
this.resetMessageForm();
}
}

public cancelEditingChatMessage(): void {
Expand All @@ -63,4 +78,8 @@ export class ChatGroupDetailMessageFormComponent {
this.currentMessage = null;
this.messageForm.markAsPristine();
}

public isPartOfMeeting(): boolean {
return this.operator.isInMeeting(this.activeMeetingIdService.meetingId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,17 @@ export class AmendmentCreateWizardComponent extends BaseMeetingComponent impleme
amendmentParagraphs[paraNo] = this.contentForm.value[`text_` + paraNo];
}
});
const submitterMeetingUserId = this.operator.isInMeeting(this.activeMeetingId)
? [this.operator.user.getMeetingUser(this.activeMeetingId)?.id]
: [];
const motionCreate = {
...this.contentForm.value,
title: this.translate.instant(`Amendment to`) + ` ` + this.motion.getNumberOrTitle(),
parent_id: this.motion.id,
category_id: this.operator.hasPerms(Permission.motionCanManage) ? this.motion.category_id : undefined,
lead_motion_id: this.motion.id,
amendment_paragraphs: amendmentParagraphs,
submitter_meeting_user_ids: submitterMeetingUserId,
workflow_id: this.meetingSettingsService.instant(`motions_default_amendment_workflow_id`)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ export class MotionFormComponent extends BaseMeetingComponent implements OnInit
}

if (this.newMotion) {
if (update.submitter_ids.length === 0 && this.operator.isInMeeting(this.activeMeetingId)) {
update.submitter_meeting_user_ids = [this.operator.user.getMeetingUser(this.activeMeetingId).id];
} else {
update.submitter_meeting_user_ids = update.submitter_ids;
}
for (const key in update) {
if (update[key] === null || update[key].length === 0) {
delete update[key];
Expand Down Expand Up @@ -323,7 +328,7 @@ export class MotionFormComponent extends BaseMeetingComponent implements OnInit

public async createNewSubmitter(username: string): Promise<void> {
const newUserObj = await this.createNewUser(username);
this.addNewUserToFormCtrl(newUserObj, `submitter_ids`);
this.addNewUserToFormCtrl(newUserObj, `submitter_meeting_user_ids`);
}

public async createNewSupporter(username: string): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
mat-icon-button
matTooltip="{{ 'Mark as personal favorite' | translate }}"
matTooltipPosition="right"
[hidden]="publicAccess"
[hidden]="publicAccess || isnotPartOfMeeting"
(click)="setFavorite(!isFavorite)"
>
<mat-icon>{{ isFavorite ? 'star' : 'star_border' }}</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class MotionManageTitleComponent extends BaseMotionDetailChildComponent {
@Input()
public publicAccess: boolean;

@Input()
public isnotPartOfMeeting: boolean;

@Output()
public updateCrMode = new EventEmitter<ChangeRecoMode>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ <h1 class="mock-h2">
<div class="title">
<os-motion-manage-title
[changeRecoMode]="changeRecoMode"
[isnotPartOfMeeting]="!operator.isInMeeting(this.activeMeetingId)"
[motion]="motion"
[publicAccess]="operator.isAnonymous"
(updateCrMode)="changeRecoMode = $event"
Expand Down
Loading