mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Reset invalid state
SCI-5306
This commit is contained in:
parent
63a41b123d
commit
7c967d32f1
2 changed files with 6 additions and 6 deletions
|
@ -14,6 +14,7 @@ class ProjectsController < ApplicationController
|
|||
before_action :check_manage_permissions, only: :edit
|
||||
before_action :set_inline_name_editing, only: %i(show)
|
||||
before_action :load_exp_sort_var, only: %i(show experiment_archive)
|
||||
before_action :reset_invalid_view_state, only: %i(index cards)
|
||||
|
||||
layout 'fluid'
|
||||
|
||||
|
@ -286,6 +287,11 @@ class ProjectsController < ApplicationController
|
|||
.any? { |param_name| params.dig(param_name).present? }
|
||||
end
|
||||
|
||||
def reset_invalid_view_state
|
||||
view_state = current_team.current_view_state(current_user)
|
||||
view_state.destroy unless view_state.valid?
|
||||
end
|
||||
|
||||
def log_activity(type_of, message_items = {})
|
||||
message_items = { project: @project.id }.merge(message_items)
|
||||
|
||||
|
|
|
@ -8,12 +8,6 @@ class ProjectsOverviewService
|
|||
@params = params
|
||||
@view_state = @team.current_view_state(@user)
|
||||
|
||||
# Default state changed, reset invalid state
|
||||
unless @view_state.valid?
|
||||
@view_state.destroy
|
||||
@view_state = @team.current_view_state(@user)
|
||||
end
|
||||
|
||||
# Update view_mode if changed
|
||||
if @view_state.state.dig('projects', 'view_mode') != @params[:filter] &&
|
||||
%w(active archived).include?(@params[:filter])
|
||||
|
|
Loading…
Reference in a new issue