mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: user status (#16875)
This commit is contained in:
committed by
GitHub
parent
ac59168dde
commit
5c596273a0
25
app/controllers/user_status_controller.rb
Normal file
25
app/controllers/user_status_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserStatusController < ApplicationController
|
||||
requires_login
|
||||
|
||||
def set
|
||||
ensure_feature_enabled
|
||||
raise Discourse::InvalidParameters.new(:description) if params[:description].blank?
|
||||
|
||||
current_user.set_status!(params[:description])
|
||||
render json: success_json
|
||||
end
|
||||
|
||||
def clear
|
||||
ensure_feature_enabled
|
||||
current_user.clear_status!
|
||||
render json: success_json
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_feature_enabled
|
||||
raise ActionController::RoutingError.new("Not Found") if !SiteSetting.enable_user_status
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user