2017-06-06 23:35:29 +08:00
|
|
|
class UserRepositoriesController < ApplicationController
|
|
|
|
before_action :load_vars
|
|
|
|
|
|
|
|
def save_table_state
|
2018-04-18 21:53:48 +08:00
|
|
|
service = RepositoryTableStateService.new(current_user, @repository)
|
2019-05-27 22:42:57 +08:00
|
|
|
service.update_state(params.require(:state).permit!.to_h)
|
2023-07-18 19:36:41 +08:00
|
|
|
render json: {
|
|
|
|
status: :ok
|
|
|
|
}
|
2017-06-06 23:35:29 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def load_table_state
|
2018-04-18 21:53:48 +08:00
|
|
|
service = RepositoryTableStateService.new(current_user, @repository)
|
|
|
|
state = service.load_state.state
|
2023-07-18 19:36:41 +08:00
|
|
|
if state
|
|
|
|
render json: {
|
|
|
|
state: state
|
|
|
|
}
|
2017-06-06 23:35:29 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def load_vars
|
2020-04-21 20:49:36 +08:00
|
|
|
@repository = RepositoryBase.find_by(id: params[:repository_id])
|
2020-05-06 21:17:54 +08:00
|
|
|
render_403 if @repository.nil? || !can_read_repository?(@repository)
|
2017-06-06 23:35:29 +08:00
|
|
|
end
|
|
|
|
end
|