Skip to content

Commit

Permalink
barnstar tag commenting (publiclab#2223)
Browse files Browse the repository at this point in the history
  • Loading branch information
grvsachdeva authored and jywarren committed Feb 5, 2018
1 parent b247951 commit f0988db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ def create
@output[:errors] << I18n.t('tag_controller.tag_already_exists')
elsif node.can_tag(tagname, current_user) === true || current_user.role == 'admin' # || current_user.role == "moderator"
saved, tag = node.add_tag(tagname.strip, current_user)
if tagname.split(':')[0] == "barnstar"
CommentMailer.notify_barnstar(current_user, node)
barnstar_info_link = '<a href="//' + request.host.to_s + '/wiki/barnstars">barnstar</a>'
node.add_comment(subject: 'barnstar',
uid: current_user.uid,
body: "@#{current_user.username} awards a #{barnstar_info_link} to #{node.drupal_user.name} for their awesome contribution!")

end

if saved
@tags << tag
@output[:saved] << [tag.name, tag.id]
Expand Down

0 comments on commit f0988db

Please sign in to comment.