updated logic to automatically assign the current user as approver if he is included in the approvers list when move a file to under approval
This commit is contained in:
parent
de93959f2c
commit
c9b7dbe5ab
@ -93,10 +93,10 @@ export class FileActionService {
|
|||||||
callback?: Function,
|
callback?: Function,
|
||||||
ignoreChanged = false,
|
ignoreChanged = false,
|
||||||
) {
|
) {
|
||||||
const userIds =
|
const userIds = this._getUserIds(mode);
|
||||||
mode === 'approver' ? this._dossiersService.activeDossier.approverIds : this._dossiersService.activeDossier.memberIds;
|
if (userIds.length === 1 || (userIds.includes(this._userService.currentUser.id) && mode === 'approver')) {
|
||||||
if (userIds.length === 1) {
|
const userId = userIds.length === 1 ? userIds[0] : this._userService.currentUser.id;
|
||||||
this._assignFile(userIds[0], mode, [file]).then(async () => {
|
this._assignFile(userId, mode, [file]).then(async () => {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
await callback();
|
await callback();
|
||||||
}
|
}
|
||||||
@ -135,6 +135,10 @@ export class FileActionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getUserIds(mode: 'reviewer' | 'approver') {
|
||||||
|
return mode === 'approver' ? this._dossiersService.activeDossier.approverIds : this._dossiersService.activeDossier.memberIds;
|
||||||
|
}
|
||||||
|
|
||||||
private async _assignReviewerToCurrentUser(files: File[], callback?: Function) {
|
private async _assignReviewerToCurrentUser(files: File[], callback?: Function) {
|
||||||
await this._fileService
|
await this._fileService
|
||||||
.setReviewerFor(
|
.setReviewerFor(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user