diff --git a/.rubocop.yml b/.rubocop.yml index 68abba36ad9..bc8c3e592bf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,6 +8,30 @@ Discourse/NoAddReferenceOrAliasesActiveRecordMigration: Discourse/NoResetColumnInformationInMigrations: Enabled: true +Discourse/Plugins/CallRequiresPlugin: + Include: + - "plugins/*/app/controllers/**/*" + +Discourse/Plugins/UsePluginInstanceOn: + Include: + - "plugins/**/*" + +Discourse/Plugins/NamespaceMethods: + Include: + - "plugins/**/*" + +Discourse/Plugins/NamespaceConstants: + Include: + - "plugins/**/*" + +Discourse/Plugins/UseRequireRelative: + Include: + - "plugins/**/*" + +Discourse/Plugins/NoMonkeyPatching: + Include: + - "plugins/**/*" + Lint/Debugger: Exclude: - script/**/* diff --git a/Gemfile.lock b/Gemfile.lock index 1d772ce1b60..456b0c135aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -305,6 +305,7 @@ GEM racc pg (1.5.4) prettier_print (1.2.1) + prism (0.24.0) progress (3.6.0) pry (0.14.2) coderay (~> 1.1) @@ -417,12 +418,16 @@ GEM rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.1) + rubocop-ast (1.31.0) parser (>= 3.3.0.4) + prism (>= 0.24.0) rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-discourse (3.6.1) + rubocop-discourse (3.7.1) + activesupport (>= 6.1) rubocop (>= 1.59.0) + rubocop-capybara (>= 2.0.0) + rubocop-factory_bot (>= 2.0.0) rubocop-rspec (>= 2.25.0) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) diff --git a/plugins/chat/app/controllers/chat/api/category_chatables_controller.rb b/plugins/chat/app/controllers/chat/api/category_chatables_controller.rb index 352326cda6a..3badc183b82 100644 --- a/plugins/chat/app/controllers/chat/api/category_chatables_controller.rb +++ b/plugins/chat/app/controllers/chat/api/category_chatables_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Chat::Api::CategoryChatablesController < ApplicationController + requires_plugin Chat::PLUGIN_NAME + def permissions category = Category.find(params[:id]) diff --git a/plugins/chat/app/controllers/chat/api/channels_controller.rb b/plugins/chat/app/controllers/chat/api/channels_controller.rb index b69b33ff33c..17d85dcb73f 100644 --- a/plugins/chat/app/controllers/chat/api/channels_controller.rb +++ b/plugins/chat/app/controllers/chat/api/channels_controller.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -CHANNEL_EDITABLE_PARAMS ||= %i[name description slug] -CATEGORY_CHANNEL_EDITABLE_PARAMS ||= %i[ - auto_join_users - allow_channel_wide_mentions - threading_enabled -] - class Chat::Api::ChannelsController < Chat::ApiController + CHANNEL_EDITABLE_PARAMS ||= %i[name description slug] + CATEGORY_CHANNEL_EDITABLE_PARAMS ||= %i[ + auto_join_users + allow_channel_wide_mentions + threading_enabled + ] + def index permitted = params.permit(:filter, :limit, :offset, :status) diff --git a/plugins/chat/app/controllers/chat/api/channels_current_user_notifications_settings_controller.rb b/plugins/chat/app/controllers/chat/api/channels_current_user_notifications_settings_controller.rb index 6c39585d3ec..cb8bca0d987 100644 --- a/plugins/chat/app/controllers/chat/api/channels_current_user_notifications_settings_controller.rb +++ b/plugins/chat/app/controllers/chat/api/channels_current_user_notifications_settings_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -MEMBERSHIP_EDITABLE_PARAMS = %i[muted desktop_notification_level mobile_notification_level] - class Chat::Api::ChannelsCurrentUserNotificationsSettingsController < Chat::Api::ChannelsController + MEMBERSHIP_EDITABLE_PARAMS = %i[muted desktop_notification_level mobile_notification_level] + def update settings_params = params.require(:notifications_settings).permit(MEMBERSHIP_EDITABLE_PARAMS) membership_from_params.update!(settings_params.to_h) diff --git a/plugins/chat/app/controllers/chat/api/hints_controller.rb b/plugins/chat/app/controllers/chat/api/hints_controller.rb index 3a0635114bf..47b62610864 100644 --- a/plugins/chat/app/controllers/chat/api/hints_controller.rb +++ b/plugins/chat/app/controllers/chat/api/hints_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Chat::Api::HintsController < ApplicationController + requires_plugin Chat::PLUGIN_NAME + before_action :ensure_logged_in def check_group_mentions diff --git a/plugins/chat/app/controllers/chat/api_controller.rb b/plugins/chat/app/controllers/chat/api_controller.rb index 57ec914e2cd..11fda64aabc 100644 --- a/plugins/chat/app/controllers/chat/api_controller.rb +++ b/plugins/chat/app/controllers/chat/api_controller.rb @@ -2,18 +2,10 @@ module Chat class ApiController < ::Chat::BaseController - before_action :ensure_logged_in - before_action :ensure_can_chat - include Chat::WithServiceHelper private - def ensure_can_chat - raise Discourse::NotFound unless SiteSetting.chat_enabled - guardian.ensure_can_chat! - end - def default_actions_for_service proc do on_success { render(json: success_json) } diff --git a/plugins/chat/app/controllers/chat/base_controller.rb b/plugins/chat/app/controllers/chat/base_controller.rb index 3f7e2691c29..865511caba1 100644 --- a/plugins/chat/app/controllers/chat/base_controller.rb +++ b/plugins/chat/app/controllers/chat/base_controller.rb @@ -2,13 +2,14 @@ module Chat class BaseController < ::ApplicationController + requires_plugin Chat::PLUGIN_NAME + before_action :ensure_logged_in before_action :ensure_can_chat private def ensure_can_chat - raise Discourse::NotFound unless SiteSetting.chat_enabled guardian.ensure_can_chat! end diff --git a/plugins/chat/plugin.rb b/plugins/chat/plugin.rb index c79c39767af..e63c37ffa63 100644 --- a/plugins/chat/plugin.rb +++ b/plugins/chat/plugin.rb @@ -33,6 +33,10 @@ GlobalSetting.add_default(:allow_unsecure_chat_uploads, false) module ::Chat PLUGIN_NAME = "chat" + RETENTION_SETTINGS_TO_USER_OPTION_FIELDS = { + chat_channel_retention_days: :dismissed_channel_retention_reminder, + chat_dm_retention_days: :dismissed_dm_retention_reminder, + } end require_relative "lib/chat/engine" @@ -70,7 +74,7 @@ after_initialize do Group.prepend Chat::GroupExtension Jobs::UserEmail.prepend Chat::UserEmailExtension Plugin::Instance.prepend Chat::PluginInstanceExtension - Jobs::ExportCsvFile.class_eval { prepend Chat::MessagesExporter } + Jobs::ExportCsvFile.prepend Chat::MessagesExporter WebHook.prepend Chat::OutgoingWebHookExtension end @@ -270,12 +274,8 @@ after_initialize do include_condition: -> { SiteSetting.chat_enabled && SiteSetting.create_thumbnails }, ) { object.thumbnail } - RETENTION_SETTINGS_TO_USER_OPTION_FIELDS = { - chat_channel_retention_days: :dismissed_channel_retention_reminder, - chat_dm_retention_days: :dismissed_dm_retention_reminder, - } on(:site_setting_changed) do |name, old_value, new_value| - user_option_field = RETENTION_SETTINGS_TO_USER_OPTION_FIELDS[name.to_sym] + user_option_field = Chat::RETENTION_SETTINGS_TO_USER_OPTION_FIELDS[name.to_sym] begin if user_option_field && old_value != new_value && !new_value.zero? UserOption.where(user_option_field => true).update_all(user_option_field => false) @@ -342,10 +342,9 @@ after_initialize do nil end - CHAT_NOTIFICATION_TYPES = [Notification.types[:chat_mention], Notification.types[:chat_message]] register_push_notification_filter do |user, payload| if user.user_option.only_chat_push_notifications && user.user_option.chat_enabled - CHAT_NOTIFICATION_TYPES.include?(payload[:notification_type]) + payload[:notification_type].in?(::Notification.types.values_at(:chat_mention, :chat_message)) else true end diff --git a/plugins/discourse-local-dates/plugin.rb b/plugins/discourse-local-dates/plugin.rb index 76fb9885b6e..8f63bc262d7 100644 --- a/plugins/discourse-local-dates/plugin.rb +++ b/plugins/discourse-local-dates/plugin.rb @@ -19,7 +19,7 @@ after_initialize do POST_CUSTOM_FIELD ||= "local_dates".freeze end - %w[../lib/discourse_local_dates/engine.rb].each { |path| load File.expand_path(path, __FILE__) } + require_relative "lib/discourse_local_dates/engine" register_post_custom_field_type(DiscourseLocalDates::POST_CUSTOM_FIELD, :json) diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rb new file mode 100644 index 00000000000..0e96a6bcb62 --- /dev/null +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module DiscourseNarrativeBot + module PostGuardianExtension + extend ActiveSupport::Concern + + prepended do + alias_method :existing_can_create_post?, :can_create_post? + + def can_create_post?(parent) + if SiteSetting.discourse_narrative_bot_enabled && + parent.try(:subtype) == "system_message" && + parent.try(:user) == ::DiscourseNarrativeBot::Base.new.discobot_user + return true + end + + existing_can_create_post?(parent) + end + end + end +end diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rb index 5f3b6ed1782..c2e758d44bd 100644 --- a/plugins/discourse-narrative-bot/plugin.rb +++ b/plugins/discourse-narrative-bot/plugin.rb @@ -21,7 +21,7 @@ if Rails.env == "development" Rails.configuration.autoload_paths << File.expand_path("../autoload/jobs", __FILE__) end -require_relative "lib/discourse_narrative_bot/welcome_post_type_site_setting.rb" +require_relative "lib/discourse_narrative_bot/welcome_post_type_site_setting" register_asset "stylesheets/discourse-narrative-bot.scss" after_initialize do @@ -32,24 +32,23 @@ after_initialize do Mime::Type.register "image/svg+xml", :svg - %w[ - ../autoload/jobs/regular/bot_input.rb - ../autoload/jobs/regular/narrative_timeout.rb - ../autoload/jobs/regular/narrative_init.rb - ../autoload/jobs/regular/send_default_welcome_message.rb - ../autoload/jobs/onceoff/discourse_narrative_bot/grant_badges.rb - ../autoload/jobs/onceoff/discourse_narrative_bot/remap_old_bot_images.rb - ../lib/discourse_narrative_bot/actions.rb - ../lib/discourse_narrative_bot/base.rb - ../lib/discourse_narrative_bot/new_user_narrative.rb - ../lib/discourse_narrative_bot/advanced_user_narrative.rb - ../lib/discourse_narrative_bot/track_selector.rb - ../lib/discourse_narrative_bot/certificate_generator.rb - ../lib/discourse_narrative_bot/dice.rb - ../lib/discourse_narrative_bot/quote_generator.rb - ../lib/discourse_narrative_bot/magic_8_ball.rb - ../lib/discourse_narrative_bot/welcome_post_type_site_setting.rb - ].each { |path| load File.expand_path(path, __FILE__) } + require_relative "autoload/jobs/regular/bot_input" + require_relative "autoload/jobs/regular/narrative_timeout" + require_relative "autoload/jobs/regular/narrative_init" + require_relative "autoload/jobs/regular/send_default_welcome_message" + require_relative "autoload/jobs/onceoff/discourse_narrative_bot/grant_badges" + require_relative "autoload/jobs/onceoff/discourse_narrative_bot/remap_old_bot_images" + require_relative "lib/discourse_narrative_bot/actions" + require_relative "lib/discourse_narrative_bot/base" + require_relative "lib/discourse_narrative_bot/new_user_narrative" + require_relative "lib/discourse_narrative_bot/advanced_user_narrative" + require_relative "lib/discourse_narrative_bot/track_selector" + require_relative "lib/discourse_narrative_bot/certificate_generator" + require_relative "lib/discourse_narrative_bot/dice" + require_relative "lib/discourse_narrative_bot/quote_generator" + require_relative "lib/discourse_narrative_bot/magic_8_ball" + require_relative "lib/discourse_narrative_bot/welcome_post_type_site_setting" + require_relative "lib/discourse_narrative_bot/post_guardian_extension" RailsMultisite::ConnectionManagement.safe_each_connection do if SiteSetting.discourse_narrative_bot_enabled @@ -315,16 +314,5 @@ after_initialize do end end - PostGuardian.class_eval do - alias_method :existing_can_create_post?, :can_create_post? - - def can_create_post?(parent) - if SiteSetting.discourse_narrative_bot_enabled && parent.try(:subtype) == "system_message" && - parent.try(:user) == ::DiscourseNarrativeBot::Base.new.discobot_user - return true - end - - existing_can_create_post?(parent) - end - end + PostGuardian.prepend(DiscourseNarrativeBot::PostGuardianExtension) end diff --git a/plugins/poll/lib/post_extension.rb b/plugins/poll/lib/post_extension.rb new file mode 100644 index 00000000000..6f7fc8ebc93 --- /dev/null +++ b/plugins/poll/lib/post_extension.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module DiscoursePoll + module PostExtension + extend ActiveSupport::Concern + + prepended do + attr_accessor :extracted_polls + + has_many :polls, dependent: :destroy + + after_save do + polls = self.extracted_polls + self.extracted_polls = nil + next if polls.blank? || !polls.is_a?(Hash) + post = self + + ::Poll.transaction do + polls.values.each { |poll| DiscoursePoll::Poll.create!(post.id, poll) } + post.custom_fields[DiscoursePoll::HAS_POLLS] = true + post.save_custom_fields(true) + end + end + end + end +end diff --git a/plugins/poll/lib/user_extension.rb b/plugins/poll/lib/user_extension.rb new file mode 100644 index 00000000000..47e751e0c3d --- /dev/null +++ b/plugins/poll/lib/user_extension.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module DiscoursePoll + module UserExtension + extend ActiveSupport::Concern + + prepended { has_many :poll_votes, dependent: :delete_all } + end +end diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index 4cb1dfa0b40..18d5b075aa3 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -32,17 +32,19 @@ after_initialize do end end - require_relative "app/controllers/polls_controller.rb" - require_relative "app/models/poll_option.rb" - require_relative "app/models/poll_vote.rb" - require_relative "app/models/poll.rb" - require_relative "app/serializers/poll_option_serializer.rb" - require_relative "app/serializers/poll_serializer.rb" - require_relative "jobs/regular/close_poll.rb" - require_relative "lib/poll.rb" - require_relative "lib/polls_updater.rb" - require_relative "lib/polls_validator.rb" - require_relative "lib/post_validator.rb" + require_relative "app/controllers/polls_controller" + require_relative "app/models/poll_option" + require_relative "app/models/poll_vote" + require_relative "app/models/poll" + require_relative "app/serializers/poll_option_serializer" + require_relative "app/serializers/poll_serializer" + require_relative "jobs/regular/close_poll" + require_relative "lib/poll" + require_relative "lib/polls_updater" + require_relative "lib/polls_validator" + require_relative "lib/post_validator" + require_relative "lib/post_extension" + require_relative "lib/user_extension" DiscoursePoll::Engine.routes.draw do put "/vote" => "polls#vote" @@ -59,26 +61,8 @@ after_initialize do topic_view_post_custom_fields_allowlister { [DiscoursePoll::HAS_POLLS] } reloadable_patch do - Post.class_eval do - attr_accessor :extracted_polls - - has_many :polls, dependent: :destroy - - after_save do - polls = self.extracted_polls - self.extracted_polls = nil - next if polls.blank? || !polls.is_a?(Hash) - post = self - - Poll.transaction do - polls.values.each { |poll| DiscoursePoll::Poll.create!(post.id, poll) } - post.custom_fields[DiscoursePoll::HAS_POLLS] = true - post.save_custom_fields(true) - end - end - end - - User.class_eval { has_many :poll_votes, dependent: :delete_all } + Post.prepend(DiscoursePoll::PostExtension) + User.prepend(DiscoursePoll::UserExtension) end validate(:post, :validate_polls) do |force = nil| diff --git a/plugins/styleguide/plugin.rb b/plugins/styleguide/plugin.rb index 94de3474d61..835bc55bcd4 100644 --- a/plugins/styleguide/plugin.rb +++ b/plugins/styleguide/plugin.rb @@ -10,7 +10,7 @@ register_asset "stylesheets/styleguide.scss" enabled_site_setting :styleguide_enabled hide_plugin -load File.expand_path("../lib/styleguide/engine.rb", __FILE__) +require_relative "lib/styleguide/engine" Discourse::Application.routes.append { mount ::Styleguide::Engine, at: "/styleguide" } diff --git a/spec/lib/auth/default_current_user_provider_spec.rb b/spec/lib/auth/default_current_user_provider_spec.rb index 12559647e9f..cc0f1983829 100644 --- a/spec/lib/auth/default_current_user_provider_spec.rb +++ b/spec/lib/auth/default_current_user_provider_spec.rb @@ -601,11 +601,9 @@ RSpec.describe Auth::DefaultCurrentUserProvider do end describe "user api" do - fab! :user do - Fabricate(:user) - end + fab!(:user) - let :api_key do + let(:api_key) do UserApiKey.create!( application_name: "my app", client_id: "1234", diff --git a/spec/lib/composer_messages_finder_spec.rb b/spec/lib/composer_messages_finder_spec.rb index b76354754b4..62b3776fd42 100644 --- a/spec/lib/composer_messages_finder_spec.rb +++ b/spec/lib/composer_messages_finder_spec.rb @@ -445,7 +445,8 @@ RSpec.describe ComposerMessagesFinder do end context "when user can't send private messages" do - fab!(:group) { Fabricate(:group) } + fab!(:group) + before { SiteSetting.personal_message_enabled_groups = group.id } it "does not show the message" do diff --git a/spec/mailers/rejection_mailer_spec.rb b/spec/mailers/rejection_mailer_spec.rb index 841766df8cd..8c5cb2994b4 100644 --- a/spec/mailers/rejection_mailer_spec.rb +++ b/spec/mailers/rejection_mailer_spec.rb @@ -3,7 +3,7 @@ RSpec.describe RejectionMailer do describe "send_rejection" do context "when sending rejection email" do - fab!(:user) { Fabricate(:user) } + fab!(:user) let(:template_args) do { former_title: "Mail Subject", destination: user.email, site_name: SiteSetting.title } end diff --git a/spec/models/theme_spec.rb b/spec/models/theme_spec.rb index fe1babece39..f892730ede1 100644 --- a/spec/models/theme_spec.rb +++ b/spec/models/theme_spec.rb @@ -1,20 +1,19 @@ # frozen_string_literal: true RSpec.describe Theme do - after { Theme.clear_cache! } - - before { ThemeJavascriptCompiler.disable_terser! } - after { ThemeJavascriptCompiler.enable_terser! } - - fab! :user do - Fabricate(:user) - end + fab!(:user) + fab!(:theme) { Fabricate(:theme, user: user) } let(:guardian) { Guardian.new(user) } - - fab!(:theme) { Fabricate(:theme, user: user) } let(:child) { Fabricate(:theme, user: user, component: true) } + before { ThemeJavascriptCompiler.disable_terser! } + + after do + Theme.clear_cache! + ThemeJavascriptCompiler.enable_terser! + end + it "can properly clean up color schemes" do scheme = ColorScheme.create!(theme_id: theme.id, name: "test") scheme2 = ColorScheme.create!(theme_id: theme.id, name: "test2") diff --git a/spec/models/user_search_spec.rb b/spec/models/user_search_spec.rb index eda5e5e5211..073852d49ee 100644 --- a/spec/models/user_search_spec.rb +++ b/spec/models/user_search_spec.rb @@ -4,7 +4,7 @@ RSpec.describe UserSearch do before_all { SearchIndexer.enable } # Enable for prefabrication before { SearchIndexer.enable } # Enable for each test - fab!(:topic) { Fabricate :topic } + fab!(:topic) fab!(:topic2) { Fabricate :topic } fab!(:topic3) { Fabricate :topic } fab!(:topic4) { Fabricate :topic } @@ -29,7 +29,7 @@ RSpec.describe UserSearch do fab!(:inactive) { Fabricate :user, username: "Ghost", active: false } fab!(:admin) { Fabricate :admin, username: "theadmin" } fab!(:moderator) { Fabricate :moderator, username: "themod" } - fab!(:staged) { Fabricate :staged } + fab!(:staged) def search_for(*args) # mapping "username" so it's easier to debug diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 803f3770c41..202cd7d585b 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -4903,7 +4903,7 @@ RSpec.describe UsersController do end describe "#search_users" do - fab!(:topic) { Fabricate :topic } + fab!(:topic) let(:user) { Fabricate :user, username: "joecabot", name: "Lawrence Tierney" } let(:post1) { Fabricate(:post, user: user, topic: topic) } let(:staged_user) { Fabricate(:user, staged: true) } diff --git a/spec/serializers/basic_user_serializer_spec.rb b/spec/serializers/basic_user_serializer_spec.rb index 250319eefb0..aeb0564cae0 100644 --- a/spec/serializers/basic_user_serializer_spec.rb +++ b/spec/serializers/basic_user_serializer_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe BasicUserSerializer do - fab!(:user) { Fabricate(:user) } + fab!(:user) let(:serializer) { BasicUserSerializer.new(user, scope: Guardian.new(user), root: false) } describe "#as_json" do @@ -30,7 +30,7 @@ RSpec.describe BasicUserSerializer do end describe "#status" do - fab!(:user_status) { Fabricate(:user_status) } + fab!(:user_status) before { user.user_status = user_status } diff --git a/spec/serializers/concerns/user_status_mixin_spec.rb b/spec/serializers/concerns/user_status_mixin_spec.rb index d3dd2e636b2..d31926d416f 100644 --- a/spec/serializers/concerns/user_status_mixin_spec.rb +++ b/spec/serializers/concerns/user_status_mixin_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe UserStatusMixin do - fab!(:user_status) { Fabricate(:user_status) } + fab!(:user_status) fab!(:user) { Fabricate(:user, user_status: user_status) } class DummySerializer < ApplicationSerializer diff --git a/spec/serializers/found_user_serializer_spec.rb b/spec/serializers/found_user_serializer_spec.rb index 95c47e831e2..655c9bd1668 100644 --- a/spec/serializers/found_user_serializer_spec.rb +++ b/spec/serializers/found_user_serializer_spec.rb @@ -28,7 +28,7 @@ RSpec.describe FoundUserSerializer do end describe "#status" do - fab!(:user_status) { Fabricate(:user_status) } + fab!(:user_status) before { user.user_status = user_status } diff --git a/spec/serializers/post_serializer_spec.rb b/spec/serializers/post_serializer_spec.rb index 30aabec9c96..f172bc7cab6 100644 --- a/spec/serializers/post_serializer_spec.rb +++ b/spec/serializers/post_serializer_spec.rb @@ -364,7 +364,7 @@ RSpec.describe PostSerializer do context "with mentions" do fab!(:user_status) - fab!(:user) { Fabricate(:user) } + fab!(:user) fab!(:user1) { Fabricate(:user, user_status: user_status) } fab!(:post) { Fabricate(:post, user: user, raw: "Hey @#{user1.username}") } let(:serializer) { described_class.new(post, scope: Guardian.new(user), root: false) } diff --git a/spec/system/group_activity_spec.rb b/spec/system/group_activity_spec.rb index 94be92ecb67..dde427d4f52 100644 --- a/spec/system/group_activity_spec.rb +++ b/spec/system/group_activity_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true describe "Group activity", type: :system do - fab!(:user) { Fabricate(:user) } - fab!(:group) { Fabricate(:group) } + fab!(:user) + fab!(:group) context "when on the posts activity page" do let(:posts_page) { PageObjects::Pages::GroupActivityPosts.new }