From 1488f75e26a28f7a4bef9e8353bdc87d827f02f6 Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Wed, 13 Nov 2019 13:57:04 +0100 Subject: [PATCH] Add activities --- app/controllers/protocols_controller.rb | 2 ++ spec/controllers/protocols_controller_spec.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index f24bebfac..624ebf4d7 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -191,6 +191,7 @@ class ProtocolsController < ApplicationController def update_authors if @protocol.update(authors: params.require(:protocol)[:authors]) + log_activity(:edit_authors_in_protocol_repository, nil, protocol: @protocol.id) render json: {}, status: :ok else render json: @protocol.errors, status: :unprocessable_entity @@ -209,6 +210,7 @@ class ProtocolsController < ApplicationController respond_to do |format| format.json do if @protocol.update(description: params.require(:protocol)[:description]) + log_activity(:edit_description_in_protocol_repository, nil, protocol: @protocol.id) TinyMceAsset.update_images(@protocol, params[:tiny_mce_images], current_user) render json: { html: custom_auto_link( diff --git a/spec/controllers/protocols_controller_spec.rb b/spec/controllers/protocols_controller_spec.rb index 0e882b3c5..354d41864 100644 --- a/spec/controllers/protocols_controller_spec.rb +++ b/spec/controllers/protocols_controller_spec.rb @@ -118,7 +118,7 @@ describe ProtocolsController, type: :controller do } } end - let(:action) { put :update_metadata, params: params, format: :json } + let(:action) { put :update_description, params: params, format: :json } it 'calls create activity for updating description' do expect(Activities::CreateActivityService)