Skip to content

Commit

Permalink
fix(distribution): ensure only suspended inquiries can be withdrawn
Browse files Browse the repository at this point in the history
  • Loading branch information
luytena authored and anehx committed Oct 24, 2022
1 parent 9b28ee7 commit 263a1d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/distribution/addon/abilities/inquiry.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ export default class InquiryAbility extends Ability {
}

get canWithdraw() {
return this.config.permissions.withdrawInquiry?.(this.model) ?? true;
return (
!this.config.ui.readonly &&
this.model?.task.slug === this.config.inquiry.task &&
this.model?.status === "SUSPENDED" &&
(this.config.permissions.withdrawInquiry?.(this.model) ?? true) &&
this.model?.controllingGroups
.map(String)
.includes(String(this.calumaOptions.currentGroupId))
);
}

get canAnswer() {
Expand Down

0 comments on commit 263a1d1

Please sign in to comment.