Fixes an issue regarding self-set-present

This commit is contained in:
Sean 2020-04-20 19:17:03 +02:00
parent d210496146
commit 91d4b3c7af

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);
} }
} }
} }