mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
[OP#73293] Creates POST /api/v3/wiki_page_links endpoint (#23529)
* Remove the `render_author` method as it is unnecessary * Add the necessary paths, clarify the param to wiki_provider path * Rework the representers, merge upstream changes to the create contract * Remove unnecessary mixin and make everything read-only * Create Endpoint for POST /api/v3/wiki_page_links * Incorporates @Kharonus feedback in testing multiple page link creation
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
@@ -31,7 +33,7 @@ module API
|
||||
module Endpoints
|
||||
class Modify < Bodied
|
||||
def default_instance_generator(model)
|
||||
->(_params, _current_user) do
|
||||
lambda do |_params, _current_user|
|
||||
instance_variable_get(:"@#{model.name.demodulize.underscore}")
|
||||
end
|
||||
end
|
||||
@@ -79,12 +81,13 @@ module API
|
||||
key,
|
||||
dependent_class: result.model_name.human,
|
||||
related_id: result.id,
|
||||
# TODO: Make it more robust, as not every model has a 'name' attribute (e.g. fall back to collection index?)
|
||||
related_subject: result.name,
|
||||
related_subject: dependent_error_subject(result),
|
||||
error: full_message
|
||||
)
|
||||
end
|
||||
|
||||
def dependent_error_subject(dependent_result) = dependent_result.name
|
||||
|
||||
def deduce_process_service
|
||||
lookup_namespaced_class("#{update_or_create}Service")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user