A platform for community discussion. Free, open, simple.
FIX: should not raise error when both group & site tag preferences are same. (#27704)
Vinoth Kannand1ea598fa23e
diff --git a/app/models/user.rb b/app/models/user.rbindex 5d0e8ba251b..2adc970f4e0 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -2047,7 +2047,7 @@ class User < ActiveRecord::Baseendend- TagUser.insert_all!(values) if values.present?+ TagUser.insert_all(values) if values.present?enddef self.purge_unactivateddiff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rbindex 8578002f70d..3c81e6261a4 100644--- a/spec/models/invite_spec.rb+++ b/spec/models/invite_spec.rb@@ -326,14 +326,25 @@ RSpec.describe Invite doendcontext "when inviting to groups" do- it "add the user to the correct groups" do- group = Fabricate(:group)+ fab!(:group)++ before dogroup.add_owner(invite.invited_by)invite.invited_groups.create!(group_id: group.id)+ end+ it "add the user to the correct groups" douser = invite.redeemexpect(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+ endendcontext "when inviting to a topic" do