Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions server/graphql/common/expenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ export const canSeeExpenseInvoiceInfo: ExpensePermissionEvaluator = async (
) => {
if (!validateExpenseScope(req)) {
return false;
} else if (getContextPermission(req, PERMISSION_TYPE.SEE_EXPENSE_DRAFT_PRIVATE_DETAILS, expense.id)) {
return true;
}

return remoteUserMeetsOneCondition(
Expand Down
5 changes: 5 additions & 0 deletions server/graphql/v2/object/Expense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ export const GraphQLExpense = new GraphQLObjectType<ExpenseModel, Express.Reques
reference: {
type: GraphQLString,
description: 'User-provided reference number or any other identifier that references the invoice',
async resolve(expense, _, req) {
if (await ExpenseLib.canSeeExpenseInvoiceInfo(req, expense)) {
return expense.reference;
}
},
},
amount: {
type: new GraphQLNonNull(GraphQLInt),
Expand Down
Loading