diff options
Diffstat (limited to 'app/serializers/paginated_diff_entity.rb')
-rw-r--r-- | app/serializers/paginated_diff_entity.rb | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/app/serializers/paginated_diff_entity.rb b/app/serializers/paginated_diff_entity.rb index 1118b1aa4fe..a2a9e7375a0 100644 --- a/app/serializers/paginated_diff_entity.rb +++ b/app/serializers/paginated_diff_entity.rb @@ -23,36 +23,13 @@ class PaginatedDiffEntity < Grape::Entity end expose :pagination do - expose :current_page - expose :next_page - expose :total_pages - expose :next_page_href do |diffs| - next unless next_page - - project = merge_request.target_project - - diffs_batch_namespace_project_json_merge_request_path( - namespace_id: project.namespace.to_param, - project_id: project.to_param, - id: merge_request.iid, - page: next_page, - format: :json - ) + expose :total_pages do |diffs, options| + options.dig(:pagination_data, :total_pages) end end private - %i[current_page next_page total_pages].each do |method| - define_method method do - pagination_data[method] - end - end - - def pagination_data - options.fetch(:pagination_data, {}) - end - def merge_request options[:merge_request] end |