Merge pull request #5319 from tsiegleauq/fix-admin-self-set-present

Fixes an issue regarding self-set-present
This commit is contained in:
Emanuel Schütze 2020-04-20 19:38:11 +02:00 committed by GitHub
commit 2c548d2dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -428,10 +428,10 @@ export class UserListComponent extends BaseListViewComponent<ViewUser> implement
public setPresent(viewUser: ViewUser): void { public setPresent(viewUser: ViewUser): void {
viewUser.user.is_present = !viewUser.user.is_present; viewUser.user.is_present = !viewUser.user.is_present;
if (this.operator.viewUser === viewUser) { if (this.operator.hasPerms('users.can_manage')) {
this.operator.setPresence(viewUser.user.is_present).catch(this.raiseError);
} else {
this.repo.update(viewUser.user, viewUser).catch(this.raiseError); this.repo.update(viewUser.user, viewUser).catch(this.raiseError);
} else if (this.allowSelfSetPresent && this.operator.viewUser === viewUser) {
this.operator.setPresence(viewUser.user.is_present).catch(this.raiseError);
} }
} }
} }