-
Notifications
You must be signed in to change notification settings - Fork 32
Remove the meeting_user when removing a user from a meeting
#3206
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
base: main
Are you sure you want to change the base?
Remove the meeting_user when removing a user from a meeting
#3206
Conversation
…-in-meeting-users
…-in-meeting-users
…-in-meeting-users
hjanott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change it will be impossible to remove a user from a meeting and rejoin him with all relations to meeting user submodels set in place again because the information is lost.
In general I'm against this change unless the user_id is stored in all meeting_user related models as well. However that's also not well designed.
| from ...action import Action | ||
| from ..speaker.delete import SpeakerDeleteAction | ||
| from .set_present import UserSetPresentAction | ||
| from ..user.set_present import UserSetPresentAction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary?
| And( | ||
| FilterOperator("user_id", "=", instance["id"]), | ||
| FilterOperator("meeting_id", "=", removed_meeting_id), | ||
| ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| And( | |
| FilterOperator("user_id", "=", instance["id"]), | |
| FilterOperator("meeting_id", "=", removed_meeting_id), | |
| ), | |
| self.get_meeting_user_filter(instance["id"]), removed_meeting_id)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or use get_meeting_user.
| musers = self.reader.get_all( | ||
| "meeting_user", | ||
| list(COLLECTION_TO_MIGRATION_FIELDS["meeting_user"]) + ["group_ids"], | ||
| ) | ||
| musers_to_delete = { | ||
| id_: { | ||
| field: val | ||
| for field, val in model.items() | ||
| if val and field in list(COLLECTION_TO_MIGRATION_FIELDS["meeting_user"]) | ||
| } | ||
| for id_, model in musers.items() | ||
| if not model.get("group_ids") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more efficient to filter all meeting users where group_ids is empty list or None.
| self, musers_to_delete: dict[int, dict[str, Any]] | ||
| ) -> tuple[list[int], list[BaseRequestEvent]]: | ||
| """ | ||
| Returns the list of speaker_ids that should be deleted ad pos 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Returns the list of speaker_ids that should be deleted ad pos 0 | |
| Returns the list of speaker_ids that should be deleted at pos 0 |
| self.countdown_change_events: list[BaseRequestEvent] = [] | ||
| return delete_speaker_ids, self.countdown_change_events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.countdown_change_events will always be an empty list and never be accessed by its name here. Better to create it after this function was used.
| ) -> tuple[list[int], list[BaseRequestEvent]]: | ||
| """ | ||
| Returns the list of speaker_ids that should be deleted ad pos 0 | ||
| and the list of events for the countdown changes for that deletion at pos 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below comment.
| and the list of events for the countdown changes for that deletion at pos 1 |
| for id_, meeting_user in models_to_delete.items(): | ||
| for field, value in meeting_user.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for id_, meeting_user in models_to_delete.items(): | |
| for field, value in meeting_user.items(): | |
| for id_, model in models_to_delete.items(): | |
| for field, value in model.items(): |
| if field_data := COLLECTION_TO_MIGRATION_FIELDS[collection].get(field): | ||
| if is_list_field(field) and value: | ||
| for val_id in value: | ||
| self.handle_id(collection, id_, val_id, field, field_data) | ||
| elif value: | ||
| self.handle_id(collection, id_, value, field, field_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if field_data := COLLECTION_TO_MIGRATION_FIELDS[collection].get(field): | |
| if is_list_field(field) and value: | |
| for val_id in value: | |
| self.handle_id(collection, id_, val_id, field, field_data) | |
| elif value: | |
| self.handle_id(collection, id_, value, field, field_data) | |
| if field_data := COLLECTION_TO_MIGRATION_FIELDS[collection].get(field) and value: | |
| if is_list_field(field): | |
| for val_id in value: | |
| self.handle_id(collection, id_, val_id, field, field_data) | |
| else: | |
| self.handle_id(collection, id_, value, field, field_data) |
|
If a participant is allowed to create motions/amendments but cannot manage motions/ meta data the backend is stopping the participant from creating the motion/amenment: Motion: Response: Amendment: response: |
Closes #2111
See OpenSlides/openslides-meta#347
submitter_meeting_user_idsinstead of how it was done before (as user ids via the fieldsubmitter_ids)TODO: