Fix PR52 API author visibility and ticket-option user scoping
This commit is contained in:
@@ -123,7 +123,8 @@ class ProjectTicketController extends ApiController
|
||||
? "{$ticket->ticket_key} was updated."
|
||||
: 'No ticket changes were detected.';
|
||||
|
||||
return TicketResource::make($ticket->fresh()->load([
|
||||
$canManageProject = $this->permissionService->allows($user, Permission::ProjectAdmin, $project);
|
||||
$displayTicket = $ticket->fresh([
|
||||
'assignee',
|
||||
'author',
|
||||
'fieldValues.ticketFieldDefinition',
|
||||
@@ -132,7 +133,23 @@ class ProjectTicketController extends ApiController
|
||||
'ticketStatus.boardColumn',
|
||||
'ticketType',
|
||||
'worklogEntries.actor',
|
||||
]))
|
||||
]) ?? $ticket->load([
|
||||
'assignee',
|
||||
'author',
|
||||
'fieldValues.ticketFieldDefinition',
|
||||
'fieldValues.userValue',
|
||||
'ticketPriority',
|
||||
'ticketStatus.boardColumn',
|
||||
'ticketType',
|
||||
'worklogEntries.actor',
|
||||
]);
|
||||
|
||||
if (! $project->show_author && ! $canManageProject) {
|
||||
$displayTicket->setRelation('author', null);
|
||||
$displayTicket->author_user_id = null;
|
||||
}
|
||||
|
||||
return TicketResource::make($displayTicket)
|
||||
->additional([
|
||||
'meta' => [
|
||||
'message' => $statusMessage,
|
||||
|
||||
Reference in New Issue
Block a user