From bff5a6586a9dfa4a7c193523c4c9f98da10834a9 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 24 Jan 2025 13:09:14 +0100 Subject: [PATCH 01/39] Move frontend global constats javascript out of asset pipeline, to enable properly accessing ENV [SCI-11495] --- .../javascripts/sitewide/constants.js.erb | 24 ------------ .../global_constants_controller.rb | 38 +++++++++++++++++++ app/views/global_constants/index.js.erb | 1 + app/views/layouts/application.html.erb | 5 +-- app/views/layouts/shareable_links.html.erb | 2 + app/views/layouts/sign_in_halt.html.erb | 2 + config/routes.rb | 2 + 7 files changed, 47 insertions(+), 27 deletions(-) delete mode 100644 app/assets/javascripts/sitewide/constants.js.erb create mode 100644 app/controllers/global_constants_controller.rb create mode 100644 app/views/global_constants/index.js.erb diff --git a/app/assets/javascripts/sitewide/constants.js.erb b/app/assets/javascripts/sitewide/constants.js.erb deleted file mode 100644 index bcbd62513..000000000 --- a/app/assets/javascripts/sitewide/constants.js.erb +++ /dev/null @@ -1,24 +0,0 @@ -const GLOBAL_CONSTANTS = { - NAME_TRUNCATION_LENGTH: <%= Constants::NAME_TRUNCATION_LENGTH %>, - NAME_MAX_LENGTH: <%= Constants::NAME_MAX_LENGTH %>, - NAME_MIN_LENGTH: <%= Constants::NAME_MIN_LENGTH %>, - TEXT_MAX_LENGTH: <%= Constants::TEXT_MAX_LENGTH %>, - TABLE_CARD_MIN_WIDTH: 340, <%# pixels %> - TABLE_CARD_GAP: 16, <%# pixels %> - FILENAME_TRUNCATION_LENGTH: <%= Constants::FILENAME_TRUNCATION_LENGTH %>, - FILE_MAX_SIZE_MB: parseInt($('meta[name="max-file-size"]').attr('content'), 10), - IS_SAFARI: /^((?!chrome|android).)*safari/i.test(navigator.userAgent), - REPOSITORY_LIST_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_LIST_ITEMS_PER_COLUMN %>, - REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN %>, - REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN: <%= Constants::REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN %>, - HAS_UNSAVED_DATA_CLASS_NAME: 'has-unsaved-data', - DEFAULT_ELEMENTS_PER_PAGE: <%= Constants::DEFAULT_ELEMENTS_PER_PAGE %>, - FILENAME_MAX_LENGTH: <%= Constants::FILENAME_MAX_LENGTH %>, - FAST_STATUS_POLLING_INTERVAL: <%= Constants::FAST_STATUS_POLLING_INTERVAL %>, - SLOW_STATUS_POLLING_INTERVAL: <%= Constants::SLOW_STATUS_POLLING_INTERVAL %>, - ASSET_POLLING_INTERVAL: <%= Constants::ASSET_POLLING_INTERVAL %>, - ASSET_SYNC_URL: '<%= Constants::ASSET_SYNC_URL %>', - GLOBAL_SEARCH_PREVIEW_LIMIT: <%= Constants::GLOBAL_SEARCH_PREVIEW_LIMIT %>, - SEARCH_LIMIT: <%= Constants::SEARCH_LIMIT %>, - SCINOTE_EDIT_RESTRICTED_EXTENSIONS: <%= Constants::SCINOTE_EDIT_RESTRICTED_EXTENSIONS %> -}; diff --git a/app/controllers/global_constants_controller.rb b/app/controllers/global_constants_controller.rb new file mode 100644 index 000000000..6ca95b4c5 --- /dev/null +++ b/app/controllers/global_constants_controller.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class GlobalConstantsController < ApplicationController + before_action :load_global_constants + skip_before_action :authenticate_user!, only: :index + skip_before_action :verify_authenticity_token, only: :index + + def index; end + + private + + def load_global_constants + @global_constants = { + NAME_TRUNCATION_LENGTH: Constants::NAME_TRUNCATION_LENGTH, + NAME_MAX_LENGTH: Constants::NAME_MAX_LENGTH, + NAME_MIN_LENGTH: Constants::NAME_MIN_LENGTH, + TEXT_MAX_LENGTH: Constants::TEXT_MAX_LENGTH, + TABLE_CARD_MIN_WIDTH: 340, + TABLE_CARD_GAP: 16, + FILENAME_TRUNCATION_LENGTH: Constants::FILENAME_TRUNCATION_LENGTH, + FILE_MAX_SIZE_MB: Rails.configuration.x.file_max_size_mb, + REPOSITORY_LIST_ITEMS_PER_COLUMN: Constants::REPOSITORY_LIST_ITEMS_PER_COLUMN, + REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN: Constants::REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN, + REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN: Constants::REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN, + HAS_UNSAVED_DATA_CLASS_NAME: 'has-unsaved-data', + DEFAULT_ELEMENTS_PER_PAGE: Constants::DEFAULT_ELEMENTS_PER_PAGE, + FILENAME_MAX_LENGTH: Constants::FILENAME_MAX_LENGTH, + FAST_STATUS_POLLING_INTERVAL: Constants::FAST_STATUS_POLLING_INTERVAL, + SLOW_STATUS_POLLING_INTERVAL: Constants::SLOW_STATUS_POLLING_INTERVAL, + ASSET_POLLING_INTERVAL: Constants::ASSET_POLLING_INTERVAL, + ASSET_SYNC_URL: Constants::ASSET_SYNC_URL, + GLOBAL_SEARCH_PREVIEW_LIMIT: Constants::GLOBAL_SEARCH_PREVIEW_LIMIT, + SEARCH_LIMIT: Constants::SEARCH_LIMIT, + SCINOTE_EDIT_RESTRICTED_EXTENSIONS: Constants::SCINOTE_EDIT_RESTRICTED_EXTENSIONS, + SCINOTE_EDIT_LATEST_JSON_URL: Constants::SCINOTE_EDIT_LATEST_JSON_URL + } + end +end diff --git a/app/views/global_constants/index.js.erb b/app/views/global_constants/index.js.erb new file mode 100644 index 000000000..25ca41213 --- /dev/null +++ b/app/views/global_constants/index.js.erb @@ -0,0 +1 @@ +const GLOBAL_CONSTANTS = <%= @global_constants.to_json.html_safe %>; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 09aebb2f3..328d11d89 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,7 +5,6 @@ <%=t "head.title", title: (yield :head_title) %> - <% if user_signed_in? %> @@ -18,6 +17,8 @@ <% if ::NewRelic::Agent.instance.started? %> <%= ::NewRelic::Agent.browser_timing_header(controller.request.content_security_policy_nonce) %> <% end %> + + <%= javascript_include_tag 'jquery_bundle' %> <%= javascript_include_tag 'application_pack' %> @@ -79,7 +80,6 @@ data-datetime-picker-format-vue="<%= datetime_picker_format_date_only_vue %>" <% end %> > - @@ -140,6 +140,5 @@ <%= javascript_include_tag 'prism' %> <%= javascript_include_tag "vue_components_repository_item_sidebar" %> - diff --git a/app/views/layouts/shareable_links.html.erb b/app/views/layouts/shareable_links.html.erb index cc00f3039..6a83c1ba1 100644 --- a/app/views/layouts/shareable_links.html.erb +++ b/app/views/layouts/shareable_links.html.erb @@ -5,6 +5,8 @@ <%=t "head.title", title: (yield :head_title) %> + + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> <%= stylesheet_link_tag 'bootstrap_pack', media: 'all' %> <%= stylesheet_link_tag 'application', media: 'all' %> diff --git a/app/views/layouts/sign_in_halt.html.erb b/app/views/layouts/sign_in_halt.html.erb index 95bc5b63e..c154b50b8 100644 --- a/app/views/layouts/sign_in_halt.html.erb +++ b/app/views/layouts/sign_in_halt.html.erb @@ -10,6 +10,8 @@ + + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> <%= stylesheet_link_tag 'bootstrap_pack', media: 'all' %> <%= stylesheet_link_tag 'application_pack_styles', media: 'all' %> diff --git a/config/routes.rb b/config/routes.rb index 16b96e32f..7c7488d5d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,8 @@ Rails.application.routes.draw do get 'api/health', to: 'api/api#health', as: 'api_health' get 'api/status', to: 'api/api#status', as: 'api_status' + get '/global_constants', to: 'global_constants#index', as: 'global_constants' + post 'access_tokens/revoke', to: 'doorkeeper/access_tokens#revoke' # Addons From 4c9026160e45b9245fde80cc2c35c937b96df876 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 24 Jan 2025 13:09:36 +0100 Subject: [PATCH 02/39] Make SciNote Edit latest versions url configurable [SCI-11495] --- app/javascript/vue/shared/scinote_edit_download.vue | 2 +- config/initializers/constants.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/javascript/vue/shared/scinote_edit_download.vue b/app/javascript/vue/shared/scinote_edit_download.vue index ee750979b..224c30c3a 100644 --- a/app/javascript/vue/shared/scinote_edit_download.vue +++ b/app/javascript/vue/shared/scinote_edit_download.vue @@ -114,7 +114,7 @@ export default { }, methods: { fetchData() { - $.get('https://extras.scinote.net/scinote-edit/latest.json', (result) => { + $.get(GLOBAL_CONSTANTS.SCINOTE_EDIT_LATEST_JSON_URL, (result) => { this.responseData = result; }); } diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index d9325828a..1da8cf56d 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -458,6 +458,8 @@ class Constants JSE LNK MSC MSI MSP MST PAF PIF PS1 REG RGS SCR SCT SHB SHS U3P VB VBE VBS VBSCRIPT WS WSF WSH ).freeze + SCINOTE_EDIT_LATEST_JSON_URL = ENV['SCINOTE_EDIT_LATEST_JSON_URL'].freeze + # quick search QUICK_SEARCH_LIMIT = 5 QUICK_SEARCH_SEARCHABLE_OBJECTS = %w(project experiment my_module protocol repository_row From e734c04c69403984edd7ef7d9bd8efd2fdf67917 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 24 Jan 2025 15:24:39 +0100 Subject: [PATCH 03/39] Fix comment model spec --- spec/models/comment_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 356e0cc1a..110a1d355 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -32,6 +32,6 @@ describe Comment, type: :model do describe 'Validations' do it { should validate_presence_of :message } it { should validate_length_of(:message).is_at_most(Constants::TEXT_MAX_LENGTH) } - it { should validate_presence_of :user } + it { should belong_to(:user) } end end From 5ec5d721133c698f3d01bcb970335d4d84ac7d47 Mon Sep 17 00:00:00 2001 From: Andrej Date: Thu, 30 Jan 2025 11:26:21 +0100 Subject: [PATCH 04/39] Fix form export file name [SCI-11517] --- app/jobs/form_responses_zip_export_job.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/jobs/form_responses_zip_export_job.rb b/app/jobs/form_responses_zip_export_job.rb index 0626aa2c7..cc3d831f2 100644 --- a/app/jobs/form_responses_zip_export_job.rb +++ b/app/jobs/form_responses_zip_export_job.rb @@ -3,6 +3,8 @@ require 'caxlsx' class FormResponsesZipExportJob < ZipExportJob + include StringUtility + private # Override @@ -11,7 +13,7 @@ class FormResponsesZipExportJob < ZipExportJob exported_data = to_xlsx(form) - File.binwrite("#{dir}/#{form.name}.xlsx", exported_data) + File.binwrite("#{dir}/#{to_filesystem_name(form.name)}.xlsx", exported_data) end def failed_notification_title From 59963de702e9c0f834516575afac151a3d309eb5 Mon Sep 17 00:00:00 2001 From: Andrej Date: Thu, 30 Jan 2025 14:37:23 +0100 Subject: [PATCH 05/39] Fix tests [SCI-10464] --- spec/controllers/reports_controller_spec.rb | 14 ++++++++++---- .../repository_rows_controller_spec.rb | 4 ++-- spec/controllers/teams_controller_spec.rb | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/spec/controllers/reports_controller_spec.rb b/spec/controllers/reports_controller_spec.rb index 6234ae6a3..a9b76d56a 100644 --- a/spec/controllers/reports_controller_spec.rb +++ b/spec/controllers/reports_controller_spec.rb @@ -19,6 +19,10 @@ describe ReportsController, type: :controller do describe 'POST create' do context 'in JSON format' do + before do + allow(Reports::PdfJob).to receive(:perform_later) + end + let(:action) { post :create, params: params, format: :json } let(:params) do { project_id: project.id, @@ -42,11 +46,14 @@ describe ReportsController, type: :controller do .to(change { Activity.count }) end end - # Temporary disabled due to webpack problems - end if false + end describe 'PUT update' do context 'in JSON format' do + before do + allow(Reports::PdfJob).to receive(:perform_later) + end + let(:action) { put :update, params: params, format: :json } let(:params) do { project_id: project.id, @@ -69,8 +76,7 @@ describe ReportsController, type: :controller do .to(change { Activity.count }) end end - # Temporary disabled due to webpack problems - end if false + end describe 'DELETE destroy' do let(:action) { delete :destroy, params: params } diff --git a/spec/controllers/repository_rows_controller_spec.rb b/spec/controllers/repository_rows_controller_spec.rb index 320700429..dd1fb27bd 100644 --- a/spec/controllers/repository_rows_controller_spec.rb +++ b/spec/controllers/repository_rows_controller_spec.rb @@ -45,11 +45,11 @@ describe RepositoryRowsController, type: :controller do end it 'successful response' do + allow_any_instance_of(ActionView::Helpers::AssetUrlHelper).to receive(:asset_path) get :show, format: :json, params: { repository_id: repository.id, id: repository_row.id } expect(response).to have_http_status(:success) end - # Temporary disabled due to webpack problems - end if false + end context '#index' do before do diff --git a/spec/controllers/teams_controller_spec.rb b/spec/controllers/teams_controller_spec.rb index c302cac5a..e6c03e231 100644 --- a/spec/controllers/teams_controller_spec.rb +++ b/spec/controllers/teams_controller_spec.rb @@ -9,6 +9,18 @@ describe TeamsController, type: :controller do let(:team) { create :team, created_by: user } describe 'POST export_projects' do + before do + view_response = '
' + proxy_manager = Warden::Manager.new({}) + proxy = Warden::Proxy.new({}, proxy_manager) + renderer_double = double('Renderer', render: view_response.dup) + + allow(Warden::Manager).to receive(:new).and_return(proxy_manager) + allow(Warden::Proxy).to receive(:new).with({}, proxy_manager).and_return(proxy) + allow(ApplicationController.renderer).to receive(:new).with({ warden: proxy }).and_return(renderer_double) + allow(ApplicationController).to receive(:render) + end + let!(:first_project) { create :project, team: team, created_by: user } let!(:second_project) { create :project, team: team, created_by: user } let(:params) do @@ -31,6 +43,5 @@ describe TeamsController, type: :controller do expect { action } .to(change { Activity.count }) end - # Temporary disabled due to webpack problems - end if false + end end From e3368b79edece458c78471045f3ceb6cde54b9ed Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Thu, 30 Jan 2025 15:31:05 +0100 Subject: [PATCH 06/39] Fix RepositoryItemReminderJob to properly take into account the buffer [SCI-11520] --- app/jobs/repository_item_date_reminder_job.rb | 46 +++++----- .../repository_item_date_reminder_job_spec.rb | 87 +++++++++++++++++++ 2 files changed, 113 insertions(+), 20 deletions(-) create mode 100644 spec/jobs/repository_item_date_reminder_job_spec.rb diff --git a/app/jobs/repository_item_date_reminder_job.rb b/app/jobs/repository_item_date_reminder_job.rb index 555ca1e74..19b5fbc0e 100644 --- a/app/jobs/repository_item_date_reminder_job.rb +++ b/app/jobs/repository_item_date_reminder_job.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class RepositoryItemDateReminderJob < ApplicationJob + BUFFER_DAYS = 2 + queue_as :default def perform @@ -11,33 +13,37 @@ class RepositoryItemDateReminderJob < ApplicationJob private - def process_repository_values(model, comparison_value) + def repository_values_due(model, comparison_value) model .joins(repository_cell: [:repository_row, { repository_column: :repository }]) .where( notification_sent: false, repositories: { type: 'Repository', archived: false }, repository_rows: { archived: false } - ).where('repository_date_time_values.updated_at >= ?', 2.days.ago) - .where( # date(time) values that are within the reminder range - "data <= " \ - "(?::timestamp + CAST(((repository_columns.metadata->>'reminder_unit')::int * " \ + ).where( # date(time) values that are within the reminder range including buffer + "(data > (:comparison_value::timestamp - (INTERVAL ':buffer_days DAY'))) AND data <= " \ + "(:comparison_value::timestamp + CAST(((repository_columns.metadata->>'reminder_unit')::int * " \ "(repository_columns.metadata->>'reminder_value')::int) || ' seconds' AS Interval))", - comparison_value - ).find_each do |value| - repository_row = RepositoryRow.find(value.repository_cell.repository_row_id) - repository_column = RepositoryColumn.find(value.repository_cell.repository_column_id) + buffer_days: BUFFER_DAYS, + comparison_value: comparison_value + ) + end - RepositoryItemDateNotification - .send_notifications({ - "#{value.class.name.underscore}_id": value.id, - repository_row_id: repository_row.id, - repository_row_name: repository_row.name, - repository_column_id: repository_column.id, - repository_column_name: repository_column.name, - reminder_unit: repository_column.metadata['reminder_unit'], - reminder_value: repository_column.metadata['reminder_value'] - }) - end + def process_repository_values(model, comparison_value) + repository_values_due(model, comparison_value).find_each do |value| + repository_row = RepositoryRow.find(value.repository_cell.repository_row_id) + repository_column = RepositoryColumn.find(value.repository_cell.repository_column_id) + + RepositoryItemDateNotification + .send_notifications({ + "#{value.class.name.underscore}_id": value.id, + repository_row_id: repository_row.id, + repository_row_name: repository_row.name, + repository_column_id: repository_column.id, + repository_column_name: repository_column.name, + reminder_unit: repository_column.metadata['reminder_unit'], + reminder_value: repository_column.metadata['reminder_value'] + }) + end end end diff --git a/spec/jobs/repository_item_date_reminder_job_spec.rb b/spec/jobs/repository_item_date_reminder_job_spec.rb new file mode 100644 index 000000000..3a66d6587 --- /dev/null +++ b/spec/jobs/repository_item_date_reminder_job_spec.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe RepositoryItemDateReminderJob, type: :job do + around do |example| + Timecop.freeze(Time.utc(2025, 1, 15, 0, 0, 0)) do + example.run + end + end + + let(:user) { create :user } + let(:team) { create :team, created_by: user } + let!(:owner_role) { UserRole.find_by(name: I18n.t('user_roles.predefined.owner')) } + let!(:team_assignment) { create_user_assignment(team, owner_role, user) } + let(:repository) { create :repository, team: team, created_by: user } + + let!(:date_column_with_reminder) do + create :repository_column, repository: repository, + created_by: user, + name: 'Custom items', + data_type: 'RepositoryDateValue', + metadata: {"reminder_unit"=>"86400", "reminder_value"=>"5", "reminder_message"=>""} + end + + let!(:repository_date_value_due) do + row = create :repository_row, name: "row 1", + repository: repository, + created_by: user, + last_modified_by: user + + create( + :repository_date_value, + data: Date.parse('20-1-2025'), + repository_cell_attributes: { repository_row: row, repository_column: date_column_with_reminder } + ) + end + + let!(:repository_date_value_due_outside_buffer) do + row = create :repository_row, name: "row 1", + repository: repository, + created_by: user, + last_modified_by: user + + create( + :repository_date_value, + data: Date.parse('15-1-2025') - (RepositoryItemDateReminderJob::BUFFER_DAYS + 1).days, + repository_cell_attributes: { repository_row: row, repository_column: date_column_with_reminder } + ) + end + + let!(:repository_date_value_due_inside_buffer) do + row = create :repository_row, name: "row 1", + repository: repository, + created_by: user, + last_modified_by: user + + create( + :repository_date_value, + data: Date.parse('15-1-2025') - (RepositoryItemDateReminderJob::BUFFER_DAYS - 1).days, + repository_cell_attributes: { repository_row: row, repository_column: date_column_with_reminder } + ) + end + + let!(:repository_date_value_not_due) do + row = create :repository_row, name: "row 1", + repository: repository, + created_by: user, + last_modified_by: user + + create( + :repository_date_value, + data: Date.parse('10-10-2025'), + repository_cell_attributes: { repository_row: row, repository_column: date_column_with_reminder } + ) + end + + describe '#repository_values_due' do + it "returns repository values that are due with a #{RepositoryItemDateReminderJob::BUFFER_DAYS} day buffer" do + values = described_class.new.send(:repository_values_due, RepositoryDateValue, Date.current) + expect(values).to include(repository_date_value_due) + expect(values).to_not include(repository_date_value_not_due) + expect(values).to include(repository_date_value_due_inside_buffer) + expect(values).to_not include(repository_date_value_due_outside_buffer) + end + end +end From 51d2cbdcae625fce17c75eaeea16f79a7d5684de Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 31 Jan 2025 13:22:21 +0100 Subject: [PATCH 07/39] Fix designated users dropdown [SCI-11518] --- app/assets/javascripts/experiments/show.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/experiments/show.js b/app/assets/javascripts/experiments/show.js index 56f152720..26e18c699 100644 --- a/app/assets/javascripts/experiments/show.js +++ b/app/assets/javascripts/experiments/show.js @@ -81,16 +81,19 @@ dropdownSelector.init(myModuleUserSelector, { closeOnSelect: true, labelHTML: true, - tagClass: 'my-module-user-tags', tagLabel: (data) => { - return `${data.label} - ${data.label}`; + return `
+ ${data.label} + ${data.label} +
`; }, optionLabel: (data) => { if (data.params.avatar_url) { - return ` - ${data.label} - ${data.label}`; + return `
+ + ${data.label} + ${data.label} +
`; } return data.label; From 2e868a601b82138feaf9b17aa0336debb2e3b0c4 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 31 Jan 2025 13:44:30 +0100 Subject: [PATCH 08/39] Fix notification team redirect [SCI-11514] --- app/controllers/repositories_controller.rb | 1 + app/serializers/concerns/breadcrumbs_helper.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e17486afc..4231a43ac 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -9,6 +9,7 @@ class RepositoriesController < ApplicationController include RepositoriesDatatableHelper include MyModulesHelper + before_action :switch_team_with_param, only: %i(index show) before_action :load_repository, except: %i(index create create_modal sidebar archive restore actions_toolbar export_modal export_repositories list) before_action :load_repositories, only: %i(index list) diff --git a/app/serializers/concerns/breadcrumbs_helper.rb b/app/serializers/concerns/breadcrumbs_helper.rb index c28da89f3..7abea2fde 100644 --- a/app/serializers/concerns/breadcrumbs_helper.rb +++ b/app/serializers/concerns/breadcrumbs_helper.rb @@ -33,7 +33,7 @@ module BreadcrumbsHelper url = project_folder_path(subject) when RepositoryBase parent = subject.team - url = repository_path(subject) + url = repository_path(subject, team: subject.team_id) when RepositoryRow parent = subject.repository params = { @@ -43,7 +43,7 @@ module BreadcrumbsHelper } params[:archived] = true if subject.archived - url = repository_path(params) + url = repository_path(params, team: subject.repository.team_id) when Report parent = subject.team From cfc0bda6e523de3d6be926f2c50fff2ddf4d2ccf Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 3 Feb 2025 13:44:05 +0100 Subject: [PATCH 09/39] Fix rever protocol action on delete steps action [SCI-11466] --- app/javascript/vue/protocol/container.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/app/javascript/vue/protocol/container.vue b/app/javascript/vue/protocol/container.vue index a85f124d5..5f9661beb 100644 --- a/app/javascript/vue/protocol/container.vue +++ b/app/javascript/vue/protocol/container.vue @@ -367,6 +367,7 @@ export default { deleteSteps() { $.post(this.urls.delete_steps_url, () => { this.steps = []; + this.refreshProtocolDropdownOptions(); }).fail(() => { HelperModule.flashAlertMsg(this.i18n.t('errors.general'), 'danger'); }); From 92861d88fb14360f115fdb45324850bd272ab038 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Mon, 3 Feb 2025 13:56:12 +0100 Subject: [PATCH 10/39] Switch to using POST for action toolbar requests [SCI-11522] --- .../vue/components/action_toolbar.vue | 5 +++-- .../vue/shared/datatable/action_toolbar.vue | 2 +- config/routes.rb | 20 +++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/javascript/vue/components/action_toolbar.vue b/app/javascript/vue/components/action_toolbar.vue index ea4678416..1edac0bdd 100644 --- a/app/javascript/vue/components/action_toolbar.vue +++ b/app/javascript/vue/components/action_toolbar.vue @@ -75,6 +75,7 @@ + <%= javascript_include_tag 'jquery_bundle' %> <%= javascript_include_tag 'application_pack' %> diff --git a/app/views/layouts/shareable_links.html.erb b/app/views/layouts/shareable_links.html.erb index 6a83c1ba1..e7d5a9725 100644 --- a/app/views/layouts/shareable_links.html.erb +++ b/app/views/layouts/shareable_links.html.erb @@ -5,7 +5,7 @@ <%=t "head.title", title: (yield :head_title) %> - + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> <%= stylesheet_link_tag 'bootstrap_pack', media: 'all' %> diff --git a/app/views/layouts/sign_in_halt.html.erb b/app/views/layouts/sign_in_halt.html.erb index c154b50b8..3946cc12b 100644 --- a/app/views/layouts/sign_in_halt.html.erb +++ b/app/views/layouts/sign_in_halt.html.erb @@ -10,7 +10,7 @@ - + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> <%= stylesheet_link_tag 'bootstrap_pack', media: 'all' %>