mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-29 23:46:32 +08:00
Merge pull request #8719 from okriuchykhin/ok_SCI_12174
Fix listing of protocol templates [SCI-12174]
This commit is contained in:
commit
45f7cdade2
2 changed files with 8 additions and 9 deletions
|
|
@ -11,13 +11,11 @@ module Api
|
|||
end
|
||||
|
||||
def index
|
||||
protocol_templates =
|
||||
timestamps_filter(
|
||||
Protocol.latest_available_versions(@team)
|
||||
)
|
||||
.readable_by_user(current_user, @team)
|
||||
.page(params.dig(:page, :number))
|
||||
.per(params.dig(:page, :size))
|
||||
protocol_templates = timestamps_filter(Protocol.latest_available_versions(@team))
|
||||
# Team owners see all protocol templates in the team
|
||||
protocol_templates = protocol_templates.readable_by_user(current_user, @team) unless can_manage_team?(@team)
|
||||
protocol_templates = protocol_templates.page(params.dig(:page, :number))
|
||||
.per(params.dig(:page, :size))
|
||||
|
||||
render jsonapi: protocol_templates,
|
||||
each_serializer: ProtocolTemplateSerializer, rte_rendering: render_rte?, team: @team
|
||||
|
|
|
|||
|
|
@ -85,10 +85,11 @@ class ProtocolsController < ApplicationController
|
|||
else
|
||||
current_team.repository_protocols.readable_by_user(current_user, current_team)
|
||||
end
|
||||
render json: Lists::ProtocolsService.new(protocols, params).call,
|
||||
protocols_list = Lists::ProtocolsService.new(protocols, params).call
|
||||
render json: protocols_list,
|
||||
each_serializer: Lists::ProtocolSerializer,
|
||||
user: current_user,
|
||||
meta: pagination_dict(protocols)
|
||||
meta: pagination_dict(protocols_list)
|
||||
end
|
||||
format.html do
|
||||
render 'index'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue