diff --git a/app/graphql/mutations/achievements/award.rb b/app/graphql/mutations/achievements/award.rb index b486049594d7f0a6542ef5ba5134d043ec4ee927..71a46a04a1ce568439ccea20b907b51261aff9a1 100644 --- a/app/graphql/mutations/achievements/award.rb +++ b/app/graphql/mutations/achievements/award.rb @@ -29,10 +29,6 @@ def resolve(args) result = ::Achievements::AwardService.new(current_user, achievement.id, recipient_id).execute { user_achievement: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Achievements::Achievement) - end end end end diff --git a/app/graphql/mutations/achievements/create.rb b/app/graphql/mutations/achievements/create.rb index 310a653c70558f6e138256b2daf6dcb721f6ca4d..497eaee9b70cad554efe52abdf1df98ae6c73c74 100644 --- a/app/graphql/mutations/achievements/create.rb +++ b/app/graphql/mutations/achievements/create.rb @@ -41,10 +41,6 @@ def resolve(args) params: args).execute { achievement: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Namespace) - end end end end diff --git a/app/graphql/mutations/achievements/delete.rb b/app/graphql/mutations/achievements/delete.rb index 0b510b44b4ef37d89ce9fb79e5bf9b1ccd69592b..fc00261a17670d8ed72e46794f9116b30cdde3f3 100644 --- a/app/graphql/mutations/achievements/delete.rb +++ b/app/graphql/mutations/achievements/delete.rb @@ -24,10 +24,6 @@ def resolve(args) result = ::Achievements::DestroyService.new(current_user, achievement).execute { achievement: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Achievements::Achievement) - end end end end diff --git a/app/graphql/mutations/achievements/delete_user_achievement.rb b/app/graphql/mutations/achievements/delete_user_achievement.rb index f1527c2981ab459dad30026f2758e577333d7aa3..be4c5a1d5e2f02735962aee79e6f6d80841fafca 100644 --- a/app/graphql/mutations/achievements/delete_user_achievement.rb +++ b/app/graphql/mutations/achievements/delete_user_achievement.rb @@ -24,10 +24,6 @@ def resolve(args) result = ::Achievements::DestroyUserAchievementService.new(current_user, user_achievement).execute { user_achievement: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Achievements::UserAchievement) - end end end end diff --git a/app/graphql/mutations/achievements/revoke.rb b/app/graphql/mutations/achievements/revoke.rb index 9d21b1c374101e83c833dbab345bcba6d031f429..ac5b38cefbf69163a56cbc60de7c5210b5d12002 100644 --- a/app/graphql/mutations/achievements/revoke.rb +++ b/app/graphql/mutations/achievements/revoke.rb @@ -24,10 +24,6 @@ def resolve(args) result = ::Achievements::RevokeService.new(current_user, user_achievement).execute { user_achievement: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Achievements::UserAchievement) - end end end end diff --git a/app/graphql/mutations/achievements/update.rb b/app/graphql/mutations/achievements/update.rb index 2a9e6580629620c3cd9742e74ba9e84832d287f8..8bb95ac41f35d2435da31756280cab7fa5426657 100644 --- a/app/graphql/mutations/achievements/update.rb +++ b/app/graphql/mutations/achievements/update.rb @@ -37,10 +37,6 @@ def resolve(args) result = ::Achievements::UpdateService.new(current_user, achievement, args).execute { achievement: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Achievements::Achievement) - end end end end diff --git a/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb b/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb index 9434ac1637e9e8ef4d70703e63d2928718fe55a8..760005ae249b4ca68c1d4e882f476b7ff0646b9c 100644 --- a/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb +++ b/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb @@ -13,10 +13,6 @@ class HttpIntegrationBase < BaseMutation private - def find_object(id:) - GitlabSchema.object_from_id(id, expected_class: ::AlertManagement::HttpIntegration) - end - def response(result) { integration: result.payload[:integration], diff --git a/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb b/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb index 28729ec70cdf21857cb37629244a0eaaedb1b0c0..19fb514d3a5550f5d5dfc0d39e9eebb0ace067e6 100644 --- a/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb +++ b/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb @@ -13,10 +13,6 @@ class PrometheusIntegrationBase < BaseMutation private - def find_object(id:) - GitlabSchema.object_from_id(id, expected_class: ::Integrations::Prometheus) - end - def response(integration, result) { integration: integration, diff --git a/app/graphql/mutations/boards/destroy.rb b/app/graphql/mutations/boards/destroy.rb index 61e0c95f8d345e844e768580524e96e0cdb6776d..abdffaaeb90c37329072677cb2ce4aa0adf5a206 100644 --- a/app/graphql/mutations/boards/destroy.rb +++ b/app/graphql/mutations/boards/destroy.rb @@ -26,12 +26,6 @@ def resolve(id:) errors: response.errors } end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Board) - end end end end diff --git a/app/graphql/mutations/boards/lists/create.rb b/app/graphql/mutations/boards/lists/create.rb index 590a905ab7b3b81a6b7cbf864f1182a5ba4542ce..a80a6af9e2fc94a46700b845a9e2e5ca0acfafbf 100644 --- a/app/graphql/mutations/boards/lists/create.rb +++ b/app/graphql/mutations/boards/lists/create.rb @@ -19,10 +19,6 @@ class Create < BaseCreate private - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Board) - end - def create_list(board, params) create_list_service = ::Boards::Lists::CreateService.new(board.resource_parent, current_user, params) diff --git a/app/graphql/mutations/custom_emoji/destroy.rb b/app/graphql/mutations/custom_emoji/destroy.rb index 64e3f2ed7d3cdc9a4098f3612029e96ae577485f..0dd989ad841e15e63986ac8289d133a737e4059b 100644 --- a/app/graphql/mutations/custom_emoji/destroy.rb +++ b/app/graphql/mutations/custom_emoji/destroy.rb @@ -29,12 +29,6 @@ def resolve(id:) custom_emoji: custom_emoji } end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::CustomEmoji) - end end end end diff --git a/app/graphql/mutations/customer_relations/contacts/create.rb b/app/graphql/mutations/customer_relations/contacts/create.rb index 5b4063fb89a5758237a87542f9fb8da18e3e2813..e3a8eba14c8cbee191b314575b8fd0e6fc076266 100644 --- a/app/graphql/mutations/customer_relations/contacts/create.rb +++ b/app/graphql/mutations/customer_relations/contacts/create.rb @@ -43,10 +43,6 @@ def resolve(args) result = ::CustomerRelations::Contacts::CreateService.new(group: group, current_user: current_user, params: args).execute { contact: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Group) - end end end end diff --git a/app/graphql/mutations/customer_relations/organizations/create.rb b/app/graphql/mutations/customer_relations/organizations/create.rb index 43c50a9fb30cc0ba10aebff50f9724302482bc42..9be66830640db39807825938e912edd5c87b50d3 100644 --- a/app/graphql/mutations/customer_relations/organizations/create.rb +++ b/app/graphql/mutations/customer_relations/organizations/create.rb @@ -41,10 +41,6 @@ def resolve(args) result = ::CustomerRelations::Organizations::CreateService.new(group: group, current_user: current_user, params: args).execute { organization: result.payload, errors: result.errors } end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Group) - end end end end diff --git a/app/graphql/mutations/saved_replies/base.rb b/app/graphql/mutations/saved_replies/base.rb index 79761645eb7d885906daee97b63e8b39353f29fd..d89cb2d06f0846e4b85e20027687a938ff26e227 100644 --- a/app/graphql/mutations/saved_replies/base.rb +++ b/app/graphql/mutations/saved_replies/base.rb @@ -22,10 +22,6 @@ def present_result(result) } end end - - def find_object(id) - GitlabSchema.find_by_gid(id) - end end end end diff --git a/app/graphql/mutations/saved_replies/destroy.rb b/app/graphql/mutations/saved_replies/destroy.rb index 655ed9cb79809ff37347308a20e62511b440b9d4..14223c06d0cbda82e22addddc7365c04320835d6 100644 --- a/app/graphql/mutations/saved_replies/destroy.rb +++ b/app/graphql/mutations/saved_replies/destroy.rb @@ -12,7 +12,7 @@ class Destroy < Base description: copy_field_description(Types::SavedReplyType, :id) def resolve(id:) - saved_reply = authorized_find!(id) + saved_reply = authorized_find!(id: id) result = ::Users::SavedReplies::DestroyService.new(saved_reply: saved_reply).execute present_result(result) end diff --git a/app/graphql/mutations/saved_replies/update.rb b/app/graphql/mutations/saved_replies/update.rb index f5dc81614d2d8319f0e57c1f8d0e11f9455efd7a..72da66736e94281124047725d9895e534947ec92 100644 --- a/app/graphql/mutations/saved_replies/update.rb +++ b/app/graphql/mutations/saved_replies/update.rb @@ -20,7 +20,7 @@ class Update < Base description: copy_field_description(Types::SavedReplyType, :content) def resolve(id:, name:, content:) - saved_reply = authorized_find!(id) + saved_reply = authorized_find!(id: id) result = ::Users::SavedReplies::UpdateService.new(saved_reply: saved_reply, name: name, content: content).execute present_result(result) end diff --git a/app/graphql/mutations/snippets/base.rb b/app/graphql/mutations/snippets/base.rb index acaa7b80843820945e5a5890dcd8aedea0456b12..0144192639673108b3e280a80e391198deea4426 100644 --- a/app/graphql/mutations/snippets/base.rb +++ b/app/graphql/mutations/snippets/base.rb @@ -10,10 +10,6 @@ class Base < BaseMutation private - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Snippet) - end - def authorized_resource?(snippet) return false if snippet.nil? diff --git a/app/graphql/mutations/work_items/convert.rb b/app/graphql/mutations/work_items/convert.rb index b1936027fdcbb9392387706984167707bc048610..c4d4927fde2196ecf3002936373911b73012d457 100644 --- a/app/graphql/mutations/work_items/convert.rb +++ b/app/graphql/mutations/work_items/convert.rb @@ -59,10 +59,6 @@ def authorize_work_item_type!(work_item, work_item_type) message = format(_('You are not allowed to change the Work Item type to %{name}.'), name: work_item_type.name) raise_resource_not_available_error! message end - - def find_object(id:) - GitlabSchema.find_by_gid(id) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/base.rb b/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/base.rb index df6595428ecd0fce3221ba2ae20dc3248236f38c..101875a926129bc4ace673f375b310df4e8c7795 100644 --- a/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/base.rb +++ b/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/base.rb @@ -20,10 +20,6 @@ def audit(config, action:) ::Gitlab::Audit::Auditor.audit(audit_context) end - - def find_object(config_gid) - GitlabSchema.object_from_id(config_gid, expected_type: ::AuditEvents::AmazonS3Configuration) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/delete.rb b/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/delete.rb index 395bb0abc0fdaa94342b3020a6638b1a634992c3..c31f58fd2639022107df782923fa69841b22d654 100644 --- a/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/delete.rb +++ b/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/delete.rb @@ -11,7 +11,7 @@ class Delete < Base description: 'ID of the Amazon S3 configuration to destroy.' def resolve(id:) - config = authorized_find!(id) + config = authorized_find!(id: id) audit(config, action: :deleted) if config.destroy { errors: Array(config.errors) } diff --git a/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/update.rb b/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/update.rb index 2002d5d5b4bfa414cf52e878b453bfc45ab8c4ae..7cd1bbd9d95dca05cec7ee491dc97550c224cd22 100644 --- a/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/update.rb +++ b/ee/app/graphql/mutations/audit_events/amazon_s3_configurations/update.rb @@ -40,7 +40,7 @@ class Update < Base description: 'Updated Amazon S3 configuration.' def resolve(id:, access_key_xid: nil, secret_access_key: nil, bucket_name: nil, aws_region: nil, name: nil) - config = authorized_find!(id) + config = authorized_find!(id: id) config_attributes = { access_key_xid: access_key_xid, secret_access_key: secret_access_key, diff --git a/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_create.rb b/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_create.rb index ab34fa39d0b0c933ecdc3d5e1cd73d8cbcc8461b..d9c2d8fc71346c897e6914a61dbbb5471a6b056a 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_create.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_create.rb @@ -18,7 +18,7 @@ class BaseCreate < BaseMutation description: 'List of event type filters for the audit event external destination.' def resolve(destination_id:, event_type_filters:) - destination = authorized_find!(destination_id) + destination = authorized_find!(id: destination_id) response = ::AuditEvents::Streaming::EventTypeFilters::CreateService.new( destination: destination, diff --git a/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_destroy.rb b/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_destroy.rb index 313bc9edd3db959b8f15dea1d056b1f8dc02b438..63c6559175b5812e848bdd6604ab4f3c3eb65c76 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_destroy.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/base_event_type_filters/base_destroy.rb @@ -14,7 +14,7 @@ class BaseDestroy < BaseMutation end def resolve(destination_id:, event_type_filters:) - destination = authorized_find!(destination_id) + destination = authorized_find!(id: destination_id) response = ::AuditEvents::Streaming::EventTypeFilters::DestroyService.new( destination: destination, diff --git a/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/create.rb b/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/create.rb index af37e05481fbc818def90d56ddbdc3df1ea751b4..299d7d13df1b94838e82f45e18f724e3d2f762c4 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/create.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/create.rb @@ -11,12 +11,6 @@ class Create < BaseEventTypeFilters::BaseCreate argument :destination_id, ::Types::GlobalIDType[::AuditEvents::ExternalAuditEventDestination], required: true, description: 'Destination id.' - - private - - def find_object(destination_id) - ::GitlabSchema.object_from_id(destination_id, expected_type: ::AuditEvents::ExternalAuditEventDestination) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/destroy.rb b/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/destroy.rb index c006468062408ddde0015e86e95d00a4d583d9c2..7e634bb45d933f75e3dc1427d0a25430036601d5 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/destroy.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/event_type_filters/destroy.rb @@ -12,12 +12,6 @@ class Destroy < BaseEventTypeFilters::BaseDestroy argument :destination_id, ::Types::GlobalIDType[::AuditEvents::ExternalAuditEventDestination], required: true, description: 'Destination id.' - - private - - def find_object(destination_id) - GitlabSchema.object_from_id(destination_id, expected_type: ::AuditEvents::ExternalAuditEventDestination) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/headers/create.rb b/ee/app/graphql/mutations/audit_events/streaming/headers/create.rb index c6d71275db1d6a1cd1037e4e8b41e875e6511542..2be5cddc3679c0a18894bfc77dd496840202cb04 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/headers/create.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/headers/create.rb @@ -31,7 +31,7 @@ class Create < BaseMutation def resolve(destination_id:, key:, value:, active:) response = ::AuditEvents::Streaming::Headers::CreateService.new( - destination: authorized_find!(destination_id), + destination: authorized_find!(id: destination_id), params: { key: key, value: value, active: active }, current_user: current_user ).execute @@ -42,12 +42,6 @@ def resolve(destination_id:, key:, value:, active:) { header: nil, errors: response.errors } end end - - private - - def find_object(destination_id) - GitlabSchema.object_from_id(destination_id, expected_type: ::AuditEvents::ExternalAuditEventDestination) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/headers/destroy.rb b/ee/app/graphql/mutations/audit_events/streaming/headers/destroy.rb index 8a47bf09b631f6ef244c4d7423cc260879682910..efb5c9bf27674aac3dc526b9dc3635371ea24b86 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/headers/destroy.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/headers/destroy.rb @@ -27,12 +27,6 @@ def resolve(header_id:) { header: header, errors: response.errors } end end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::AuditEvents::Streaming::Header) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/headers/update.rb b/ee/app/graphql/mutations/audit_events/streaming/headers/update.rb index 400287e949d6b63761820947ea1687a8f58640fd..85966b3ab6dcb84b22da7fcfdeb20bbfc11ff127 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/headers/update.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/headers/update.rb @@ -46,12 +46,6 @@ def resolve(header_id:, key:, value:, active:) { header: header.reset, errors: response.errors } end end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::AuditEvents::Streaming::Header) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/create.rb b/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/create.rb index cb9c1767c228f3d3c8cbd90190f4b1a5313ad0ca..d3623005b2f7bfb28dc8f2bbe97a659f5f2e0e55 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/create.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/create.rb @@ -11,13 +11,6 @@ class Create < BaseEventTypeFilters::BaseCreate argument :destination_id, ::Types::GlobalIDType[::AuditEvents::InstanceExternalAuditEventDestination], required: true, description: 'Destination id.' - - private - - def find_object(destination_id) - ::GitlabSchema.object_from_id(destination_id, - expected_type: ::AuditEvents::InstanceExternalAuditEventDestination) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/destroy.rb b/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/destroy.rb index 687f35c2c86efcd047de471d22ba3c7b2e1db375..295731708f1d29ee850a3fa67409d6d570135897 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/destroy.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/instance_event_type_filters/destroy.rb @@ -12,13 +12,6 @@ class Destroy < BaseEventTypeFilters::BaseDestroy argument :destination_id, ::Types::GlobalIDType[::AuditEvents::InstanceExternalAuditEventDestination], required: true, description: 'Destination id.' - - private - - def find_object(destination_id) - ::GitlabSchema.object_from_id(destination_id, - expected_type: ::AuditEvents::InstanceExternalAuditEventDestination) - end end end end diff --git a/ee/app/graphql/mutations/audit_events/streaming/instance_headers/destroy.rb b/ee/app/graphql/mutations/audit_events/streaming/instance_headers/destroy.rb index 9210001ea3b04e1389b2572359ccd21410b29e2c..408fb473b23a8031d429003dd1b898d7769fa52c 100644 --- a/ee/app/graphql/mutations/audit_events/streaming/instance_headers/destroy.rb +++ b/ee/app/graphql/mutations/audit_events/streaming/instance_headers/destroy.rb @@ -25,12 +25,6 @@ def resolve(header_id:) { header: header, errors: response.errors } end end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::AuditEvents::Streaming::InstanceHeader) - end end end end diff --git a/ee/app/graphql/mutations/boards/epic_lists/create.rb b/ee/app/graphql/mutations/boards/epic_lists/create.rb index cf7f2c826af9b80a384e73f8c29ef5cd4673344c..052d60274fdbd6c7b01d511053a899438bc605b1 100644 --- a/ee/app/graphql/mutations/boards/epic_lists/create.rb +++ b/ee/app/graphql/mutations/boards/epic_lists/create.rb @@ -17,12 +17,6 @@ class Create < ::Mutations::Boards::Lists::BaseCreate authorize :admin_epic_board_list - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Boards::EpicBoard) - end - def create_list(board, params) create_list_service = ::Boards::EpicLists::CreateService.new(board.group, current_user, params) diff --git a/ee/app/graphql/mutations/boards/update_epic_user_preferences.rb b/ee/app/graphql/mutations/boards/update_epic_user_preferences.rb index 8f1e6c0aea6f78b5dd85f2d29fbcdd2fd571db56..51903a536d8f11c5d4b70975eb9731cc50395962 100644 --- a/ee/app/graphql/mutations/boards/update_epic_user_preferences.rb +++ b/ee/app/graphql/mutations/boards/update_epic_user_preferences.rb @@ -50,10 +50,6 @@ def find_epic(epic_id) rescue ActiveRecord::RecordNotFound nil end - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::Board) - end end end end diff --git a/ee/app/graphql/mutations/compliance_management/frameworks/destroy.rb b/ee/app/graphql/mutations/compliance_management/frameworks/destroy.rb index a5c5605bd44e322d8a8d332609866489ea5fb8ba..234917be25e581d1eb4b6982d7ed46deebe5b0a6 100644 --- a/ee/app/graphql/mutations/compliance_management/frameworks/destroy.rb +++ b/ee/app/graphql/mutations/compliance_management/frameworks/destroy.rb @@ -19,12 +19,6 @@ def resolve(id:) { errors: result.success? ? [] : Array.wrap(result.message) } end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::ComplianceManagement::Framework) - end end end end diff --git a/ee/app/graphql/mutations/compliance_management/frameworks/update.rb b/ee/app/graphql/mutations/compliance_management/frameworks/update.rb index 81558f0c6b63ee8b81ca9d88a6649e2198f05589..16fbe77a9a1b2e1f499981270bcaaf5265fae731 100644 --- a/ee/app/graphql/mutations/compliance_management/frameworks/update.rb +++ b/ee/app/graphql/mutations/compliance_management/frameworks/update.rb @@ -29,12 +29,6 @@ def resolve(id:, **args) params: args[:params].to_h).execute { compliance_framework: framework, errors: errors_on_object(framework) } end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::ComplianceManagement::Framework) - end end end end diff --git a/ee/app/graphql/mutations/geo/registries/update.rb b/ee/app/graphql/mutations/geo/registries/update.rb index e45eaf0f1618f3aac8f0aa6832acad8248ecc178..4dbb5cded0044e76bb22914e7a228ff2d26e7795 100644 --- a/ee/app/graphql/mutations/geo/registries/update.rb +++ b/ee/app/graphql/mutations/geo/registries/update.rb @@ -33,7 +33,7 @@ class Update < BaseMutation # and it is `required: false`, expecting to be removed entirely. # Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/424563 def resolve(action:, registry_id:, registry_class:) # rubocop:disable Lint/UnusedMethodArgument - registry = authorized_find!(registry_id) + registry = authorized_find!(id: registry_id) result = ::Geo::RegistryUpdateService.new(action, registry).execute @@ -44,12 +44,6 @@ def resolve(action:, registry_id:, registry_class:) # rubocop:disable Lint/Unus def read_only? false end - - private - - def find_object(id) - GitlabSchema.find_by_gid(id) - end end end end diff --git a/ee/app/graphql/mutations/incident_management/oncall_rotation/update.rb b/ee/app/graphql/mutations/incident_management/oncall_rotation/update.rb index bf71230c940d16846cabaabd1432e1e416ae9b25..4fafd5d47d5d50727112b5f1bb59656e297c85aa 100644 --- a/ee/app/graphql/mutations/incident_management/oncall_rotation/update.rb +++ b/ee/app/graphql/mutations/incident_management/oncall_rotation/update.rb @@ -52,7 +52,7 @@ def resolve(id:, **args) private def find_object(id:) - GitlabSchema.object_from_id(id, expected_type: ::IncidentManagement::OncallRotation) + GitlabSchema.find_by_gid(id) end def raise_rotation_not_found diff --git a/ee/app/graphql/mutations/remote_development/workspaces/update.rb b/ee/app/graphql/mutations/remote_development/workspaces/update.rb index ebbfee11f448eb99c5d6ad5a21d5622b4f21f2ab..749f5744009280cadbd35908b42e614c3b130110 100644 --- a/ee/app/graphql/mutations/remote_development/workspaces/update.rb +++ b/ee/app/graphql/mutations/remote_development/workspaces/update.rb @@ -44,12 +44,6 @@ def resolve(id:, **args) errors: response.errors } end - - private - - def find_object(id:) - GitlabSchema.find_by_gid(id) - end end end end diff --git a/ee/app/graphql/mutations/users/abuse/namespace_bans/destroy.rb b/ee/app/graphql/mutations/users/abuse/namespace_bans/destroy.rb index ba724646b65003be6948b4f85d9d6d67a87aba55..a1e3f0d7b8546ffcade74935907e90434fa426c9 100644 --- a/ee/app/graphql/mutations/users/abuse/namespace_bans/destroy.rb +++ b/ee/app/graphql/mutations/users/abuse/namespace_bans/destroy.rb @@ -31,12 +31,6 @@ def resolve(id:) errors: response.errors } end - - private - - def find_object(id:) - GitlabSchema.object_from_id(id, expected_class: ::Namespaces::NamespaceBan) - end end end end diff --git a/ee/app/graphql/mutations/vulnerabilities/create_issue_link.rb b/ee/app/graphql/mutations/vulnerabilities/create_issue_link.rb index fe970f9f5732f4cca94b465d0862d22f30ecac44..a88c33c8b72c7cf8abe0ea5b8302328dcb902942 100644 --- a/ee/app/graphql/mutations/vulnerabilities/create_issue_link.rb +++ b/ee/app/graphql/mutations/vulnerabilities/create_issue_link.rb @@ -56,10 +56,6 @@ def vulnerabilities(vulnerability_ids) vulnerabilities end - def find_object(id:) - GitlabSchema.find_by_gid(id) - end - def create_issue_links(issue, vulnerabilities) ::VulnerabilityIssueLinks::BulkCreateService.new(current_user, issue, vulnerabilities).execute end diff --git a/ee/spec/graphql/ee/mutations/boards/lists/create_spec.rb b/ee/spec/graphql/ee/mutations/boards/lists/create_spec.rb index 4c39b7f1e8d0d829bde36ab4fdcf1ea373b96e4a..ddf47e5f1eb65aaaa036a968fd2a79ada517bccd 100644 --- a/ee/spec/graphql/ee/mutations/boards/lists/create_spec.rb +++ b/ee/spec/graphql/ee/mutations/boards/lists/create_spec.rb @@ -24,7 +24,7 @@ stub_licensed_features(board_assignee_lists: true, board_milestone_lists: true, board_iteration_lists: true) end - subject { mutation.resolve(board_id: board.to_global_id.to_s, **list_create_params) } + subject { mutation.resolve(board_id: board.to_global_id, **list_create_params) } describe '#ready?' do it 'raises an error if required arguments are missing' do diff --git a/ee/spec/requests/api/graphql/mutations/audit_events/amazon_s3_configurations/update_spec.rb b/ee/spec/requests/api/graphql/mutations/audit_events/amazon_s3_configurations/update_spec.rb index d6785b29cc048606ea65b9fdcfbe65a23dc17f90..9eed9da5579453c50c785bb49d065a96d47b888b 100644 --- a/ee/spec/requests/api/graphql/mutations/audit_events/amazon_s3_configurations/update_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/audit_events/amazon_s3_configurations/update_spec.rb @@ -115,7 +115,7 @@ context 'when there is error while updating' do before do allow_next_instance_of(Mutations::AuditEvents::AmazonS3Configurations::Update) do |mutation| - allow(mutation).to receive(:authorized_find!).with(config_gid).and_return(config) + allow(mutation).to receive(:authorized_find!).with(id: config_gid).and_return(config) end allow(config).to receive(:update).and_return(false) diff --git a/spec/support/shared_examples/graphql/mutations/boards_list_create_shared_examples.rb b/spec/support/shared_examples/graphql/mutations/boards_list_create_shared_examples.rb index 13d2447754ca6b72034c31a7562ca23ee26b22cd..eb58cb97a7524d3a2f543f5f441eaf5cd524ebac 100644 --- a/spec/support/shared_examples/graphql/mutations/boards_list_create_shared_examples.rb +++ b/spec/support/shared_examples/graphql/mutations/boards_list_create_shared_examples.rb @@ -10,7 +10,7 @@ let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) } let(:list_create_params) { {} } - subject { mutation.resolve(board_id: board.to_global_id.to_s, **list_create_params) } + subject { mutation.resolve(board_id: board.to_global_id, **list_create_params) } describe '#ready?' do it 'raises an error if required arguments are missing' do