diff --git a/app/services/badge_granter.rb b/app/services/badge_granter.rb index 1e1059b791e..ad9d3105773 100644 --- a/app/services/badge_granter.rb +++ b/app/services/badge_granter.rb @@ -45,7 +45,7 @@ class BadgeGranter def grant return if @granted_by && !Guardian.new(@granted_by).can_grant_badges?(@user) return unless @badge.enabled? - return if @badge.badge_grouping_id == BadgeGrouping::GettingStarted && @user.user_option.skip_new_user_tips + return if @badge.badge_grouping_id == BadgeGrouping::GettingStarted && @badge.id != Badge::NewUserOfTheMonth && @user.user_option.skip_new_user_tips find_by = { badge_id: @badge.id, user_id: @user.id } diff --git a/spec/services/badge_granter_spec.rb b/spec/services/badge_granter_spec.rb index e683c81b10b..310a9932611 100644 --- a/spec/services/badge_granter_spec.rb +++ b/spec/services/badge_granter_spec.rb @@ -225,6 +225,15 @@ describe BadgeGranter do expect(user_badge).to eq(nil) end + it "grants the New User of the Month badge when user skipped new user tips" do + freeze_time + user.user_option.update!(skip_new_user_tips: true) + badge = Badge.find(Badge::NewUserOfTheMonth) + + user_badge = BadgeGranter.grant(badge, user, created_at: 1.year.ago) + expect(user_badge).to be_present + end + it 'grants multiple badges' do badge = Fabricate(:badge, multiple_grant: true) user_badge = BadgeGranter.grant(badge, user)