mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 06:35:56 +08:00
Merge branch 'hotfix/1.28.0.1' into develop
This commit is contained in:
commit
0faad52f6c
|
@ -48,14 +48,14 @@ function generateElnTable(content, tableMetadata) {
|
|||
|
||||
for (let j = 0; j < numCols; j += 1) {
|
||||
let cellData = '';
|
||||
let cellClass = getMetadataCellValue(tableMetadata.cells, i - 1, j - 1);
|
||||
let cellClass = tableMetadata ? getMetadataCellValue(tableMetadata.cells, i - 1, j - 1) : '';
|
||||
|
||||
if (i > 0 && j > 0 && tableData.data[i - 1][j - 1] !== null) {
|
||||
cellData = tableData.data[i - 1][j - 1];
|
||||
} else if (i === 0 && j !== 0) {
|
||||
cellData = tableMetadata.plateTemplate ? j.toString() : colName(j - 1);
|
||||
cellData = tableMetadata && tableMetadata.plateTemplate ? j.toString() : colName(j - 1);
|
||||
} else if (j === 0 && i !== 0) {
|
||||
cellData = tableMetadata.plateTemplate ? colName(i - 1) : i.toString();
|
||||
cellData = tableMetadata && tableMetadata.plateTemplate ? colName(i - 1) : i.toString();
|
||||
}
|
||||
|
||||
tableCells = `${tableCells}<td ${cellClass ? `class="${cellClass}"` : ''}>${cellData}</td>`;
|
||||
|
|
|
@ -184,7 +184,7 @@ var RepositoryDatatable = (function(global) {
|
|||
$('#saveRecord').attr('disabled', false);
|
||||
$(TABLE_WRAPPER_ID).find('tr').removeClass('blocked');
|
||||
|
||||
if (TABLE.ColSizes) {
|
||||
if (TABLE.ColSizes && TABLE.ColSizes.filter((s) => !!s).length > 0) {
|
||||
$(TABLE_WRAPPER_ID).find('.table').addClass('table--resizable-columns');
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,9 @@ var RepositoryDatatable = (function(global) {
|
|||
|
||||
state.ColSizes = data;
|
||||
|
||||
$(TABLE_WRAPPER_ID).find('.table').addClass('table--resizable-columns');
|
||||
if (data.length > 0) {
|
||||
$(TABLE_WRAPPER_ID).find('.table').addClass('table--resizable-columns');
|
||||
}
|
||||
|
||||
updateColSizeMap(state);
|
||||
|
||||
|
@ -773,7 +775,7 @@ var RepositoryDatatable = (function(global) {
|
|||
if (json.state.columns[7]) json.state.columns[7].visible = archived;
|
||||
if (json.state.search) delete json.state.search;
|
||||
|
||||
if (json.state.ColSizes) {
|
||||
if (json.state.ColSizes && json.state.ColSizes.length > 0) {
|
||||
$(TABLE_WRAPPER_ID).find('.table').addClass('table--resizable-columns');
|
||||
TABLE.ColSizes = json.state.ColSizes;
|
||||
updateColSizeMap(json.state);
|
||||
|
|
|
@ -29,9 +29,9 @@ module AccessPermissions
|
|||
|
||||
UserAssignments::PropagateAssignmentJob.perform_later(
|
||||
@experiment,
|
||||
@user_assignment.user,
|
||||
@user_assignment.user.id,
|
||||
@user_assignment.user_role,
|
||||
current_user
|
||||
current_user.id
|
||||
)
|
||||
|
||||
log_change_activity
|
||||
|
|
|
@ -174,9 +174,9 @@ module AccessPermissions
|
|||
def propagate_job(user_assignment, destroy: false)
|
||||
UserAssignments::PropagateAssignmentJob.perform_later(
|
||||
@project,
|
||||
user_assignment.user,
|
||||
user_assignment.user.id,
|
||||
user_assignment.user_role,
|
||||
current_user,
|
||||
current_user.id,
|
||||
destroy: destroy
|
||||
)
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module Api
|
|||
valid_url?(projects_json_export_params[:callback_url])
|
||||
ProjectsJsonExportJob.perform_later(projects_json_export_params[:task_ids],
|
||||
projects_json_export_params[:callback_url],
|
||||
current_user)
|
||||
current_user.id)
|
||||
render json: { status: :ok }, status: :accepted
|
||||
end
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ class ExperimentsController < ApplicationController
|
|||
}.merge(new_my_module.get_new_position)
|
||||
)
|
||||
new_my_module.designated_users << current_user
|
||||
MyModules::CopyContentJob.perform_later(current_user, my_module.id, new_my_module.id)
|
||||
MyModules::CopyContentJob.perform_later(current_user.id, my_module.id, new_my_module.id)
|
||||
end
|
||||
@experiment.workflowimg.purge
|
||||
end
|
||||
|
|
|
@ -184,7 +184,7 @@ class ReportsController < ApplicationController
|
|||
log_activity(:generate_docx_report)
|
||||
|
||||
ensure_report_template!
|
||||
Reports::DocxJob.perform_later(@report.id, current_user, root_url)
|
||||
Reports::DocxJob.perform_later(@report.id, current_user.id, root_url)
|
||||
render json: {
|
||||
message: I18n.t('projects.reports.index.generation.accepted_message')
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ class ReportsController < ApplicationController
|
|||
log_activity(:generate_pdf_report)
|
||||
|
||||
ensure_report_template!
|
||||
Reports::PdfJob.perform_later(@report.id, current_user)
|
||||
Reports::PdfJob.perform_later(@report.id, current_user.id)
|
||||
end
|
||||
|
||||
def ensure_report_template!
|
||||
|
|
|
@ -108,7 +108,7 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
# offload the rest to background job
|
||||
HideRepositoryRemindersJob.perform_later(@repository, current_user)
|
||||
HideRepositoryRemindersJob.perform_later(@repository, current_user.id)
|
||||
|
||||
render json: { status: :ok }, status: :accepted
|
||||
end
|
||||
|
@ -349,7 +349,7 @@ class RepositoriesController < ApplicationController
|
|||
repositories = Repository.viewable_by_user(current_user, current_team).where(id: params[:repository_ids])
|
||||
if repositories.present? && current_user.has_available_exports?
|
||||
current_user.increase_daily_exports_counter!
|
||||
RepositoriesExportJob.perform_later(repositories.pluck(:id), current_user, current_team)
|
||||
RepositoriesExportJob.perform_later(repositories.pluck(:id), current_user.id, current_team)
|
||||
render json: { message: t('zip_export.export_request_success') }
|
||||
else
|
||||
render json: { message: t('zip_export.export_error') }, status: :unprocessable_entity
|
||||
|
|
|
@ -153,7 +153,7 @@ class TeamsController < ApplicationController
|
|||
options = { team: @team }
|
||||
zip = TeamZipExport.create(user: current_user)
|
||||
zip.generate_exportable_zip(
|
||||
current_user,
|
||||
current_user.id,
|
||||
ids,
|
||||
:teams,
|
||||
options
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module NotificationsHelper
|
||||
def send_email_notification(user, notification)
|
||||
AppMailer.delay.notification(user, notification)
|
||||
AppMailer.delay.notification(user.id, notification)
|
||||
end
|
||||
|
||||
# generate assignment notification
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
class HideRepositoryRemindersJob < ApplicationJob
|
||||
queue_as :high_priority
|
||||
|
||||
def perform(repository, user)
|
||||
def perform(repository, user_id)
|
||||
user = User.find(user_id)
|
||||
hidden_reminder_repository_cell_ids =
|
||||
HiddenRepositoryCellReminder.joins(repository_cell: { repository_row: :repository })
|
||||
.where(user: user)
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
module MyModules
|
||||
class CopyContentJob < ApplicationJob
|
||||
def perform(user, source_my_module_id, target_my_module_id)
|
||||
def perform(user_id, source_my_module_id, target_my_module_id)
|
||||
user = User.find(user_id)
|
||||
target_my_module = MyModule.find(target_my_module_id)
|
||||
MyModule.transaction do
|
||||
MyModule.find(source_my_module_id).copy_content(user, target_my_module)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ProjectsJsonExportJob < ApplicationJob
|
||||
def perform(task_ids, callback, user)
|
||||
def perform(task_ids, callback, user_id)
|
||||
user = User.find(user_id)
|
||||
projects_json_export_service = ProjectsJsonExportService.new(task_ids,
|
||||
callback,
|
||||
user)
|
||||
|
|
|
@ -21,7 +21,7 @@ module Reports
|
|||
else
|
||||
Rails.application.routes.url_helpers.reports_path(team: report.team.id)
|
||||
end
|
||||
user = job.arguments.second
|
||||
user = User.find(job.arguments.second)
|
||||
notification = Notification.create(
|
||||
type_of: :deliver_error,
|
||||
title: I18n.t('projects.reports.index.generation.error_docx_notification_title'),
|
||||
|
@ -33,8 +33,9 @@ module Reports
|
|||
Rails.logger.error("Couldn't generate DOCX for Report with id: #{report.id}. Error:\n #{error}")
|
||||
end
|
||||
|
||||
def perform(report_id, user, root_url)
|
||||
def perform(report_id, user_id, root_url)
|
||||
report = Report.find(report_id)
|
||||
user = User.find(user_id)
|
||||
file = Tempfile.new(['report', '.docx'])
|
||||
begin
|
||||
I18n.backend.date_format = user.settings[:date_format]
|
||||
|
|
|
@ -25,7 +25,7 @@ module Reports
|
|||
else
|
||||
Rails.application.routes.url_helpers.reports_path(team: report.team.id)
|
||||
end
|
||||
user = job.arguments.second
|
||||
user = User.find(job.arguments.second)
|
||||
notification = Notification.create(
|
||||
type_of: :deliver_error,
|
||||
title: I18n.t('projects.reports.index.generation.error_pdf_notification_title'),
|
||||
|
@ -39,8 +39,9 @@ module Reports
|
|||
|
||||
PREVIEW_EXTENSIONS = %w(docx pdf).freeze
|
||||
|
||||
def perform(report_id, user)
|
||||
def perform(report_id, user_id)
|
||||
report = Report.find(report_id)
|
||||
user = User.find(user_id)
|
||||
file = Tempfile.new(['report', '.pdf'], binmode: true)
|
||||
begin
|
||||
template =
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
class RepositoriesExportJob < ApplicationJob
|
||||
include StringUtility
|
||||
|
||||
def perform(repository_ids, user, team)
|
||||
@user = user
|
||||
def perform(repository_ids, user_id, team)
|
||||
@user = User.find(user_id)
|
||||
@team = team
|
||||
@repositories = Repository.viewable_by_user(@user, @team).where(id: repository_ids).order(:id)
|
||||
zip_input_dir = FileUtils.mkdir_p(Rails.root.join("tmp/temp_zip_#{Time.now.to_i}")).first
|
||||
|
|
|
@ -4,8 +4,8 @@ module UserAssignments
|
|||
class GenerateUserAssignmentsJob < ApplicationJob
|
||||
queue_as :high_priority
|
||||
|
||||
def perform(object, assigned_by)
|
||||
@assigned_by = assigned_by
|
||||
def perform(object, assigned_by_id)
|
||||
@assigned_by = User.find_by(id: assigned_by_id)
|
||||
ActiveRecord::Base.transaction do
|
||||
case object
|
||||
when Experiment
|
||||
|
|
|
@ -4,9 +4,9 @@ module UserAssignments
|
|||
class ProjectGroupAssignmentJob < ApplicationJob
|
||||
queue_as :high_priority
|
||||
|
||||
def perform(team, project, assigned_by)
|
||||
def perform(team, project, assigned_by_id)
|
||||
@team = team
|
||||
@assigned_by = assigned_by
|
||||
@assigned_by = User.find_by(id: assigned_by_id)
|
||||
|
||||
return unless project.visible?
|
||||
|
||||
|
@ -27,9 +27,9 @@ module UserAssignments
|
|||
# make sure all related experiments and my modules are assigned
|
||||
UserAssignments::PropagateAssignmentJob.perform_later(
|
||||
project,
|
||||
user,
|
||||
user.id,
|
||||
project.default_public_user_role || UserRole.find_predefined_viewer_role,
|
||||
@assigned_by
|
||||
@assigned_by&.id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,10 +4,10 @@ module UserAssignments
|
|||
class PropagateAssignmentJob < ApplicationJob
|
||||
queue_as :high_priority
|
||||
|
||||
def perform(resource, user, user_role, assigned_by, options = {})
|
||||
@user = user
|
||||
def perform(resource, user_id, user_role, assigned_by_id, options = {})
|
||||
@user = User.find(user_id)
|
||||
@user_role = user_role
|
||||
@assigned_by = assigned_by
|
||||
@assigned_by = User.find_by(id: assigned_by_id)
|
||||
@destroy = options.fetch(:destroy, false)
|
||||
@remove_from_team = options.fetch(:remove_from_team, false)
|
||||
@resource = resource
|
||||
|
|
|
@ -7,8 +7,8 @@ class AppMailer < Devise::Mailer
|
|||
default from: ENV['MAIL_FROM']
|
||||
default reply: ENV['MAIL_REPLYTO']
|
||||
|
||||
def notification(user, notification, opts = {})
|
||||
@user = user
|
||||
def notification(user_id, notification, opts = {})
|
||||
@user = User.find(user_id)
|
||||
@notification = notification
|
||||
subject =
|
||||
if notification.deliver?
|
||||
|
|
|
@ -73,7 +73,7 @@ module Assignable
|
|||
user_role: role
|
||||
)
|
||||
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(self, created_by)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(self, created_by.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -353,7 +353,7 @@ class Experiment < ApplicationRecord
|
|||
|
||||
# regenerate user assignments
|
||||
my_module.user_assignments.destroy_all
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(my_module, current_user)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(my_module, current_user.id)
|
||||
|
||||
Activities::CreateActivityService.call(activity_type: :move_task,
|
||||
owner: current_user,
|
||||
|
@ -410,7 +410,7 @@ class Experiment < ApplicationRecord
|
|||
|
||||
# regenerate user assignments
|
||||
m.user_assignments.destroy_all
|
||||
UserAssignments::GenerateUserAssignmentsJob.new(m, current_user).perform_now
|
||||
UserAssignments::GenerateUserAssignmentsJob.new(m, current_user.id).perform_now
|
||||
|
||||
# Add activity
|
||||
Activities::CreateActivityService.call(
|
||||
|
|
|
@ -341,7 +341,7 @@ class Project < ApplicationRecord
|
|||
UserAssignments::ProjectGroupAssignmentJob.perform_later(
|
||||
team,
|
||||
self,
|
||||
last_modified_by || created_by
|
||||
last_modified_by&.id || created_by&.id
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ require 'csv'
|
|||
class TeamZipExport < ZipExport
|
||||
include StringUtility
|
||||
|
||||
def generate_exportable_zip(user, data, type, options = {})
|
||||
@user = user
|
||||
def generate_exportable_zip(user_id, data, type, options = {})
|
||||
@user = User.find(user_id)
|
||||
zip_input_dir = FileUtils.mkdir_p(
|
||||
File.join(Rails.root, "tmp/temp_zip_#{Time.now.to_i}")
|
||||
).first
|
||||
|
|
|
@ -45,7 +45,8 @@ class ZipExport < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def generate_exportable_zip(user, data, type, options = {})
|
||||
def generate_exportable_zip(user_id, data, type, options = {})
|
||||
user = User.find(user_id)
|
||||
I18n.backend.date_format = user.settings[:date_format] || Constants::DEFAULT_DATE_FORMAT
|
||||
zip_input_dir = FileUtils.mkdir_p(File.join(Rails.root, "tmp/temp_zip_#{Time.now.to_i}")).first
|
||||
tmp_zip_dir = FileUtils.mkdir_p(File.join(Rails.root, 'tmp/zip-ready')).first
|
||||
|
|
|
@ -118,7 +118,7 @@ module Experiments
|
|||
user_role: @project.user_assignments.find_by(user: @user).user_role
|
||||
)
|
||||
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(object, @user)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(object, @user.id)
|
||||
end
|
||||
|
||||
def clean_up_user_my_modules(my_module)
|
||||
|
|
|
@ -70,7 +70,7 @@ module Reports::Docx::DrawMyModule
|
|||
draw_step(step)
|
||||
end
|
||||
|
||||
@docx.h4 I18n.t('Results') if my_module.results.any?
|
||||
@docx.h4 I18n.t('Results') if my_module.results.any? && (%w(file_results table_results text_results).any? { |k| @settings.dig('task', k) })
|
||||
order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result|
|
||||
if result.is_asset && @settings.dig('task', 'file_results')
|
||||
draw_result_asset(result, @settings)
|
||||
|
|
|
@ -30,7 +30,7 @@ module RepositoryZipExport
|
|||
|
||||
zip = ZipExport.create(user: current_user)
|
||||
zip.generate_exportable_zip(
|
||||
current_user,
|
||||
current_user.id,
|
||||
to_csv(rows, params[:header_ids], current_user, repository, nil, params[:my_module_id].present?),
|
||||
:repositories
|
||||
)
|
||||
|
|
|
@ -188,9 +188,9 @@ class TeamImporter
|
|||
|
||||
# handle the permissions for newly created experiment
|
||||
user = User.find(user_id)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_now(experiment, user)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_now(experiment, user.id)
|
||||
experiment.my_modules.find_each do |my_module|
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_now(my_module, user)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_now(my_module, user.id)
|
||||
end
|
||||
puts "Imported experiment: #{experiment.id}"
|
||||
return experiment
|
||||
|
|
|
@ -21,7 +21,7 @@ module Toolbars
|
|||
return [] if @repositories.none?
|
||||
|
||||
if @archived_state
|
||||
[restore_action, delete_action]
|
||||
[export_action, restore_action, delete_action]
|
||||
else
|
||||
[rename_action, duplicate_action, export_action, archive_action, share_action]
|
||||
end.compact
|
||||
|
|
|
@ -24,7 +24,7 @@ module UserAssignments
|
|||
UserAssignments::ProjectGroupAssignmentJob.perform_later(
|
||||
@team,
|
||||
project,
|
||||
@assigned_by
|
||||
@assigned_by&.id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module UserAssignments
|
|||
def call
|
||||
@team.projects.find_each do |project|
|
||||
UserAssignments::PropagateAssignmentJob
|
||||
.perform_now(project, @user, nil, nil, destroy: true, remove_from_team: true)
|
||||
.perform_now(project, @user.id, nil, nil, destroy: true, remove_from_team: true)
|
||||
end
|
||||
remove_repositories_assignments
|
||||
remove_protocols_assignments
|
||||
|
|
|
@ -66,9 +66,11 @@
|
|||
<% end %>
|
||||
|
||||
|
||||
<div class="results-title-name">
|
||||
<%= t('projects.reports.elements.module.results') %>
|
||||
</div><br>
|
||||
<% if %w(file_results table_results text_results).any? { |k| @settings.dig('task', k) } %>
|
||||
<div class="results-title-name">
|
||||
<%= t('projects.reports.elements.module.results') %>
|
||||
</div><br>
|
||||
<% end %>
|
||||
|
||||
<% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %>
|
||||
<% if result.is_asset && @settings.dig('task', 'file_results') %>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div class="report-element-body">
|
||||
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8 %>" />
|
||||
<input type="hidden" class="hot-table-metadata" value="<%= table.metadata.to_json %>" />
|
||||
<input type="hidden" class="hot-table-metadata" value="<%= table.metadata ? table.metadata.to_json : nil %>" />
|
||||
<div class="hot-table-container"></div>
|
||||
<table class="report-common-table-format"></table>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<div class="content-pane flexible <%= params[:archived] ? :archived : :active %> repositories-index"
|
||||
data-readonly="<%= !can_manage_team?(current_team) %>">
|
||||
<div class="content-pane flexible <%= params[:archived] ? :archived : :active %> repositories-index">
|
||||
<div class="content-header">
|
||||
<div class="title-row">
|
||||
<h1 data-view-mode="active"><%= t('libraries.index.head_title') %></h1>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div class="tab-pane" role="tabpanel" id="exp-tab-<%= at_who_key %>" data-object-type="EXPERIMENT"></div>
|
||||
<div class="tab-pane" role="tabpanel" id="tsk-tab-<%= at_who_key %>" data-object-type="TASK"></div>
|
||||
<div class="tab-pane rep-tab" role="tabpanel" id="rep-tab-<%= at_who_key %>" data-object-type="REPOSITORY"><% if repositories.length > 1 %>
|
||||
<div class=sci-btn-group>
|
||||
<div class="sci-btn-group flex-wrap">
|
||||
<% repositories.each do |repository| %>
|
||||
<button class="btn btn-light repository-object" data-object-id="<%= repository.id %>">
|
||||
<% if repository.shared_with?(current_team) %>
|
||||
|
|
|
@ -30,7 +30,7 @@ module UserAssignments
|
|||
end
|
||||
|
||||
it 'assigns the same role as the user had on project level' do
|
||||
described_class.perform_now(experiment, user_one)
|
||||
described_class.perform_now(experiment, user_one.id)
|
||||
user_two_assignment = UserAssignment.find_by(user: user_two, assignable: experiment)
|
||||
user_three_assignment = UserAssignment.find_by(user: user_three, assignable: experiment)
|
||||
expect(user_two_assignment.user_role).to eq viewer_role
|
||||
|
@ -49,7 +49,7 @@ module UserAssignments
|
|||
end
|
||||
|
||||
it 'assigns the same role as the user had on project level' do
|
||||
described_class.perform_now(my_module, user_one)
|
||||
described_class.perform_now(my_module, user_one.id)
|
||||
user_two_assignment = UserAssignment.find_by(user: user_two, assignable: my_module)
|
||||
user_three_assignment = UserAssignment.find_by(user: user_three, assignable: my_module)
|
||||
expect(user_two_assignment.user_role).to eq viewer_role
|
||||
|
|
|
@ -19,12 +19,12 @@ module UserAssignments
|
|||
describe 'perform' do
|
||||
it 'propagates the user assignments to project child object' do
|
||||
expect {
|
||||
described_class.perform_now(project, user_two, technician_role, user_one)
|
||||
described_class.perform_now(project, user_two.id, technician_role, user_one.id)
|
||||
}.to change(UserAssignment, :count).by(4)
|
||||
end
|
||||
|
||||
it 'propagates the user assignments to project child object with the same role' do
|
||||
described_class.perform_now(project, user_two, technician_role, user_one)
|
||||
described_class.perform_now(project, user_two.id, technician_role, user_one.id)
|
||||
[
|
||||
UserAssignment.find_by(user: user_two, assignable: experiment_one),
|
||||
UserAssignment.find_by(user: user_two, assignable: experiment_two),
|
||||
|
@ -53,7 +53,7 @@ module UserAssignments
|
|||
user_role: owner_role,
|
||||
assigned_by: user_one,
|
||||
assigned: :manually
|
||||
described_class.perform_now(project, user_two, technician_role, user_one)
|
||||
described_class.perform_now(project, user_two.id, technician_role, user_one.id)
|
||||
expect(experiment_assignment.reload.user_role).to eq owner_role
|
||||
end
|
||||
|
||||
|
@ -64,7 +64,7 @@ module UserAssignments
|
|||
user_role: owner_role,
|
||||
assigned_by: user_one,
|
||||
assigned: :automatically
|
||||
described_class.perform_now(project, user_two, technician_role, user_one)
|
||||
described_class.perform_now(project, user_two.id, technician_role, user_one.id)
|
||||
expect(experiment_assignment.reload.user_role).to eq technician_role
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ describe ProjectMember, type: :model do
|
|||
it 'triggers the UserAssignments::PropagateAssignmentJob job' do
|
||||
subject.user_role_id = normal_user_role.id
|
||||
expect(UserAssignments::PropagateAssignmentJob).to receive(:perform_later).with(
|
||||
project, user, normal_user_role, user
|
||||
project, user.id, normal_user_role, user.id
|
||||
)
|
||||
subject.update
|
||||
end
|
||||
|
@ -74,7 +74,7 @@ describe ProjectMember, type: :model do
|
|||
|
||||
it 'triggers the UserAssignments::PropagateAssignmentJob job' do
|
||||
expect(UserAssignments::PropagateAssignmentJob).to receive(:perform_later).with(
|
||||
project, user, owner_role, user, destroy: true
|
||||
project, user.id, owner_role, user.id, destroy: true
|
||||
)
|
||||
subject.destroy
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ class AppMailerPreview < ActionMailer::Preview
|
|||
|
||||
def assignment_notification
|
||||
AppMailer.notification(
|
||||
fake_user,
|
||||
fake_user.id,
|
||||
Notification.new(
|
||||
type_of: :assignment,
|
||||
title: I18n.t(
|
||||
|
@ -40,7 +40,7 @@ class AppMailerPreview < ActionMailer::Preview
|
|||
user = User.first
|
||||
user = fake_user if user.blank?
|
||||
AppMailer.notification(
|
||||
user,
|
||||
user.id,
|
||||
Notification.new(
|
||||
type_of: :recent_changes,
|
||||
title: I18n.t(
|
||||
|
@ -59,7 +59,7 @@ class AppMailerPreview < ActionMailer::Preview
|
|||
|
||||
def delivery_notification
|
||||
AppMailer.notification(
|
||||
fake_user,
|
||||
fake_user.id,
|
||||
Notification.new(
|
||||
type_of: :deliver,
|
||||
title: 'Your requested export package is ready!',
|
||||
|
|
Loading…
Reference in a new issue