Skip to content

Commit

Permalink
Include conditional for adding tag mods to connect channel (forem#1366)
Browse files Browse the repository at this point in the history
* fix slug typo

* fix specs

* use blank? instead of nil?
  • Loading branch information
jessleenyc authored and benhalpern committed Dec 19, 2018
1 parent c2a8554 commit 1586d9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/labor/assign_tag_moderator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ def self.add_tag_moderators(user_ids, tag_names)
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
Expand Down
Empty file added environment
Empty file.

0 comments on commit 1586d9f

Please sign in to comment.