mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 04:05:35 +08:00
FIX: should not raise error when both group & site tag preferences are same. (#27704)
When tag preference in group and site settings are both used with same default notification level it will break new users signups because it tries to create duplicate records in the tag_users table which can’t happen because we have a unique index set.
This commit is contained in:
parent
55bf0e21fb
commit
d1ea598fa2
@ -2047,7 +2047,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
TagUser.insert_all!(values) if values.present?
|
||||
TagUser.insert_all(values) if values.present?
|
||||
end
|
||||
|
||||
def self.purge_unactivated
|
||||
|
@ -326,14 +326,25 @@ RSpec.describe Invite do
|
||||
end
|
||||
|
||||
context "when inviting to groups" do
|
||||
it "add the user to the correct groups" do
|
||||
group = Fabricate(:group)
|
||||
fab!(:group)
|
||||
|
||||
before do
|
||||
group.add_owner(invite.invited_by)
|
||||
invite.invited_groups.create!(group_id: group.id)
|
||||
end
|
||||
|
||||
it "add the user to the correct groups" do
|
||||
user = invite.redeem
|
||||
expect(user.groups).to contain_exactly(group)
|
||||
end
|
||||
it "should not raise error when both group & site tag preferences same" do
|
||||
tag = Fabricate(:tag)
|
||||
group.tracking_tags = [tag.name]
|
||||
group.save!
|
||||
SiteSetting.default_tags_tracking = tag.name
|
||||
|
||||
expect { invite.redeem }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context "when inviting to a topic" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user