Add activities

This commit is contained in:
aignatov-bio 2019-11-13 13:57:04 +01:00
parent a356c290ea
commit 1488f75e26
2 changed files with 3 additions and 1 deletions

View file

@ -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(

View file

@ -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)