Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/policies/receipt_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ def destroy?
return record.user == user
end

# the receipt is on a reimbursement report. people making reports may not be in the organization.
if record.receiptable.instance_of?(Reimbursement::Expense)
return (record.receiptable.report.user == user || OrganizerPosition.role_at_least?(user, record.receiptable.event, :manager)) && unlocked?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could event be nil here if the reimbursement was started via email? Would that be an issue?

end

# any members of events should be able to modify receipts.
if record.receiptable.event
return OrganizerPosition.role_at_least?(user, record.receiptable.event, :member) && unlocked?
end

# the receipt is on a reimbursement report. people making reports may not be in the organization.
if record.receiptable.instance_of?(Reimbursement::Expense)
return record.receiptable.report.user == user && unlocked?
end

return false
end

Expand Down