FIX: staged users should not watch/track/mute categories by default
This commit is contained in:
parent
ad15c4ac78
commit
470da6205c
|
@ -952,6 +952,8 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_default_categories_preferences
|
def set_default_categories_preferences
|
||||||
|
return if self.staged?
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
|
|
||||||
%w{watching tracking muted}.each do |s|
|
%w{watching tracking muted}.each do |s|
|
||||||
|
|
|
@ -42,7 +42,6 @@ class UserOption < ActiveRecord::Base
|
||||||
|
|
||||||
self.like_notification_frequency = SiteSetting.default_other_like_notification_frequency
|
self.like_notification_frequency = SiteSetting.default_other_like_notification_frequency
|
||||||
|
|
||||||
|
|
||||||
if SiteSetting.default_email_digest_frequency.to_i <= 0
|
if SiteSetting.default_email_digest_frequency.to_i <= 0
|
||||||
self.email_digests = false
|
self.email_digests = false
|
||||||
else
|
else
|
||||||
|
|
|
@ -1235,6 +1235,13 @@ describe User do
|
||||||
expect(CategoryUser.lookup(user, :tracking).pluck(:category_id)).to eq([2])
|
expect(CategoryUser.lookup(user, :tracking).pluck(:category_id)).to eq([2])
|
||||||
expect(CategoryUser.lookup(user, :muted).pluck(:category_id)).to eq([3])
|
expect(CategoryUser.lookup(user, :muted).pluck(:category_id)).to eq([3])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not set category preferences for staged users" do
|
||||||
|
user = Fabricate(:user, staged: true)
|
||||||
|
expect(CategoryUser.lookup(user, :watching).pluck(:category_id)).to eq([])
|
||||||
|
expect(CategoryUser.lookup(user, :tracking).pluck(:category_id)).to eq([])
|
||||||
|
expect(CategoryUser.lookup(user, :muted).pluck(:category_id)).to eq([])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context UserOption do
|
context UserOption do
|
||||||
|
|
Loading…
Reference in New Issue