diff --git a/app/assets/javascripts/admin/addon/mixins/setting-component.js b/app/assets/javascripts/admin/addon/mixins/setting-component.js index fb77bcf3b32..e9e9da06592 100644 --- a/app/assets/javascripts/admin/addon/mixins/setting-component.js +++ b/app/assets/javascripts/admin/addon/mixins/setting-component.js @@ -51,7 +51,8 @@ const DEFAULT_USER_PREFERENCES = [ "default_email_mailing_list_mode_frequency", "default_email_previous_replies", "default_email_in_reply_to", - "default_hide_profile_and_presence", + "default_hide_profile", + "default_hide_presence", "default_other_new_topic_duration_minutes", "default_other_auto_track_topics_after_msecs", "default_other_notification_level_when_replying", diff --git a/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs b/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs index 6fe664252c0..07c391f7c18 100644 --- a/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs +++ b/app/assets/javascripts/discourse/app/components/user-menu/profile-tab-content.hbs @@ -23,6 +23,36 @@ {{/if}} +
  • + + {{d-icon (if this.isPresenceHidden "toggle-on" "toggle-off")}} + + {{i18n "presence_toggle.label"}} + + +
  • + +
  • + + {{d-icon (if this.isInDoNotDisturb "toggle-on" "toggle-off")}} + + {{#if this.isInDoNotDisturb}} + {{i18n "pause_notifications.label"}} + {{#if this.showDoNotDisturbEndDate}} + {{format-age this.doNotDisturbDateTime}} + {{/if}} + {{else}} + {{i18n "pause_notifications.label"}} + {{/if}} + + +
  • + +
    +
  • {{d-icon "user"}} @@ -74,25 +104,6 @@
  • -
  • - - {{d-icon (if this.isInDoNotDisturb "toggle-on" "toggle-off")}} - - {{#if this.isInDoNotDisturb}} - {{i18n "pause_notifications.label"}} - {{#if this.showDoNotDisturbEndDate}} - {{format-age this.doNotDisturbDateTime}} - {{/if}} - {{else}} - {{i18n "pause_notifications.label"}} - {{/if}} - - -
  • - {{#if this.showToggleAnonymousButton}}
  • diff --git a/app/assets/javascripts/discourse/tests/fixtures/user-fixtures.js b/app/assets/javascripts/discourse/tests/fixtures/user-fixtures.js index 81dadba25ac..47c9fc0c046 100644 --- a/app/assets/javascripts/discourse/tests/fixtures/user-fixtures.js +++ b/app/assets/javascripts/discourse/tests/fixtures/user-fixtures.js @@ -2722,6 +2722,8 @@ export default { allow_private_messages: true, homepage_id: null, hide_profile_and_presence: false, + hide_profile: false, + hide_presence: false, text_size: "normal", text_size_seq: 0, timezone: "America/Los_Angeles", @@ -3126,6 +3128,8 @@ export default { allow_private_messages: true, homepage_id: null, hide_profile_and_presence: false, + hide_profile: false, + hide_presence: false, text_size: "normal", text_size_seq: 0, title_count_mode: "notifications", diff --git a/app/assets/stylesheets/common/base/menu-panel.scss b/app/assets/stylesheets/common/base/menu-panel.scss index 91ef237fcef..cfae08346da 100644 --- a/app/assets/stylesheets/common/base/menu-panel.scss +++ b/app/assets/stylesheets/common/base/menu-panel.scss @@ -236,6 +236,11 @@ color: var(--tertiary); } } + + hr { + border-top: 1px solid var(--primary-low); + width: 100%; + } } } diff --git a/app/models/user_option.rb b/app/models/user_option.rb index a61091c5af2..1cdf09d6fd9 100644 --- a/app/models/user_option.rb +++ b/app/models/user_option.rb @@ -21,6 +21,7 @@ class UserOption < ActiveRecord::Base belongs_to :user before_create :set_defaults + before_save :update_hide_profile_and_presence after_save :update_tracked_topics scope :human_users, -> { where("user_id > 0") } @@ -94,7 +95,8 @@ class UserOption < ActiveRecord::Base self.title_count_mode = SiteSetting.default_title_count_mode - self.hide_profile_and_presence = SiteSetting.default_hide_profile_and_presence + self.hide_profile = SiteSetting.default_hide_profile + self.hide_presence = SiteSetting.default_hide_presence self.sidebar_link_to_filtered_list = SiteSetting.default_sidebar_link_to_filtered_list self.sidebar_show_count_of_new_items = SiteSetting.default_sidebar_show_count_of_new_items @@ -223,6 +225,15 @@ class UserOption < ActiveRecord::Base private + def update_hide_profile_and_presence + if hide_profile_changed? || hide_presence_changed? + self.hide_profile_and_presence = hide_profile || hide_presence + elsif hide_profile_and_presence_changed? + self.hide_profile = hide_profile_and_presence + self.hide_presence = hide_profile_and_presence + end + end + def update_tracked_topics return unless saved_change_to_auto_track_topics_after_msecs? TrackedTopicsUpdater.new(id, auto_track_topics_after_msecs).call @@ -255,6 +266,8 @@ end # homepage_id :integer # theme_ids :integer default([]), not null, is an Array # hide_profile_and_presence :boolean default(FALSE), not null +# hide_profile :boolean default(FALSE), not null +# hide_presence :boolean default(FALSE), not null # text_size_key :integer default(0), not null # text_size_seq :integer default(0), not null # email_level :integer default(1), not null diff --git a/app/serializers/concerns/user_status_mixin.rb b/app/serializers/concerns/user_status_mixin.rb index a0ffb7a952b..f47c0344131 100644 --- a/app/serializers/concerns/user_status_mixin.rb +++ b/app/serializers/concerns/user_status_mixin.rb @@ -7,7 +7,7 @@ module UserStatusMixin def include_status? @options[:include_status] && SiteSetting.enable_user_status && - !object.user_option&.hide_profile_and_presence && object.has_status? + !object.user_option&.hide_profile && object.has_status? end def status diff --git a/app/serializers/current_user_option_serializer.rb b/app/serializers/current_user_option_serializer.rb index 6911a8c026a..5c680a6650c 100644 --- a/app/serializers/current_user_option_serializer.rb +++ b/app/serializers/current_user_option_serializer.rb @@ -9,6 +9,8 @@ class CurrentUserOptionSerializer < ApplicationSerializer :automatically_unpin_topics, :likes_notifications_disabled, :hide_profile_and_presence, + :hide_profile, + :hide_presence, :title_count_mode, :enable_defer, :timezone, diff --git a/app/serializers/user_option_serializer.rb b/app/serializers/user_option_serializer.rb index 466d6046555..4bdefe81e1c 100644 --- a/app/serializers/user_option_serializer.rb +++ b/app/serializers/user_option_serializer.rb @@ -29,6 +29,8 @@ class UserOptionSerializer < ApplicationSerializer :enable_allowed_pm_users, :homepage_id, :hide_profile_and_presence, + :hide_profile, + :hide_presence, :text_size, :text_size_seq, :title_count_mode, diff --git a/app/services/site_setting_update_existing_users.rb b/app/services/site_setting_update_existing_users.rb index 32313282862..befe2e34041 100644 --- a/app/services/site_setting_update_existing_users.rb +++ b/app/services/site_setting_update_existing_users.rb @@ -126,7 +126,8 @@ class SiteSettingUpdateExistingUsers default_include_tl0_in_digests: "include_tl0_in_digests", default_text_size: "text_size_key", default_title_count_mode: "title_count_mode_key", - default_hide_profile_and_presence: "hide_profile_and_presence", + default_hide_profile: "hide_profile", + default_hide_presence: "hide_presence", default_sidebar_link_to_filtered_list: "sidebar_link_to_filtered_list", default_sidebar_show_count_of_new_items: "sidebar_show_count_of_new_items", } diff --git a/app/services/user_updater.rb b/app/services/user_updater.rb index 3e67a55f761..519c45730bb 100644 --- a/app/services/user_updater.rb +++ b/app/services/user_updater.rb @@ -42,7 +42,8 @@ class UserUpdater allow_private_messages enable_allowed_pm_users homepage_id - hide_profile_and_presence + hide_profile + hide_presence text_size title_count_mode timezone diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 061f5b18270..05730fe0014 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1839,7 +1839,7 @@ en: website: "Web Site" email_settings: "Email" - hide_profile_and_presence: "Hide my public profile and presence features" + hide_profile: "Hide my public profile" enable_physical_keyboard: "Enable physical keyboard support on iPad" text_size: @@ -2146,6 +2146,10 @@ en: pause_notifications: "Pause notifications" remove_status: "Remove status" + presence_toggle: + label: "Online" + title: "Toggle presence features" + user_tips: button: "Got it!" skip: "Skip tips" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index c46a4235518..15244416753 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2596,7 +2596,8 @@ en: default_email_in_reply_to: "Include excerpt of replied to post in emails by default." - default_hide_profile_and_presence: "Hide user public profile and presence features by default." + default_hide_profile: "Hide user public profile by default." + default_hide_presence: "Disable presence features by default." default_other_new_topic_duration_minutes: "Global default condition for which a topic is considered new." default_other_auto_track_topics_after_msecs: "Global default time before a topic is automatically tracked." diff --git a/config/site_settings.yml b/config/site_settings.yml index cc7db9d30b3..eba29414490 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -3007,7 +3007,9 @@ user_preferences: default: 2 default_email_in_reply_to: default: false - default_hide_profile_and_presence: + default_hide_profile: + default: false + default_hide_presence: default: false default_other_new_topic_duration_minutes: enum: "NewTopicDurationSiteSetting" diff --git a/db/migrate/20241030210727_split_hide_profile_and_presence.rb b/db/migrate/20241030210727_split_hide_profile_and_presence.rb new file mode 100644 index 00000000000..fb9e9f7dff0 --- /dev/null +++ b/db/migrate/20241030210727_split_hide_profile_and_presence.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class SplitHideProfileAndPresence < ActiveRecord::Migration[7.1] + def up + # Split default_hide_profile_and_presence if setting exists + result = + execute( + "SELECT value, data_type FROM site_settings WHERE name = 'default_hide_profile_and_presence' LIMIT 1", + ).first + + if result + value = result["value"] + data_type = result["data_type"] + + execute "DELETE FROM site_settings WHERE name = 'default_hide_profile_and_presence'" + execute <<-SQL + INSERT INTO site_settings (name, value, data_type, created_at, updated_at) + VALUES + ('default_hide_profile', '#{value}', '#{data_type}', NOW(), NOW()), + ('default_hide_presence', '#{value}', '#{data_type}', NOW(), NOW()); + SQL + end + + # Add new columns to user_options + execute "ALTER TABLE user_options ADD COLUMN hide_profile BOOLEAN DEFAULT FALSE NOT NULL" + execute "ALTER TABLE user_options ADD COLUMN hide_presence BOOLEAN DEFAULT FALSE NOT NULL" + execute <<-SQL + UPDATE user_options + SET hide_profile = hide_profile_and_presence, + hide_presence = hide_profile_and_presence + WHERE hide_profile_and_presence; + SQL + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/lib/guardian/user_guardian.rb b/lib/guardian/user_guardian.rb index 79f2c7b3876..755f1cfbbd9 100644 --- a/lib/guardian/user_guardian.rb +++ b/lib/guardian/user_guardian.rb @@ -131,7 +131,7 @@ module UserGuardian return true if !SiteSetting.allow_users_to_hide_profile? # If a user has hidden their profile, restrict it to them and staff - return is_me?(user) || is_staff? if user.user_option.try(:hide_profile_and_presence?) + return is_me?(user) || is_staff? if user.user_option.try(:hide_profile?) true end diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index e8d6e3a0b65..e4f4df6dbb2 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -173,6 +173,8 @@ def insert_user_options like_notification_frequency, skip_new_user_tips, hide_profile_and_presence, + hide_profile, + hide_presence, sidebar_link_to_filtered_list, sidebar_show_count_of_new_items ) @@ -196,7 +198,9 @@ def insert_user_options , #{SiteSetting.default_other_notification_level_when_replying} , #{SiteSetting.default_other_like_notification_frequency} , #{SiteSetting.default_other_skip_new_user_tips} - , #{SiteSetting.default_hide_profile_and_presence} + , #{SiteSetting.default_hide_profile || SiteSetting.default_hide_presence} + , #{SiteSetting.default_hide_profile} + , #{SiteSetting.default_hide_presence} , #{SiteSetting.default_sidebar_link_to_filtered_list} , #{SiteSetting.default_sidebar_show_count_of_new_items} FROM users u diff --git a/plugins/chat/assets/javascripts/discourse/services/chat.js b/plugins/chat/assets/javascripts/discourse/services/chat.js index 10a4b4839d0..a4f7950ee7f 100644 --- a/plugins/chat/assets/javascripts/discourse/services/chat.js +++ b/plugins/chat/assets/javascripts/discourse/services/chat.js @@ -260,7 +260,7 @@ export default class Chat extends Service { return; } - if (this.currentUser.user_option?.hide_profile_and_presence) { + if (this.currentUser.user_option?.hide_presence) { return; } diff --git a/plugins/chat/spec/requests/core_ext/users_controller_spec.rb b/plugins/chat/spec/requests/core_ext/users_controller_spec.rb index 77f04d60152..3b9e6538c1b 100644 --- a/plugins/chat/spec/requests/core_ext/users_controller_spec.rb +++ b/plugins/chat/spec/requests/core_ext/users_controller_spec.rb @@ -68,7 +68,7 @@ describe UsersController do before { sign_in(user) } it "returns that the user can message themselves" do - user.user_option.update!(hide_profile_and_presence: false) + user.user_option.update!(hide_profile: false) user.user_option.update!(chat_enabled: true) get "/u/#{user.username}/card.json" expect(response).to be_successful @@ -76,7 +76,7 @@ describe UsersController do end it "returns that the user can message themselves when the profile is hidden" do - user.user_option.update!(hide_profile_and_presence: true) + user.user_option.update!(hide_profile: true) user.user_option.update!(chat_enabled: true) get "/u/#{user.username}/card.json" expect(response).to be_successful @@ -87,7 +87,7 @@ describe UsersController do context "when hidden users" do before do sign_in(another_user) - user.user_option.update!(hide_profile_and_presence: true) + user.user_option.update!(hide_profile: true) end it "returns the correct partial response when the user has chat enabled" do diff --git a/plugins/chat/spec/serializer/chat/chatables_serializer_spec.rb b/plugins/chat/spec/serializer/chat/chatables_serializer_spec.rb index bb24f22d295..02ed541482d 100644 --- a/plugins/chat/spec/serializer/chat/chatables_serializer_spec.rb +++ b/plugins/chat/spec/serializer/chat/chatables_serializer_spec.rb @@ -21,7 +21,7 @@ describe Chat::ChatablesSerializer do end context "with hidden profile" do - before { user_1.user_option.update!(hide_profile_and_presence: true) } + before { user_1.user_option.update!(hide_profile: true) } it "doesn’t include status" do serializer = diff --git a/plugins/discourse-presence/assets/javascripts/discourse/services/composer-presence-manager.js b/plugins/discourse-presence/assets/javascripts/discourse/services/composer-presence-manager.js index 611cb234aee..e099f522b34 100644 --- a/plugins/discourse-presence/assets/javascripts/discourse/services/composer-presence-manager.js +++ b/plugins/discourse-presence/assets/javascripts/discourse/services/composer-presence-manager.js @@ -11,7 +11,7 @@ export default class ComposerPresenceManager extends Service { notifyState(intent, id) { if ( this.siteSettings.allow_users_to_hide_profile && - this.currentUser.user_option.hide_profile_and_presence + this.currentUser.user_option.hide_presence ) { return; } diff --git a/script/bulk_import/base.rb b/script/bulk_import/base.rb index 41c43fda17a..53d9bea05ba 100644 --- a/script/bulk_import/base.rb +++ b/script/bulk_import/base.rb @@ -586,6 +586,8 @@ class BulkImport::Base like_notification_frequency skip_new_user_tips hide_profile_and_presence + hide_profile + hide_presence sidebar_link_to_filtered_list sidebar_show_count_of_new_items timezone @@ -1321,7 +1323,8 @@ class BulkImport::Base notification_level_when_replying: SiteSetting.default_other_notification_level_when_replying, like_notification_frequency: SiteSetting.default_other_like_notification_frequency, skip_new_user_tips: SiteSetting.default_other_skip_new_user_tips, - hide_profile_and_presence: SiteSetting.default_hide_profile_and_presence, + hide_profile: SiteSetting.default_hide_profile, + hide_presence: SiteSetting.default_hide_presence, sidebar_link_to_filtered_list: SiteSetting.default_sidebar_link_to_filtered_list, sidebar_show_count_of_new_items: SiteSetting.default_sidebar_show_count_of_new_items, } diff --git a/spec/lib/guardian/user_guardian_spec.rb b/spec/lib/guardian/user_guardian_spec.rb index bb663474eb4..cdb3e0550bb 100644 --- a/spec/lib/guardian/user_guardian_spec.rb +++ b/spec/lib/guardian/user_guardian_spec.rb @@ -112,7 +112,7 @@ RSpec.describe UserGuardian do let(:hidden_user) do result = Fabricate(:user) - result.user_option.update_column(:hide_profile_and_presence, true) + result.user_option.update_column(:hide_profile, true) result end diff --git a/spec/models/user_option_spec.rb b/spec/models/user_option_spec.rb index 107b5463cc0..9c5e6b5ff5c 100644 --- a/spec/models/user_option_spec.rb +++ b/spec/models/user_option_spec.rb @@ -28,7 +28,8 @@ RSpec.describe UserOption do end it "should not hide the profile and presence by default" do - expect(user.user_option.hide_profile_and_presence).to eq(false) + expect(user.user_option.hide_profile).to eq(false) + expect(user.user_option.hide_presence).to eq(false) end it "should correctly set digest frequency" do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9c58f4f4ab8..2eac7ec6f76 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2167,7 +2167,8 @@ RSpec.describe User do SiteSetting.default_other_dynamic_favicon = true SiteSetting.default_other_skip_new_user_tips = true - SiteSetting.default_hide_profile_and_presence = true + SiteSetting.default_hide_profile = true + SiteSetting.default_hide_presence = true SiteSetting.default_topics_automatic_unpin = false SiteSetting.default_categories_watching = category0.id.to_s @@ -2189,7 +2190,8 @@ RSpec.describe User do expect(options.enable_smart_lists).to eq(false) expect(options.dynamic_favicon).to eq(true) expect(options.skip_new_user_tips).to eq(true) - expect(options.hide_profile_and_presence).to eq(true) + expect(options.hide_profile).to eq(true) + expect(options.hide_presence).to eq(true) expect(options.automatically_unpin_topics).to eq(false) expect(options.new_topic_duration_minutes).to eq(-1) expect(options.auto_track_topics_after_msecs).to eq(0) diff --git a/spec/requests/api/schemas/json/user_get_response.json b/spec/requests/api/schemas/json/user_get_response.json index 263a0f0096f..6e2854d2cc4 100644 --- a/spec/requests/api/schemas/json/user_get_response.json +++ b/spec/requests/api/schemas/json/user_get_response.json @@ -771,6 +771,12 @@ "hide_profile_and_presence": { "type": "boolean" }, + "hide_profile": { + "type": "boolean" + }, + "hide_presence": { + "type": "boolean" + }, "text_size": { "type": "string" }, @@ -840,6 +846,8 @@ "enable_allowed_pm_users", "homepage_id", "hide_profile_and_presence", + "hide_profile", + "hide_presence", "text_size", "text_size_seq", "title_count_mode", diff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rb index 4e86f5790a1..5d055273ee9 100644 --- a/spec/requests/list_controller_spec.rb +++ b/spec/requests/list_controller_spec.rb @@ -942,8 +942,8 @@ RSpec.describe ListController do end end - context "when `hide_profile_and_presence` is true" do - before { user.user_option.update_columns(hide_profile_and_presence: true) } + context "when `hide_profile` is true" do + before { user.user_option.update_columns(hide_profile: true) } it "returns 404" do get "/topics/created-by/#{user.username}.json" @@ -1149,8 +1149,8 @@ RSpec.describe ListController do end describe "user_topics_feed" do - it "returns 404 if `hide_profile_and_presence` user option is checked" do - user.user_option.update_columns(hide_profile_and_presence: true) + it "returns 404 if `hide_profile` user option is checked" do + user.user_option.update_columns(hide_profile: true) get "/u/#{user.username}/activity/topics.rss" expect(response.status).to eq(404) end diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rb index 3e6a20b5791..4688cebd3b2 100644 --- a/spec/requests/posts_controller_spec.rb +++ b/spec/requests/posts_controller_spec.rb @@ -2630,8 +2630,8 @@ RSpec.describe PostsController do expect(body).to include(public_post.topic.slug) end - it "returns 404 if `hide_profile_and_presence` user option is checked" do - user.user_option.update_columns(hide_profile_and_presence: true) + it "returns 404 if `hide_profile` user option is checked" do + user.user_option.update_columns(hide_profile: true) get "/u/#{user.username}/activity.rss" expect(response.status).to eq(404) @@ -2641,7 +2641,7 @@ RSpec.describe PostsController do end it "succeeds when `allow_users_to_hide_profile` is false" do - user.user_option.update_columns(hide_profile_and_presence: true) + user.user_option.update_columns(hide_profile: true) SiteSetting.allow_users_to_hide_profile = false get "/u/#{user.username}/activity.rss" diff --git a/spec/requests/user_actions_controller_spec.rb b/spec/requests/user_actions_controller_spec.rb index 71dc113628f..6723995f8e7 100644 --- a/spec/requests/user_actions_controller_spec.rb +++ b/spec/requests/user_actions_controller_spec.rb @@ -55,7 +55,7 @@ RSpec.describe UserActionsController do context "when user's profile is hidden" do fab!(:post) - before { post.user.user_option.update_column(:hide_profile_and_presence, true) } + before { post.user.user_option.update_column(:hide_profile, true) } context "when `allow_users_to_hide_profile` is disabled" do before { SiteSetting.allow_users_to_hide_profile = false } diff --git a/spec/requests/user_badges_controller_spec.rb b/spec/requests/user_badges_controller_spec.rb index 8190f9bb633..a4224239234 100644 --- a/spec/requests/user_badges_controller_spec.rb +++ b/spec/requests/user_badges_controller_spec.rb @@ -166,9 +166,9 @@ RSpec.describe UserBadgesController do end context "with hidden profiles" do - before { user.user_option.update_columns(hide_profile_and_presence: true) } + before { user.user_option.update_columns(hide_profile: true) } - it "returns 404 if `hide_profile_and_presence` user option is checked" do + it "returns 404 if `hide_profile` user option is checked" do get "/user-badges/#{user.username}.json" expect(response.status).to eq(404) end diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index d1153df207f..9a6350198ae 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -4282,8 +4282,8 @@ RSpec.describe UsersController do end end - context "when `hide_profile_and_presence` user option is checked" do - before_all { user1.user_option.update_columns(hide_profile_and_presence: true) } + context "when `hide_profile` user option is checked" do + before_all { user1.user_option.update_columns(hide_profile: true) } it "returns 404" do get "/u/#{user1.username_lower}/summary.json" @@ -4642,7 +4642,7 @@ RSpec.describe UsersController do end it "returns a hidden profile" do - user.user_option.update_column(:hide_profile_and_presence, true) + user.user_option.update_column(:hide_profile, true) get "/u/#{user.username}.json" expect(response.status).to eq(200) @@ -4840,7 +4840,7 @@ RSpec.describe UsersController do it "should not be able to view a private user profile" do user1.user_profile.update!(bio_raw: "Hello world!") - user1.user_option.update!(hide_profile_and_presence: true) + user1.user_option.update!(hide_profile: true) get "/u/#{user1.username}" @@ -4913,7 +4913,7 @@ RSpec.describe UsersController do end context "when hidden users" do - before { user.user_option.update!(hide_profile_and_presence: true) } + before { user.user_option.update!(hide_profile: true) } it "returns the correct partial response when the user has messages enabled" do user.user_option.update!(allow_private_messages: true) @@ -4952,8 +4952,8 @@ RSpec.describe UsersController do expect(response).to have_http_status(:forbidden) end - context "when `hide_profile_and_presence` user option is checked" do - before { user2.user_option.update_columns(hide_profile_and_presence: true) } + context "when `hide_profile` user option is checked" do + before { user2.user_option.update_columns(hide_profile: true) } it "does not include hidden profiles" do get "/user-cards.json?user_ids=#{user.id},#{user2.id}" diff --git a/spec/serializers/concerns/user_status_mixin_spec.rb b/spec/serializers/concerns/user_status_mixin_spec.rb index d31926d416f..ed9b45f825b 100644 --- a/spec/serializers/concerns/user_status_mixin_spec.rb +++ b/spec/serializers/concerns/user_status_mixin_spec.rb @@ -34,7 +34,7 @@ RSpec.describe UserStatusMixin do end it "doesn't include status if user hid profile and presence" do - user.user_option.hide_profile_and_presence = true + user.user_option.hide_profile = true serializer = DummySerializer.new(user, root: false, include_status: true) json = serializer.as_json expect(json[:status]).to be_nil