mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 12:27:16 +08:00
FEATURE: Option to disable user presence and profile
This allows users who are privacy conscious to disable the presence features of the forum as well as their public profile.
This commit is contained in:
@ -113,6 +113,12 @@ export default Ember.Component.extend({
|
||||
|
||||
publish(data) {
|
||||
this._lastPublish = new Date();
|
||||
|
||||
// Don't publish presence if disabled
|
||||
if (this.currentUser.hide_profile_and_presence) {
|
||||
return Ember.RSVP.Promise.resolve();
|
||||
}
|
||||
|
||||
return ajax("/presence/publish", { type: "POST", data });
|
||||
},
|
||||
|
||||
|
@ -107,8 +107,7 @@ after_initialize do
|
||||
ACTIONS ||= [-"edit", -"reply"].freeze
|
||||
|
||||
def publish
|
||||
|
||||
raise Discourse::NotFound if !current_user
|
||||
raise Discourse::NotFound if current_user.blank? || current_user.user_option.hide_profile_and_presence?
|
||||
|
||||
data = params.permit(
|
||||
:response_needed,
|
||||
|
@ -37,6 +37,12 @@ describe ::Presence::PresencesController do
|
||||
expect { post '/presence/publish.json' }.not_to raise_error
|
||||
end
|
||||
|
||||
it "does not publish for users with disabled presence features" do
|
||||
user1.user_option.update_column(:hide_profile_and_presence, true)
|
||||
post '/presence/publish.json'
|
||||
expect(response.code).to eq("404")
|
||||
end
|
||||
|
||||
it "uses guardian to secure endpoint" do
|
||||
private_post = Fabricate(:private_message_post)
|
||||
|
||||
|
Reference in New Issue
Block a user