Merge branch 'features/rails-upgrade' into features/remove-front-end-gems

This commit is contained in:
Anton 2023-07-06 11:14:48 +02:00
commit 4b82ba9613
36 changed files with 144 additions and 129 deletions

View file

@ -9,7 +9,7 @@ AllCops:
- "spec/**/*" - "spec/**/*"
NewCops: enable NewCops: enable
UseCache: false UseCache: false
TargetRubyVersion: 2.6 TargetRubyVersion: 3.2
##################### Style #################################### ##################### Style ####################################
@ -100,6 +100,7 @@ Style/GuardClause:
Style/HashSyntax: Style/HashSyntax:
EnforcedStyle: ruby19 EnforcedStyle: ruby19
EnforcedShorthandSyntax: never
Style/IfUnlessModifier: Style/IfUnlessModifier:
Enabled: true Enabled: true

View file

@ -15,7 +15,7 @@ RUN \
ENV APP_HOME /usr/src/app ENV APP_HOME /usr/src/app
ENV RAILS_ENV=production ENV RAILS_ENV=production
ENV GEM_HOME=$APP_HOME/vendor/bundle/ruby/2.7.0 ENV GEM_HOME=$APP_HOME/vendor/bundle/ruby/3.2.0
ENV PATH=$GEM_HOME/bin:$PATH ENV PATH=$GEM_HOME/bin:$PATH
ENV BUNDLE_APP_CONFIG=.bundle ENV BUNDLE_APP_CONFIG=.bundle
ENV BUNDLE_BUILD__SASSC=--disable-march-tune-native ENV BUNDLE_BUILD__SASSC=--disable-march-tune-native
@ -29,7 +29,7 @@ RUN \
bundle config set path '/usr/src/app/tmp/bundle' && \ bundle config set path '/usr/src/app/tmp/bundle' && \
bundle install --jobs `nproc` && \ bundle install --jobs `nproc` && \
cp -r tmp/bundle/ vendor && \ cp -r tmp/bundle/ vendor && \
rm -rf vendor/bundle/ruby/2.7.0/cache && \ rm -rf vendor/bundle/ruby/3.2.0/cache && \
find vendor/bundle/ruby -type d -name '.git' -exec rm -rf {} + && \ find vendor/bundle/ruby -type d -name '.git' -exec rm -rf {} + && \
bundle config --local path vendor/bundle bundle config --local path vendor/bundle
@ -65,14 +65,17 @@ RUN \
RUN \ RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \
DEBIAN_FRONTEND=noninteractive \
apt-get update -qq && \ apt-get update -qq && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
default-jre-headless \
ca-certificates-java && \
apt-get install -y --no-install-recommends \
libjemalloc2 \ libjemalloc2 \
groff-base \ groff-base \
postgresql-client \ postgresql-client \
netcat-openbsd \
npm \ npm \
default-jre-headless \ netcat-openbsd \
poppler-utils \ poppler-utils \
librsvg2-2 \ librsvg2-2 \
libvips42 \ libvips42 \
@ -95,7 +98,7 @@ RUN \
ENV APP_HOME /usr/src/app ENV APP_HOME /usr/src/app
ENV RAILS_ENV=production ENV RAILS_ENV=production
ENV GEM_HOME=$APP_HOME/vendor/bundle/ruby/2.7.0 ENV GEM_HOME=$APP_HOME/vendor/bundle/ruby/3.2.0
ENV PATH=$GEM_HOME/bin:$PATH ENV PATH=$GEM_HOME/bin:$PATH
ENV BUNDLE_APP_CONFIG=.bundle ENV BUNDLE_APP_CONFIG=.bundle

View file

@ -8,7 +8,7 @@ module ActiveStorage
def show def show
expires_in ActiveStorage.service_urls_expire_in expires_in ActiveStorage.service_urls_expire_in
redirect_to @blob.url(disposition: params[:disposition]) redirect_to @blob.url(disposition: params[:disposition]), allow_other_host: true
end end
end end
end end

View file

@ -12,7 +12,8 @@ module ActiveStorage
end end
expires_in ActiveStorage.service_urls_expire_in expires_in ActiveStorage.service_urls_expire_in
redirect_to @blob.representation(params[:variation_key]).processed.url(disposition: params[:disposition]) redirect_to @blob.representation(params[:variation_key]).processed.url(disposition: params[:disposition]),
allow_other_host: true
end end
private private

View file

@ -6,7 +6,7 @@ class ActivitiesController < ApplicationController
render json: { render json: {
more_url: local_vars.fetch(:more_activities_url), more_url: local_vars.fetch(:more_activities_url),
html: render_to_string( html: render_to_string(
partial: 'list', locals: @vars partial: 'list', locals: @vars, formats: :html
) )
} }
end end

View file

@ -28,7 +28,8 @@ class AssetsController < ApplicationController
can_edit: can_manage_asset?(@asset), can_edit: can_manage_asset?(@asset),
gallery: params[:gallery], gallery: params[:gallery],
preview: params[:preview] preview: params[:preview]
} },
formats: :html
) } ) }
end end
@ -60,7 +61,8 @@ class AssetsController < ApplicationController
locals: { locals: {
asset: @asset, asset: @asset,
gallery_view_id: gallery_view_id gallery_view_id: gallery_view_id
}) } },
formats: :html) }
end end
def file_url def file_url

View file

@ -7,7 +7,7 @@ class AtWhoController < ApplicationController
def users def users
users = @team.search_users(@query).limit(Constants::ATWHO_SEARCH_LIMIT + 1) users = @team.search_users(@query).limit(Constants::ATWHO_SEARCH_LIMIT + 1)
render json: { render json: {
users: [render_to_string(partial: 'shared/smart_annotation/users', locals: { users: users })] users: [render_to_string(partial: 'shared/smart_annotation/users', locals: { users: users }, formats: :html)]
} }
end end
@ -44,7 +44,8 @@ class AtWhoController < ApplicationController
render json: { render json: {
res: [ res: [
render_to_string(partial: 'shared/smart_annotation/repository_items', render_to_string(partial: 'shared/smart_annotation/repository_items',
locals: { repository_rows: items, repository: repository }) locals: { repository_rows: items, repository: repository },
formats: :html)
], ],
repository: repository_id, repository: repository_id,
team: current_team.id team: current_team.id
@ -53,15 +54,19 @@ class AtWhoController < ApplicationController
def menu def menu
repositories = Repository.active.accessible_by_teams(@team) repositories = Repository.active.accessible_by_teams(@team)
render json: { html: render_to_string({ partial: "shared/smart_annotation/menu.html.erb", render json: {
locals: { repositories: repositories } }) } html: render_to_string(partial: 'shared/smart_annotation/menu',
locals: { repositories: repositories },
formats: :html)
}
end end
def projects def projects
res = SmartAnnotation.new(current_user, current_team, @query) res = SmartAnnotation.new(current_user, current_team, @query)
render json: { render json: {
res: [render_to_string(partial: 'shared/smart_annotation/project_items', res: [render_to_string(partial: 'shared/smart_annotation/project_items',
locals: { projects: res.projects })], locals: { projects: res.projects },
formats: :html)],
team: current_team.id team: current_team.id
} }
end end
@ -70,7 +75,8 @@ class AtWhoController < ApplicationController
res = SmartAnnotation.new(current_user, current_team, @query) res = SmartAnnotation.new(current_user, current_team, @query)
render json: { render json: {
res: [render_to_string(partial: 'shared/smart_annotation/experiment_items', res: [render_to_string(partial: 'shared/smart_annotation/experiment_items',
locals: { experiments: res.experiments })], locals: { experiments: res.experiments },
formats: :html)],
team: current_team.id team: current_team.id
} }
end end
@ -79,7 +85,8 @@ class AtWhoController < ApplicationController
res = SmartAnnotation.new(current_user, current_team, @query) res = SmartAnnotation.new(current_user, current_team, @query)
render json: { render json: {
res: [render_to_string(partial: 'shared/smart_annotation/my_module_items', res: [render_to_string(partial: 'shared/smart_annotation/my_module_items',
locals: { my_modules: res.my_modules })], locals: { my_modules: res.my_modules },
formats: :html)],
team: current_team.id team: current_team.id
} }
end end

View file

@ -18,10 +18,9 @@ class BioEddieAssetsController < ApplicationController
if asset && bio_eddie_params[:object_type] == 'Step' if asset && bio_eddie_params[:object_type] == 'Step'
create_register_bio_eddie_activity(asset, current_user) if bio_eddie_params[:schedule_for_registration] == 'true' create_register_bio_eddie_activity(asset, current_user) if bio_eddie_params[:schedule_for_registration] == 'true'
render json: { render json: {
html: render_to_string(partial: 'assets/asset', locals: { html: render_to_string(partial: 'assets/asset',
asset: asset, locals: { asset: asset, gallery_view_id: bio_eddie_params[:object_id] },
gallery_view_id: bio_eddie_params[:object_id] formats: :html)
})
} }
elsif asset && bio_eddie_params[:object_type] == 'Result' elsif asset && bio_eddie_params[:object_type] == 'Result'
create_register_bio_eddie_activity(asset, current_user) if bio_eddie_params[:schedule_for_registration] == 'true' create_register_bio_eddie_activity(asset, current_user) if bio_eddie_params[:schedule_for_registration] == 'true'

View file

@ -28,7 +28,8 @@ class CommentsController < ApplicationController
object_url: object_url, object_url: object_url,
comment_addable: comment_addable?(@commentable), comment_addable: comment_addable?(@commentable),
comments: render_to_string(partial: 'shared/comments/comments_list', comments: render_to_string(partial: 'shared/comments/comments_list',
locals: { comments: comments }) locals: { comments: comments },
formats: :html)
} }
end end

View file

@ -30,9 +30,9 @@ module Dashboard
.where('my_modules.due_date > ? AND my_modules.due_date < ?', start_date, end_date) .where('my_modules.due_date > ? AND my_modules.due_date < ?', start_date, end_date)
.where(projects: { team_id: current_team.id }) .where(projects: { team_id: current_team.id })
render json: { render json: {
html: render_to_string(partial: 'shared/my_modules_list_partial', locals: { html: render_to_string(partial: 'shared/my_modules_list_partial',
my_modules: my_modules locals: { my_modules: my_modules },
}) formats: :html)
} }
end end
end end

View file

@ -14,7 +14,7 @@ module Dashboard
tasks = load_tasks.page(page).per(Constants::INFINITE_SCROLL_LIMIT).without_count tasks = load_tasks.page(page).per(Constants::INFINITE_SCROLL_LIMIT).without_count
tasks_list = tasks.map do |task| tasks_list = tasks.map do |task|
render_to_string(partial: 'dashboards/current_tasks/task', locals: { task: task }) render_to_string(partial: 'dashboards/current_tasks/task', locals: { task: task }, formats: :html)
end end
render json: { data: tasks_list, next_page: tasks.next_page } render json: { data: tasks_list, next_page: tasks.next_page }

View file

@ -31,8 +31,7 @@ class ExperimentsController < ApplicationController
@experiment = Experiment.new @experiment = Experiment.new
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'new_modal', partial: 'new_modal', formats: :html
formats: :html
) )
} }
end end
@ -63,7 +62,7 @@ class ExperimentsController < ApplicationController
def show def show
render json: { render json: {
html: render_to_string(partial: 'experiments/details_modal') html: render_to_string(partial: 'experiments/details_modal', formats: :html)
} }
end end
@ -143,9 +142,7 @@ class ExperimentsController < ApplicationController
def edit def edit
render json: { render json: {
html: render_to_string( html: render_to_string(partial: 'edit_modal', formats: :html)
partial: 'edit_modal'
)
} }
end end
@ -256,7 +253,8 @@ class ExperimentsController < ApplicationController
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'clone_modal', partial: 'clone_modal',
locals: { view_mode: params[:view_mode] } locals: { view_mode: params[:view_mode] },
formats: :html
) )
} }
end end
@ -285,9 +283,7 @@ class ExperimentsController < ApplicationController
def move_modal def move_modal
@projects = @experiment.movable_projects(current_user) @projects = @experiment.movable_projects(current_user)
render json: { render json: {
html: render_to_string( html: render_to_string(partial: 'move_modal', formats: :html)
partial: 'move_modal'
)
} }
end end
@ -331,9 +327,7 @@ class ExperimentsController < ApplicationController
@experiments = @experiment.project.experiments.active.where.not(id: @experiment) @experiments = @experiment.project.experiments.active.where.not(id: @experiment)
.managable_by_user(current_user).order(name: :asc) .managable_by_user(current_user).order(name: :asc)
render json: { render json: {
html: render_to_string( html: render_to_string(partial: 'move_modules_modal', formats: :html)
partial: 'move_modules_modal'
)
} }
end end
@ -394,7 +388,8 @@ class ExperimentsController < ApplicationController
render json: { render json: {
workflowimg: render_to_string( workflowimg: render_to_string(
partial: 'projects/show/workflow_img', partial: 'projects/show/workflow_img',
locals: { experiment: @experiment } locals: { experiment: @experiment },
formats: :html
) )
} }
end end

View file

@ -55,11 +55,17 @@ class GlobalActivitiesController < ApplicationController
@next_page = activities.next_page @next_page = activities.next_page
@starting_timestamp = activities.first&.created_at.to_i @starting_timestamp = activities.first&.created_at.to_i
render json: { respond_to do |format|
activities_html: render_to_string(partial: 'activity_list'), format.json do
next_page: @next_page, render json: {
starting_timestamp: @starting_timestamp activities_html: render_to_string(partial: 'activity_list'),
} next_page: @next_page,
starting_timestamp: @starting_timestamp
}
end
format.html do
end
end
end end
def team_filter def team_filter

View file

@ -143,15 +143,15 @@ class MyModulesController < ApplicationController
@activities = @my_module.last_activities(1, @per_page) @activities = @my_module.last_activities(1, @per_page)
render json: { render json: {
html: render_to_string(partial: 'activities') html: render_to_string(partial: 'activities', formats: :html)
} }
end end
# Due date modal window in full-zoom canvas # Due date modal window in full-zoom canvas
def due_date def due_date
render json: { render json: {
html: render_to_string(partial: 'due_date'), html: render_to_string(partial: 'due_date', formats: :html),
title: t('my_modules.due_date.title', module: escape_input(@my_module.name)) title: t('.due_date.title', module: escape_input(@my_module.name))
} }
end end

View file

@ -852,28 +852,15 @@ class ProtocolsController < ApplicationController
end end
def load_from_repository_modal def load_from_repository_modal
@protocol = Protocol.find_by_id(params[:id]) render json: {
respond_to do |format| html: render_to_string(partial: 'my_modules/protocols/load_from_repository_modal_body', formats: :html)
format.json do }
render json: {
html: render_to_string({
partial: "my_modules/protocols/load_from_repository_modal_body.html.erb"
})
}
end
end
end end
def protocol_status_bar def protocol_status_bar
respond_to do |format| render json: {
format.json do html: render_to_string(partial: 'my_modules/protocols/protocol_status_bar', formats: :html)
render json: { }
html: render_to_string({
partial: "my_modules/protocols/protocol_status_bar.html.erb"
})
}
end
end
end end
def version_comment def version_comment

View file

@ -84,23 +84,13 @@ class RepositoriesController < ApplicationController
def create_modal def create_modal
@repository = Repository.new @repository = Repository.new
respond_to do |format| render json: {
format.json do html: render_to_string(partial: 'create_repository_modal', formats: :html)
render json: { }
html: render_to_string(
partial: 'create_repository_modal'
)
}
end
end
end end
def share_modal def share_modal
respond_to do |format| render json: { html: render_to_string(partial: 'share_repository_modal', formats: :html) }
format.json do
render json: { html: render_to_string(partial: 'share_repository_modal') }
end
end
end end
def hide_reminders def hide_reminders

View file

@ -101,20 +101,19 @@ class ResultTextsController < ApplicationController
respond_to do |format| respond_to do |format|
if saved if saved
format.html { format.html do
flash[:success] = success_flash flash[:success] = success_flash
redirect_to results_my_module_path(@my_module) redirect_to results_my_module_path(@my_module)
} end
format.json { format.json do
render json: { render json: {
html: render_to_string({ html: render_to_string(
partial: "my_modules/result.html.erb", partial: 'my_modules/result.html.erb',
locals: { locals: { result: @result },
result: @result formats: :html
} )
}) }
}, status: :ok end
}
else else
format.json { format.json {
render json: @result.errors, status: :bad_request render json: @result.errors, status: :bad_request

View file

@ -102,7 +102,8 @@ class StepsController < ApplicationController
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'steps/step', partial: 'steps/step',
locals: { step: @step } locals: { step: @step },
formats: :html
) )
} }
end end

View file

@ -15,7 +15,8 @@ class TeamsController < ApplicationController
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'shared/sidebar/projects', partial: 'shared/sidebar/projects',
locals: { team: current_team, sort: params[:sort] } locals: { team: current_team, sort: params[:sort] },
formats: :html
) )
} }
end end
@ -50,7 +51,8 @@ class TeamsController < ApplicationController
partial: 'projects/export/modal', partial: 'projects/export/modal',
locals: { num_projects: @exp_projects.size, locals: { num_projects: @exp_projects.size,
limit: TeamZipExport.exports_limit, limit: TeamZipExport.exports_limit,
num_of_requests_left: current_user.exports_left - 1 } num_of_requests_left: current_user.exports_left - 1 },
formats: :html
), ),
title: t('projects.export_projects.modal_title') title: t('projects.export_projects.modal_title')
} }
@ -58,7 +60,8 @@ class TeamsController < ApplicationController
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'projects/export/error', partial: 'projects/export/error',
locals: { limit: TeamZipExport.exports_limit } locals: { limit: TeamZipExport.exports_limit },
formats: :html
), ),
title: t('projects.export_projects.error_title'), title: t('projects.export_projects.error_title'),
status: 'error' status: 'error'

View file

@ -11,9 +11,7 @@ class UserMyModulesController < ApplicationController
@user_my_modules = @my_module.user_my_modules @user_my_modules = @my_module.user_my_modules
render json: { render json: {
html: render_to_string( html: render_to_string(partial: 'designated_users', formats: :html),
partial: 'designated_users'
),
my_module_id: @my_module.id, my_module_id: @my_module.id,
counter: @my_module.designated_users.count # Used for counter badge counter: @my_module.designated_users.count # Used for counter badge
} }
@ -21,7 +19,7 @@ class UserMyModulesController < ApplicationController
def index def index
render json: { render json: {
html: render_to_string(partial: 'index') html: render_to_string(partial: 'index', formats: :html)
} }
end end
@ -33,7 +31,7 @@ class UserMyModulesController < ApplicationController
render json: { render json: {
my_module: @my_module, my_module: @my_module,
html: render_to_string( html: render_to_string(
partial: 'index_edit' partial: 'index_edit', formats: :html
) )
} }
end end
@ -48,7 +46,8 @@ class UserMyModulesController < ApplicationController
if params[:table] if params[:table]
render json: { render json: {
html: render_to_string(partial: 'experiments/assigned_users', html: render_to_string(partial: 'experiments/assigned_users',
locals: { my_module: @my_module, user: current_user, skip_unassigned: false }), locals: { my_module: @my_module, user: current_user, skip_unassigned: false },
formats: :html),
unassign_url: my_module_user_my_module_path(@my_module, @um) unassign_url: my_module_user_my_module_path(@my_module, @um)
} }
else else
@ -75,7 +74,8 @@ class UserMyModulesController < ApplicationController
if params[:table] if params[:table]
render json: { render json: {
html: render_to_string(partial: 'experiments/assigned_users', html: render_to_string(partial: 'experiments/assigned_users',
locals: { my_module: @my_module, user: current_user, skip_unassigned: false }) locals: { my_module: @my_module, user: current_user, skip_unassigned: false },
formats: :html)
} }
else else
render json: {} render json: {}

View file

@ -137,7 +137,7 @@ module Users
end end
render json: { render json: {
html: render_to_string(partial: 'shared/invite_users_modal_results') html: render_to_string(partial: 'shared/invite_users_modal_results', formats: :html)
} }
end end

View file

@ -77,7 +77,8 @@ module Users
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'users/settings/teams/name_modal_body', partial: 'users/settings/teams/name_modal_body',
locals: { team: @team } locals: { team: @team },
formats: :html
) )
} }
end end
@ -86,7 +87,8 @@ module Users
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'users/settings/teams/description_modal_body', partial: 'users/settings/teams/description_modal_body',
locals: { team: @team } locals: { team: @team },
formats: :html
) )
} }
end end

View file

@ -40,7 +40,8 @@ module Users
render json: { render json: {
html: render_to_string( html: render_to_string(
partial: 'users/settings/user_teams/leave_user_team_modal_body', partial: 'users/settings/user_teams/leave_user_team_modal_body',
locals: { user_assignment: @user_assignment } locals: { user_assignment: @user_assignment },
formats: :html
), ),
heading: I18n.t( heading: I18n.t(
'users.settings.user_teams.leave_uo_heading', 'users.settings.user_teams.leave_uo_heading',
@ -54,7 +55,8 @@ module Users
html: render_to_string( html: render_to_string(
partial: 'users/settings/user_teams/' \ partial: 'users/settings/user_teams/' \
'destroy_user_team_modal_body', 'destroy_user_team_modal_body',
locals: { user_assignment: @user_assignment } locals: { user_assignment: @user_assignment },
formats: :html
), ),
heading: I18n.t( heading: I18n.t(
'users.settings.user_teams.destroy_uo_heading', 'users.settings.user_teams.destroy_uo_heading',

View file

@ -60,19 +60,22 @@ class ProtocolLinkedChildrenDatatable < CustomDatatable
res += "<li><span class='sn-icon sn-icon-projects'></span>&nbsp;" res += "<li><span class='sn-icon sn-icon-projects'></span>&nbsp;"
res += @controller.render_to_string( res += @controller.render_to_string(
partial: 'search/results/partials/project_text', partial: 'search/results/partials/project_text',
locals: { project: record.my_module.experiment.project } locals: { project: record.my_module.experiment.project },
formats: :html
) )
res += '</li>' res += '</li>'
res += "<li><i class='sn-icon sn-icon-experiment'></i>&nbsp;" res += "<li><i class='sn-icon sn-icon-experiment'></i>&nbsp;"
res += @controller.render_to_string( res += @controller.render_to_string(
partial: 'search/results/partials/experiment_text', partial: 'search/results/partials/experiment_text',
locals: { experiment: record.my_module.experiment } locals: { experiment: record.my_module.experiment },
formats: :html
) )
res += '</li>' res += '</li>'
res += "<li><span class='sn-icon sn-icon-task'></span>&nbsp;" res += "<li><span class='sn-icon sn-icon-task'></span>&nbsp;"
res += @controller.render_to_string( res += @controller.render_to_string(
partial: 'search/results/partials/my_module_text', partial: 'search/results/partials/my_module_text',
locals: { my_module: record.my_module, link_to_page: :protocols } locals: { my_module: record.my_module, link_to_page: :protocols },
formats: :html
) )
res += '</li>' res += '</li>'
res += '</ol>' res += '</ol>'

View file

@ -241,11 +241,12 @@ class ProtocolsDatatable < CustomDatatable
def versions_html(record) def versions_html(record)
@view.controller @view.controller
.render_to_string(partial: 'protocols/index/protocol_versions', .render_to_string(partial: 'protocols/index/protocol_versions',
locals: { protocol: record, readable: can_read_protocol_in_repository?(@user, record) }) locals: { protocol: record, readable: can_read_protocol_in_repository?(@user, record) },
formats: :html)
end end
def access_html(record) def access_html(record)
@view.controller.render_to_string(partial: 'protocols/index/protocol_access', locals: { protocol: record }) @view.controller.render_to_string(partial: 'protocols/index/protocol_access', locals: { protocol: record }, formats: :html)
end end
def published_by(record) def published_by(record)

View file

@ -78,7 +78,8 @@ class TeamUsersDatatable < CustomDatatable
data: { action: 'destroy-user-team' } data: { action: 'destroy-user-team' }
), ),
user: @user user: @user
} },
formats: :html
) )
} }
end end

View file

@ -173,7 +173,8 @@ module ApplicationHelper
:thumb, :thumb,
base64_encoded_imgs base64_encoded_imgs
) )
} },
formats: :html
) )
end end

View file

@ -21,7 +21,7 @@ module CommentHelper
resultsNumber: comments.size, resultsNumber: comments.size,
moreUrl: more_url, moreUrl: more_url,
html: render_to_string( html: render_to_string(
partial: partial, locals: { comments: comments } partial: partial, locals: { comments: comments }, formats: :html
) )
} }
end end
@ -49,7 +49,8 @@ module CommentHelper
locals: { locals: {
comment: comment, comment: comment,
skip_header: false skip_header: false
} },
formats: :html
) )
} }
else else
@ -111,7 +112,8 @@ module CommentHelper
locals: { locals: {
comment: comment, comment: comment,
skip_header: false skip_header: false
} },
formats: :html
) )
} }
else else

View file

@ -23,10 +23,10 @@ module GlobalActivitiesHelper
end end
if no_custom_links if no_custom_links
I18n.t("global_activities.content.#{activity.type_of}_html", parameters.symbolize_keys) I18n.t("global_activities.content.#{activity.type_of}_html", **parameters.symbolize_keys)
else else
custom_auto_link( custom_auto_link(
I18n.t("global_activities.content.#{activity.type_of}_html", parameters.symbolize_keys), I18n.t("global_activities.content.#{activity.type_of}_html", **parameters.symbolize_keys),
team: activity.team team: activity.team
) )
end end

View file

@ -32,7 +32,7 @@ module Experiments
penwidth: '3.0' penwidth: '3.0'
} }
@graph = Graphviz::Graph.new('G', @graph_params) @graph = Graphviz::Graph.new('G', **@graph_params)
@errors = [] @errors = []
end end
@ -58,7 +58,7 @@ module Experiments
# draw nodes # draw nodes
node = @graph.add_node( node = @graph.add_node(
"#{subgraph_id}-#{index}", "#{subgraph_id}-#{index}",
@node_params.merge( **@node_params.merge(
label: '', label: '',
pos: "#{my_module.x / 10},-#{my_module.y / 10}!" pos: "#{my_module.x / 10},-#{my_module.y / 10}!"
) )
@ -80,7 +80,7 @@ module Experiments
@exp.my_modules.without_group.each do |my_module| @exp.my_modules.without_group.each do |my_module|
@graph.add_node( @graph.add_node(
"Orphan-#{my_module.id}", "Orphan-#{my_module.id}",
@node_params.merge( **@node_params.merge(
label: '', label: '',
pos: "#{my_module.x / 10},-#{my_module.y / 10}!" pos: "#{my_module.x / 10},-#{my_module.y / 10}!"
) )

View file

@ -1,6 +1,6 @@
<% editable ||= false %> <% editable ||= false %>
<% if assignable.visible? %> <% if assignable.visible? %>
<%= form_with(model: assignable, url: [:update_default_public_user_role, :access_permissions, assignable], method: :put, remote: true, html: { class: 'member-item', id: 'public_assignments', data: { action: 'replace-form autosave-form', object_type: assignable.class.name.underscore.to_sym } }) do |f| %> <%= form_with(model: assignable, url: [:update_default_public_user_role, :access_permissions, assignable], method: :put, html: { class: 'member-item', id: 'public_assignments', data: { remote: true, action: 'replace-form autosave-form', object_type: assignable.class.name.underscore.to_sym } }) do |f| %>
<div class="user-assignment-info"> <div class="user-assignment-info">
<div class="global-avatar-container"> <div class="global-avatar-container">
<%= image_tag "icon/team.png", class: 'img-circle pull-left' %> <%= image_tag "icon/team.png", class: 'img-circle pull-left' %>

View file

@ -6,7 +6,7 @@
item_id = dom_id(user, :assignment_member) item_id = dom_id(user, :assignment_member)
%> %>
<%= form_with(model: assignment, url: update_path, method: :put, remote: true, html: { class: 'member-item', id: item_id, data: { action: 'replace-form autosave-form', object_type: :assignment_member } }) do |f| %> <%= form_with(model: assignment, url: update_path, method: :put, html: { class: 'member-item', id: item_id, data: { remote: true, action: 'replace-form autosave-form', object_type: :assignment_member } }) do |f| %>
<%= f.hidden_field :user_id, value: f.object.user.id %> <%= f.hidden_field :user_id, value: f.object.user.id %>
<div class="user-assignment-info"> <div class="user-assignment-info">
<div class="global-avatar-container"> <div class="global-avatar-container">

View file

@ -10,7 +10,7 @@
<%= t '.title', resource_name: assignable.name %> <%= t '.title', resource_name: assignable.name %>
</h4> </h4>
</div> </div>
<%= form_with(url: create_path, method: :post, remote: true, html: { id: 'new-user-assignment-form', data: { object_type: assignable.class.to_s.downcase } }) do |f| %> <%= form_with(url: create_path, method: :post, html: { id: 'new-user-assignment-form', data: { remote: true, object_type: assignable.class.to_s.downcase } }) do |f| %>
<div class="modal-body"> <div class="modal-body">
<div class="sci-input-container left-icon"> <div class="sci-input-container left-icon">
<%= text_field_tag :search_users, '', <%= text_field_tag :search_users, '',

View file

@ -47,6 +47,10 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
Rails.application.routes.default_url_options = {
host: Rails.application.secrets.mail_server_url
}
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log

View file

@ -38,6 +38,10 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
Rails.application.routes.default_url_options = {
host: Rails.application.secrets.mail_server_url
}
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.

View file

@ -17,13 +17,13 @@ Rails.application.config.active_storage.variable_content_types << 'image/svg+xml
Rails.application.config.active_storage.variant_processor = :vips if ENV['ACTIVESTORAGE_ENABLE_VIPS'] == 'true' Rails.application.config.active_storage.variant_processor = :vips if ENV['ACTIVESTORAGE_ENABLE_VIPS'] == 'true'
ActiveStorage::Downloader.class_eval do ActiveStorage::Downloader.class_eval do
def open(key, checksum:, name: 'ActiveStorage-', tmpdir: nil) def open(key, checksum: nil, verify: true, name: 'ActiveStorage-', tmpdir: nil)
open_tempfile(name, tmpdir) do |file| open_tempfile(name, tmpdir) do |file|
download key, file download key, file
if checksum == 'dummy' || checksum.nil? if checksum == 'dummy' || checksum.nil?
ActiveStorage::Blob.find_by(key: key).update(checksum: Digest::MD5.file(file).base64digest) ActiveStorage::Blob.find_by(key: key).update(checksum: Digest::MD5.file(file).base64digest)
else else
verify_integrity_of file, checksum: checksum verify_integrity_of(file, checksum: checksum) if verify
end end
yield file yield file
end end