From f98d6fbd4d1715e95c665a261c76d1bed6a79394 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Fri, 22 Feb 2019 11:58:32 +0100 Subject: [PATCH 01/30] Remove archived task in Demo project Closes SCI-3082. --- app/utilities/first_time_data_generator.rb | 69 ---------------------- 1 file changed, 69 deletions(-) diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index bef89486c..da40659c3 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -320,75 +320,6 @@ module FirstTimeDataGenerator ).sneaky_save end - # Create an archived module - archived_module = MyModule.create( - name: 'Data analysis - Pfaffl method', - created_by: user, - created_at: generate_random_time(6.days.ago), - due_date: Time.now + 1.week, - description: nil, - x: -1, - y: -1, - experiment: experiment, - workflow_order: -1, - my_module_group: nil, - archived: true, - archived_on: generate_random_time(3.days.ago), - archived_by: user - ) - - # Activity for creating archived module - Activity.new( - type_of: :create_module, - user: user, - project: project, - my_module: archived_module, - message: I18n.t( - 'activities.create_module', - user: user.full_name, - module: archived_module.name - ), - created_at: archived_module.created_at, - updated_at: archived_module.created_at - ).sneaky_save - - # Activity for archiving archived module - Activity.new( - type_of: :archive_module, - user: user, - project: project, - my_module: archived_module, - message: I18n.t( - 'activities.archive_module', - user: user.full_name, - module: archived_module.name - ), - created_at: archived_module.archived_on, - updated_at: archived_module.archived_on - ).sneaky_save - - # Assign new user to archived module - UserMyModule.create( - user: user, - my_module: archived_module, - assigned_by: user, - created_at: generate_random_time(archived_module.created_at, 2.minutes) - ) - Activity.new( - type_of: :assign_user_to_module, - user: user, - project: project, - my_module: archived_module, - message: I18n.t( - 'activities.assign_user_to_module', - assigned_user: user.full_name, - module: archived_module.name, - assigned_by_user: user.full_name - ), - created_at: generate_random_time(archived_module.created_at, 2.minutes), - updated_at: generate_random_time(archived_module.created_at, 2.minutes) - ).sneaky_save - # Assign 4 samples to modules samples_to_assign = [] taken_sample_ids = [] From b4199b28e4cef9138da53f20d5b8a62f5ee755d2 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Fri, 22 Feb 2019 19:46:42 +0100 Subject: [PATCH 02/30] Remove turbolinks:load from the project show page Also rename Demo project experiment back to PCR. Closes SCI-3081. --- .../experiments/dropdown_actions.js | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/app/assets/javascripts/experiments/dropdown_actions.js b/app/assets/javascripts/experiments/dropdown_actions.js index 652525707..b223626e0 100644 --- a/app/assets/javascripts/experiments/dropdown_actions.js +++ b/app/assets/javascripts/experiments/dropdown_actions.js @@ -119,27 +119,25 @@ }); } - $(document).on('turbolinks:load', function() { - // Bind modal to new-experiment action - initializeModal($('#new-experiment'), '#new-experiment-modal'); + // Bind modal to new-experiment action + initializeModal($('#new-experiment'), '#new-experiment-modal'); - // Bind modal to big-plus new experiment actions - initializeModal('.big-plus', '#new-experiment-modal'); + // Bind modal to big-plus new experiment actions + initializeModal('.big-plus', '#new-experiment-modal'); - // Bind modal to new-exp-title action - initializeModal('.new-exp-title', '#new-experiment-modal'); + // Bind modal to new-exp-title action + initializeModal('.new-exp-title', '#new-experiment-modal'); - // Bind modals to all clone-experiment actions - $.each($('.clone-experiment'), function() { - var id = $(this).closest('.experiment-panel').data('id'); - initializeModal($(this), '#clone-experiment-modal-' + id); - }); - - // Bind modal to all actions listed on dropdown accesible from experiment - // panel - initializeDropdownActions(); - - // init - initEditNoDescription(); + // Bind modals to all clone-experiment actions + $.each($('.clone-experiment'), function() { + var id = $(this).closest('.experiment-panel').data('id'); + initializeModal($(this), '#clone-experiment-modal-' + id); }); + + // Bind modal to all actions listed on dropdown accesible from experiment + // panel + initializeDropdownActions(); + + // init + initEditNoDescription(); })(); From d7e91676c3c182df0792308169d6b0bf938ea88e Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Sun, 24 Feb 2019 08:13:57 +0100 Subject: [PATCH 03/30] Rename initial experiment back to the old one --- app/utilities/first_time_data_generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index da40659c3..2c1ba3636 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -153,7 +153,7 @@ module FirstTimeDataGenerator end name = 'Demo project' - exp_name = 'qPCR Experiment Version 01' + exp_name = 'Polymerase chain reaction' # If there is an existing demo project, archive and rename it if team.projects.where(name: name).present? # TODO: check if we still need this code From a0d2f7c676fdaa9eb5aaf798387520cd16aac15b Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 26 Feb 2019 13:32:00 +0100 Subject: [PATCH 04/30] Move templates project creation for new team to delayed job [SCI-3101] --- app/models/team.rb | 2 +- app/services/templates_service.rb | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/models/team.rb b/app/models/team.rb index 146ea3c43..dd1fa2464 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -315,7 +315,7 @@ class Team < ApplicationRecord def generate_template_project return if without_templates - TemplatesService.new.update_team(self) + TemplatesService.new.delay(queue: :templates).update_team(self) end include FirstTimeDataGenerator diff --git a/app/services/templates_service.rb b/app/services/templates_service.rb index 3ec39599c..a6a025ffc 100644 --- a/app/services/templates_service.rb +++ b/app/services/templates_service.rb @@ -32,13 +32,16 @@ class TemplatesService return unless owner.present? updated = false exp_tmplt_dir_prefix = "#{@base_dir}/experiment_" - existing = tmpl_project.experiments.where.not(uuid: nil).pluck(:uuid) - @experiment_templates.except(*existing).each_value do |id| - importer_service = TeamImporter.new - importer_service.import_experiment_template_from_dir( - exp_tmplt_dir_prefix + id.to_s, tmpl_project.id, owner.id - ) - updated = true + # Create lock in case another worker starts to update same team + tmpl_project.with_lock do + existing = tmpl_project.experiments.where.not(uuid: nil).pluck(:uuid) + @experiment_templates.except(*existing).each_value do |id| + importer_service = TeamImporter.new + importer_service.import_experiment_template_from_dir( + exp_tmplt_dir_prefix + id.to_s, tmpl_project.id, owner.id + ) + updated = true + end end updated end From 51b3aea49a5f259bc52d1b32f4577dee21245a73 Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Wed, 27 Feb 2019 14:13:17 +0100 Subject: [PATCH 05/30] added uniquness validator and index on user_projects and user_teams relations finxing typo, fixied failing test fixing mistakenly commited file fixing schema to include bigint migration --- app/models/user_project.rb | 1 + app/models/user_team.rb | 1 + ...90227125306_add_unique_index_on_user_teams.rb | 16 ++++++++++++++++ ...27125352_add_unique_index_on_user_projects.rb | 16 ++++++++++++++++ db/schema.rb | 4 +++- .../client_api/user_team_service_spec.rb | 1 - 6 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20190227125306_add_unique_index_on_user_teams.rb create mode 100644 db/migrate/20190227125352_add_unique_index_on_user_projects.rb diff --git a/app/models/user_project.rb b/app/models/user_project.rb index 36d3c4ce0..cbaeb4ac0 100644 --- a/app/models/user_project.rb +++ b/app/models/user_project.rb @@ -13,6 +13,7 @@ class UserProject < ApplicationRecord belongs_to :project, inverse_of: :user_projects, touch: true, optional: true before_destroy :destroy_associations + validates_uniqueness_of :user_id, scope: :project_id def role_str I18n.t("user_projects.enums.role.#{role.to_s}") diff --git a/app/models/user_team.rb b/app/models/user_team.rb index fdcd89453..77a1c4320 100644 --- a/app/models/user_team.rb +++ b/app/models/user_team.rb @@ -14,6 +14,7 @@ class UserTeam < ApplicationRecord before_destroy :destroy_associations after_create :create_samples_table_state + validates_uniqueness_of :user_id, scope: :team_id def role_str I18n.t("user_teams.enums.role.#{role}") diff --git a/db/migrate/20190227125306_add_unique_index_on_user_teams.rb b/db/migrate/20190227125306_add_unique_index_on_user_teams.rb new file mode 100644 index 000000000..095cc0e8f --- /dev/null +++ b/db/migrate/20190227125306_add_unique_index_on_user_teams.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddUniqueIndexOnUserTeams < ActiveRecord::Migration[5.1] + def up + # firstly delete the duplicates + execute 'WITH uniq AS + (SELECT DISTINCT ON (user_id, team_id) * FROM user_teams) + DELETE FROM user_teams WHERE user_teams.id NOT IN + (SELECT id FROM uniq)' + add_index :user_teams, %i(user_id team_id), unique: true + end + + def down + remove_index :user_teams, column: %i(user_id team_id) + end +end diff --git a/db/migrate/20190227125352_add_unique_index_on_user_projects.rb b/db/migrate/20190227125352_add_unique_index_on_user_projects.rb new file mode 100644 index 000000000..4aad180c4 --- /dev/null +++ b/db/migrate/20190227125352_add_unique_index_on_user_projects.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddUniqueIndexOnUserProjects < ActiveRecord::Migration[5.1] + def up + # firstly delete the duplicates + execute 'WITH uniq AS + (SELECT DISTINCT ON (user_id, project_id) * FROM user_projects) + DELETE FROM user_projects WHERE user_projects.id NOT IN + (SELECT id FROM uniq)' + add_index :user_projects, %i(user_id project_id), unique: true + end + + def down + remove_index :user_projects, columns: %i(user_id project_id) + end +end diff --git a/db/schema.rb b/db/schema.rb index 86ab1c413..bd5623d77 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190125123107) do +ActiveRecord::Schema.define(version: 20190227125352) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -796,6 +796,7 @@ ActiveRecord::Schema.define(version: 20190125123107) do t.bigint "assigned_by_id" t.index ["assigned_by_id"], name: "index_user_projects_on_assigned_by_id" t.index ["project_id"], name: "index_user_projects_on_project_id" + t.index ["user_id", "project_id"], name: "index_user_projects_on_user_id_and_project_id", unique: true t.index ["user_id"], name: "index_user_projects_on_user_id" end @@ -821,6 +822,7 @@ ActiveRecord::Schema.define(version: 20190125123107) do t.bigint "assigned_by_id" t.index ["assigned_by_id"], name: "index_user_teams_on_assigned_by_id" t.index ["team_id"], name: "index_user_teams_on_team_id" + t.index ["user_id", "team_id"], name: "index_user_teams_on_user_id_and_team_id", unique: true t.index ["user_id"], name: "index_user_teams_on_user_id" end diff --git a/spec/services/client_api/user_team_service_spec.rb b/spec/services/client_api/user_team_service_spec.rb index 7ffd02150..2783efbce 100644 --- a/spec/services/client_api/user_team_service_spec.rb +++ b/spec/services/client_api/user_team_service_spec.rb @@ -68,7 +68,6 @@ describe ClientApi::UserTeamService do describe '#update_role!' do it 'should raise ClientApi::CustomUserTeamError if no role is set' do - create :user_team, team: team_one, user: user_one ut_service = ClientApi::UserTeamService.new( user: user_one, team_id: team_one.id, From 0fbbe8b5de5655478e450d1dde2c963e1b65fcc9 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Tue, 26 Feb 2019 17:46:35 +0100 Subject: [PATCH 06/30] Add result comments to demo project Closes [SCI-3100]. --- app/utilities/delayed_uploader_demo.rb | 27 ++++++++++++++++- app/utilities/first_time_data_generator.rb | 35 +++++++--------------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/app/utilities/delayed_uploader_demo.rb b/app/utilities/delayed_uploader_demo.rb index 920813c61..8307ef180 100644 --- a/app/utilities/delayed_uploader_demo.rb +++ b/app/utilities/delayed_uploader_demo.rb @@ -19,7 +19,8 @@ module DelayedUploaderDemo current_team:, result_name:, created_at: Time.now, - file_name: + file_name:, + comment: nil ) temp_asset = get_asset(current_user, current_team, file_name) temp_result = Result.new( @@ -32,6 +33,10 @@ module DelayedUploaderDemo temp_result.save temp_asset.save + + # Generate comment if it exists + generate_result_comment(temp_result, current_user, comment) if comment + temp_asset.post_process_file(my_module.experiment.project.team) # Create result activity @@ -57,4 +62,24 @@ module DelayedUploaderDemo step.assets << temp_asset temp_asset.post_process_file(step.my_module.experiment.project.team) end + + def self.generate_result_comment(result, user, message, created_at = nil) + ResultComment.create( + user: user, + message: message, + created_at: created_at, + result: result + ) + Activity.new( + type_of: :add_comment_to_result, + user: user, + project: result.my_module.experiment.project, + my_module: result.my_module, + created_at: created_at, + updated_at: created_at, + message: I18n.t('activities.add_comment_to_result', + user: user.full_name, + result: result.name) + ).sneaky_save + end end diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index 7eaee3725..ac7b72d4a 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -798,11 +798,12 @@ module FirstTimeDataGenerator user: user ) qpcr_id = MyModule.where(name: 'qPCR').last.id.base62_encode - generate_result_comment( + DelayedUploaderDemo.generate_result_comment( temp_result, user, user_annotation + ' Please check if results match results in ' \ - '[#qPCR~tsk~' + qpcr_id + ']' + '[#qPCR~tsk~' + qpcr_id + ']', + generate_random_time(temp_result.created_at, 1.days) ) temp_result.table = Table.new( created_by: user, @@ -833,7 +834,8 @@ module FirstTimeDataGenerator current_team: team, result_name: 'Agarose gel electrophoresis of totRNA samples', created_at: generate_random_time(my_modules[2].created_at, 3.days), - file_name: 'totRNA_gel.jpg' + file_name: 'totRNA_gel.jpg', + comment: user_annotation + ' Could you check if this is okay?' ) # ----------------- Module 4 ------------------ @@ -1249,7 +1251,11 @@ module FirstTimeDataGenerator current_team: team, result_name: 'Bacteria plates YPGA', created_at: generate_random_time(my_modules[5].created_at, 2.days), - file_name: 'Bacterial_colonies.jpg' + file_name: 'Bacterial_colonies.jpg', + comment: user_annotation + ' please check the results again. ' \ + '[#' + fifth_rep_item + ']' \ + ' seems to be acting strange?' ) DelayedUploaderDemo.delay(queue: asset_queue).generate_result_asset( @@ -1669,27 +1675,6 @@ module FirstTimeDataGenerator ).sneaky_save end - def generate_result_comment(result, user, message, created_at = nil) - created_at ||= generate_random_time(result.created_at, 1.days) - ResultComment.create( - user: user, - message: message, - created_at: created_at, - result: result - ) - Activity.new( - type_of: :add_comment_to_result, - user: user, - project: result.my_module.experiment.project, - my_module: result.my_module, - created_at: created_at, - updated_at: created_at, - message: I18n.t('activities.add_comment_to_result', - user: user.full_name, - result: result.name) - ).sneaky_save - end - def generate_step_comment(step, user, message, created_at = nil) created_at ||= generate_random_time(step.created_at, 2.hours) StepComment.create( From a372ebf07dbd7374cbbf2bc1fb64a1c9f1b528ab Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Wed, 27 Feb 2019 21:00:11 +0100 Subject: [PATCH 07/30] Revert "Task info section improvements [SCI - 3058]" --- app/assets/stylesheets/application.scss | 1 - .../my_modules/protocols/index.scss | 44 ------------------- app/views/my_modules/_module_header.html.erb | 15 +++---- app/views/my_modules/protocols.html.erb | 3 +- 4 files changed, 7 insertions(+), 56 deletions(-) delete mode 100644 app/assets/stylesheets/my_modules/protocols/index.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 35c87afef..cb690448e 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -20,4 +20,3 @@ @import "ajax-bootstrap-select.min"; @import "extend/bootstrap"; @import "themes/scinote"; -@import "my_modules/protocols/*" diff --git a/app/assets/stylesheets/my_modules/protocols/index.scss b/app/assets/stylesheets/my_modules/protocols/index.scss deleted file mode 100644 index 236cd5677..000000000 --- a/app/assets/stylesheets/my_modules/protocols/index.scss +++ /dev/null @@ -1,44 +0,0 @@ -@import "constants"; -@import "mixins"; - -.my-modules-protocols-index { - padding-top: 15px !important; - - .first-row { - max-height: 40px; - - .date-block { - max-width: 250px; - } - - div { - height: 45px; - } - - .complete-button-container { - float: right; - max-width: 165px; - - .my_module-state-buttons { - padding-top: 0; - } - } - } - - .well { - border: 0; - box-shadow: none; - padding-left: 0; - padding-right: 0; - } - - .badge-icon { - background: transparent; - color: $color-silver; - padding-right: 5px; - - + .well-sm { - margin-left: 32px; - } - } -} diff --git a/app/views/my_modules/_module_header.html.erb b/app/views/my_modules/_module_header.html.erb index 4a1b7d4c7..7942b72f9 100644 --- a/app/views/my_modules/_module_header.html.erb +++ b/app/views/my_modules/_module_header.html.erb @@ -1,5 +1,5 @@ -
-
+
+
@@ -9,7 +9,7 @@
-
@@ -39,13 +39,9 @@
-
- <%= render partial: "my_modules/state_buttons.html.erb" %> -
- -
+
- +
@@ -54,7 +50,6 @@
-
diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb index d073f8645..f5d3883d8 100644 --- a/app/views/my_modules/protocols.html.erb +++ b/app/views/my_modules/protocols.html.erb @@ -4,7 +4,7 @@ <%= render partial: "shared/sidebar", locals: { current_task: @my_module, page: 'task' } %> <%= render partial: "shared/secondary_navigation" %> -
+
<%= render partial: "module_header" %>
@@ -12,6 +12,7 @@ <%= render partial: "my_modules/protocols/protocol_status_bar.html.erb" %>
<%= render partial: "my_modules/protocols/protocol_buttons.html.erb" %> + <%= render partial: "my_modules/state_buttons.html.erb" %>
From 93490a1f478d770e4e962e4ebf7ac64a7a036efe Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Thu, 28 Feb 2019 07:29:25 +0100 Subject: [PATCH 08/30] Add missing created_at and fix typo Closes SCI-3100, SCI-3098 --- app/utilities/delayed_uploader_demo.rb | 1 + app/utilities/first_time_data_generator.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/utilities/delayed_uploader_demo.rb b/app/utilities/delayed_uploader_demo.rb index 8307ef180..fdb4d0ae5 100644 --- a/app/utilities/delayed_uploader_demo.rb +++ b/app/utilities/delayed_uploader_demo.rb @@ -64,6 +64,7 @@ module DelayedUploaderDemo end def self.generate_result_comment(result, user, message, created_at = nil) + created_at ||= result.created_at ResultComment.create( user: user, message: message, diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index ac7b72d4a..88b9c1657 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -957,8 +957,8 @@ module FirstTimeDataGenerator 'If desired, more than 30 mg tissue can be disrupted and homogenized ' \ 'at the start of the procedure (increase the volume of Buffer RLT ' \ 'proportionately). Use a portion of the homogenate corresponding to no ' \ - 'more than 30 mg tissue for RNA purification, and store the rest at –80', - '°C. Buffer RLT may form a precipitate upon storage. If necessary, ' \ + 'more than 30 mg tissue for RNA purification, and store the rest at –80°C.', + 'Buffer RLT may form a precipitate upon storage. If necessary, ' \ 'redissolve by warming, and then place at room temperature (15–25°C).', 'Buffer RLT and Buffer RW1 contain a guanidine salt and are therefore ' \ 'not compatible with disinfecting reagents containing bleach. See page ' \ From 4f9daa959042141a0d85be09d8d7dba166ada6d3 Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Thu, 28 Feb 2019 11:39:44 +0100 Subject: [PATCH 09/30] SCI-3112 Change the the comments in demo project generator --- app/utilities/first_time_data_generator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index 3bd4b2260..739a24771 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -1549,9 +1549,9 @@ module FirstTimeDataGenerator if rand < 0.3 polite_comment = 'This looks well.' elsif rand < 0.4 - polite_comment = 'Seems satisfactory.' + polite_comment = 'Great job!' elsif rand < 0.4 - polite_comment = 'Try a bit harder next time.' + polite_comment = 'Thanks for getting this done.' end if polite_comment commented_on = generate_random_time(completed_on) From 1ef810852154abc2a30ead54b06f939a35cc05eb Mon Sep 17 00:00:00 2001 From: Miha Mencin Date: Thu, 28 Feb 2019 13:01:59 +0100 Subject: [PATCH 10/30] update version to 1.15.4 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f2380cc7a..e34208c93 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.15.3 +1.15.4 From 9e472c0ccfc0cdfd3a3ecf7f30bac1c4014b90e5 Mon Sep 17 00:00:00 2001 From: Anton Ignatov Date: Thu, 28 Feb 2019 16:06:23 +0100 Subject: [PATCH 11/30] Fix missing user name in activty, when moving experiment --- app/services/experiments/move_to_project_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/experiments/move_to_project_service.rb b/app/services/experiments/move_to_project_service.rb index 19c68f8fc..ef76b9a5b 100644 --- a/app/services/experiments/move_to_project_service.rb +++ b/app/services/experiments/move_to_project_service.rb @@ -80,7 +80,7 @@ module Experiments user: @user, message: I18n.t( 'activities.move_experiment', - user: @user, + user: @user.name, experiment: @exp.name, project_new: @project.name, project_original: @original_project.name From 1fedb4c91eca1b3229ebcf753ec0bb01b4783f32 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Thu, 28 Feb 2019 17:46:34 +0100 Subject: [PATCH 12/30] Improve speed of index query in projects overview service [SCI-3107] --- app/services/projects_overview_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/projects_overview_service.rb b/app/services/projects_overview_service.rb index 51d578234..a189488d4 100644 --- a/app/services/projects_overview_service.rb +++ b/app/services/projects_overview_service.rb @@ -72,6 +72,7 @@ class ProjectsOverviewService .joins('LEFT OUTER JOIN user_projects ON '\ 'user_projects.project_id = projects.id') .left_outer_joins(:user_my_modules) + .where('projects.id': @team.projects) .where('user_my_modules.user_id = :user_id '\ 'OR (user_projects.role = 0 '\ 'AND user_projects.user_id = :user_id)', user_id: @user.id) From 1ae4a60f79bea58f9524e252ae01b55c0d8d4130 Mon Sep 17 00:00:00 2001 From: Anton Ignatov Date: Fri, 1 Mar 2019 12:58:31 +0100 Subject: [PATCH 13/30] Fix recaptha error --- .../javascripts/users/settings/teams/invite_users_modal.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/javascripts/users/settings/teams/invite_users_modal.js b/app/assets/javascripts/users/settings/teams/invite_users_modal.js index 25a8881e2..fcf6554a4 100644 --- a/app/assets/javascripts/users/settings/teams/invite_users_modal.js +++ b/app/assets/javascripts/users/settings/teams/invite_users_modal.js @@ -158,8 +158,12 @@ }); }); }).on('shown.bs.modal', function() { + var script = document.createElement('script'); tagsInput.tagsinput('focus'); recaptchaErrorMsgDiv.addClass('hidden'); + script.type = 'text/javascript'; + script.src = 'https://www.google.com/recaptcha/api.js?hl=en'; + $(script).insertAfter('#recaptcha-service'); // Remove 'data-invited="true"' status modal.removeAttr('data-invited'); }).on('hide.bs.modal', function() { @@ -171,6 +175,7 @@ teamSelectorDropdown2.addClass('disabled'); animateSpinner(modalDialog, false); recaptchaErrorMsgDiv.addClass('hidden'); + $('#recaptcha-service').next().remove(); // Unbind event listeners teamSelectorCheckbox.off('change'); From f636b5adff48997058d5052be8b98b18cb10b716 Mon Sep 17 00:00:00 2001 From: Anton Ignatov Date: Fri, 1 Mar 2019 14:56:06 +0100 Subject: [PATCH 14/30] Remove script from modal --- app/views/shared/_invite_users_modal.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/shared/_invite_users_modal.html.erb b/app/views/shared/_invite_users_modal.html.erb index 39ba94fac..c7dada5c8 100644 --- a/app/views/shared/_invite_users_modal.html.erb +++ b/app/views/shared/_invite_users_modal.html.erb @@ -103,7 +103,6 @@ invite_to_team = type.in?(%w(invite_to_team invite_to_team_with_role))
>
-