mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
7dcc774414
* Remove redundant use of respond_to in controlller actions with just one responder format [SCI-8811] * Remove redundant begin block and replace 303 status code with :see_other [SCI-8811]
28 lines
683 B
Ruby
28 lines
683 B
Ruby
class UserRepositoriesController < ApplicationController
|
|
before_action :load_vars
|
|
|
|
def save_table_state
|
|
service = RepositoryTableStateService.new(current_user, @repository)
|
|
service.update_state(params.require(:state).permit!.to_h)
|
|
render json: {
|
|
status: :ok
|
|
}
|
|
end
|
|
|
|
def load_table_state
|
|
service = RepositoryTableStateService.new(current_user, @repository)
|
|
state = service.load_state.state
|
|
if state
|
|
render json: {
|
|
state: state
|
|
}
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def load_vars
|
|
@repository = RepositoryBase.find_by(id: params[:repository_id])
|
|
render_403 if @repository.nil? || !can_read_repository?(@repository)
|
|
end
|
|
end
|