A platform for community discussion. Free, open, simple.
FEATURE: Show first notification tip to all users (#22258)
Bianca Nenciud888a8b69230
diff --git a/app/models/user.rb b/app/models/user.rbindex 1810f3f024d..8e0e0dbc4eb 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -808,20 +808,8 @@ class User < ActiveRecord::BaseMessageBus.publish("/reviewable_counts/#{self.id}", data, user_ids: [self.id])end- TRACK_FIRST_NOTIFICATION_READ_DURATION = 1.week.to_i-def read_first_notification?- if (- trust_level > TrustLevel[1] ||- (- first_seen_at.present? &&- first_seen_at < TRACK_FIRST_NOTIFICATION_READ_DURATION.seconds.ago- ) || user_option.skip_new_user_tips- )- return true- end-- self.seen_notification_id == 0 ? false : true+ self.seen_notification_id != 0 || user_option.skip_new_user_tipsenddef publish_notifications_statediff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rbindex 1c5ecc381d9..de58c411914 100644--- a/spec/models/user_spec.rb+++ b/spec/models/user_spec.rb@@ -2208,22 +2208,6 @@ RSpec.describe User doendend- describe "when user is trust level 2" do- it "should return the right value" do- user.update!(trust_level: TrustLevel[2])-- expect(user.read_first_notification?).to eq(true)- end- end-- describe "when user is an old user" do- it "should return the right value" do- user.update!(first_seen_at: 1.year.ago)-- expect(user.read_first_notification?).to eq(true)- end- end-describe "when user skipped new user tips" doit "should return the right value" douser.user_option.update!(skip_new_user_tips: true)