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)
|
|
|
|
service.update_state(params[:state])
|
2017-06-06 23:35:29 +08:00
|
|
|
respond_to do |format|
|
|
|
|
format.json do
|
|
|
|
render json: {
|
|
|
|
status: :ok
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def load_table_state
|
2018-04-18 21:53:48 +08:00
|
|
|
service = RepositoryTableStateService.new(current_user, @repository)
|
|
|
|
state = service.load_state.state
|
2017-06-06 23:35:29 +08:00
|
|
|
respond_to do |format|
|
2018-04-18 21:53:48 +08:00
|
|
|
if state
|
2017-06-06 23:35:29 +08:00
|
|
|
format.json do
|
|
|
|
render json: {
|
2018-04-18 21:53:48 +08:00
|
|
|
state: state
|
2017-06-06 23:35:29 +08:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def load_vars
|
|
|
|
@repository = Repository.find_by_id(params[:repository_id])
|
2017-12-12 21:56:07 +08:00
|
|
|
render_403 if @repository.nil? || !can_read_team?(@repository.team)
|
2017-06-06 23:35:29 +08:00
|
|
|
end
|
|
|
|
end
|