Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #624 from trowik/fix-report-ability
Browse files Browse the repository at this point in the history
fix(ability): can't edit reports if verified and reviewer
  • Loading branch information
trowik committed Oct 6, 2021
2 parents 3a153c1 + 1b0d3e1 commit a299e97
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/abilities/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ export default Ability.extend({
function() {
const isEditable =
this.get("user.isSuperuser") ||
(!(this.get("model.verifiedBy.id") || this.get("model.billed")) &&
(!this.get("model.verifiedBy.id") &&
(this.get("model.user.id") === this.get("user.id") ||
(this.get("model.user.supervisors") ?? [])
.mapBy("id")
.includes(this.get("user.id"))));
const isReviewer = (this.get("model.taskAssignees") ?? [])
.concat(
this.get("model.projectAssignees") ?? [],
this.get("model.customerAssignees") ?? []
)
.mapBy("user.id")
.includes(this.get("user.id"));
const isReviewer =
(this.get("model.taskAssignees") ?? [])
.concat(
this.get("model.projectAssignees") ?? [],
this.get("model.customerAssignees") ?? []
)
.mapBy("user.id")
.includes(this.get("user.id")) && !this.get("model.verifiedBy.id");
return isEditable || isReviewer;
}
)
Expand Down

0 comments on commit a299e97

Please sign in to comment.