From d3faec107065b985978afd750656ae67ae5a9c0d Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Fri, 8 May 2020 12:28:37 +0200 Subject: [PATCH] Rename service --- .../my_module_repositories_controller.rb | 22 +++++++++---------- ...b => my_module_assign_unassign_service.rb} | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) rename app/services/repository_rows/{my_module_update_rows_service.rb => my_module_assign_unassign_service.rb} (99%) diff --git a/app/controllers/my_module_repositories_controller.rb b/app/controllers/my_module_repositories_controller.rb index 77e6cf92e..d1b28d9c6 100644 --- a/app/controllers/my_module_repositories_controller.rb +++ b/app/controllers/my_module_repositories_controller.rb @@ -33,14 +33,14 @@ class MyModuleRepositoriesController < ApplicationController end def update - update_row_service = RepositoryRows::MyModuleUpdateRowsService.call(my_module: @my_module, - repository: @repository, - user: current_user, - params: params) - if update_row_service.succeed? && - (update_row_service.assigned_rows_count.positive? || - update_row_service.unassigned_rows_count.positive?) - flash = update_flash_message(update_row_service) + service = RepositoryRows::MyModuleAssignUnassignService.call(my_module: @my_module, + repository: @repository, + user: current_user, + params: params) + if service.succeed? && + (service.assigned_rows_count.positive? || + service.unassigned_rows_count.positive?) + flash = update_flash_message(service) status = :ok else flash = t('my_modules.repository.flash.update_error') @@ -121,9 +121,9 @@ class MyModuleRepositoriesController < ApplicationController render_403 unless can_assign_repository_rows_to_module?(@my_module) end - def update_flash_message(update_row_service) - assigned_count = update_row_service.assigned_rows_count - unassigned_count = update_row_service.unassigned_rows_count + def update_flash_message(service) + assigned_count = service.assigned_rows_count + unassigned_count = service.unassigned_rows_count if params[:downstream] == 'true' if assigned_count && unassigned_count diff --git a/app/services/repository_rows/my_module_update_rows_service.rb b/app/services/repository_rows/my_module_assign_unassign_service.rb similarity index 99% rename from app/services/repository_rows/my_module_update_rows_service.rb rename to app/services/repository_rows/my_module_assign_unassign_service.rb index 8c9716a94..f0a3caa64 100644 --- a/app/services/repository_rows/my_module_update_rows_service.rb +++ b/app/services/repository_rows/my_module_assign_unassign_service.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RepositoryRows - class MyModuleUpdateRowsService + class MyModuleAssignUnassignService extend Service attr_reader :repository,