Include conditional for adding tag mods to connect channel (#1366)

* fix slug typo

* fix specs

* use blank? instead of nil?
This commit is contained in:
Jess Lee 2018-12-19 15:44:36 -05:00 committed by Ben Halpern
parent c2a85540f0
commit 1586d9fd7d
2 changed files with 3 additions and 1 deletions

View file

@ -4,7 +4,9 @@ module AssignTagModerator
user = User.find(user_id)
tag = Tag.find_by(name: tag_names[index])
user.add_role(:tag_moderator, tag)
ChatChannel.find_by(slug: "tag-moderators").add_users(user)
if user.chat_channels.find_by(slug: "tag-moderators").blank?
ChatChannel.find_by(slug: "tag-moderators").add_users(user)
end
NotifyMailer.tag_moderator_confirmation_email(user, tag.name).deliver unless tag.name == "go"
end
end

0
environment Normal file
View file