OpenSlides/client/src/app/site/motions/models/view-motion-notify.ts
GabrielMeyer 80cb8051f6 Adds notifications if multiple users want to edit the same motion.
Fixes #4217 Adds notifications

- Created a class to define notification-objects, which should notify other persons editing the same motion.
- Added functions to send notifications, listen to them and unsubscribing them.
- Added a warning-function to the `base-view.ts`, which raises the snack bar with the given message and has no duration.

Fixes #4217

- Removed unnecessary lines of code.
- Fixed merge.

Prettified

- Added a random number to identify different user.
- Now the user can sign in as the same user, but still receive a message if multiple people edit the same motion.

Fix the detail of motions

- If the user does not click to edit, then the `editNotificationSubscription` was not set.
2019-02-21 22:37:49 +01:00

53 lines
1.2 KiB
TypeScript

/**
* Enum to define different types of notifications.
*/
export enum TypeOfNotificationViewMotion {
/**
* Type to declare editing a motion.
*/
TYPE_BEGIN_EDITING_MOTION = 'typeBeginEditingMotion',
/**
* Type if the edit-view is closing.
*/
TYPE_CLOSING_EDITING_MOTION = 'typeClosingEditingMotion',
/**
* Type if changes are saved.
*/
TYPE_SAVING_EDITING_MOTION = 'typeSavingEditingMotion',
/**
* Type to declare if another person is also editing the same motion.
*/
TYPE_ALSO_EDITING_MOTION = 'typeAlsoEditingMotion'
}
/**
* Class to specify the notifications for editing a motion.
*/
export interface ViewMotionNotificationEditMotion {
/**
* The id of the motion the user wants to edit.
* Necessary to identify if users edit the same motion.
*/
motionId: number;
/**
* The id of the sender.
* Necessary if this differs from senderUserId.
*/
senderId: number;
/**
* The name of the sender.
* To show the names of the other editors
*/
senderName: string;
/**
* The type of the notification.
* Separates if the user is beginning the work or closing the edit-view.
*/
type: TypeOfNotificationViewMotion;
}