log a moderation when hats are granted, since we're open and all that
This commit is contained in:
parent
31d4e97858
commit
ddb9215aa0
|
@ -6,6 +6,8 @@ class Hat < ActiveRecord::Base
|
|||
validates :user, :presence => true
|
||||
validates :granted_by_user, :presence => true
|
||||
|
||||
after_create :log_moderation
|
||||
|
||||
def to_html_label
|
||||
h = "<span class=\"hat\" title=\"Granted by " <<
|
||||
"#{self.granted_by_user.username} on " <<
|
||||
|
@ -26,4 +28,14 @@ class Hat < ActiveRecord::Base
|
|||
|
||||
h.html_safe
|
||||
end
|
||||
|
||||
def log_moderation
|
||||
m = Moderation.new
|
||||
m.created_at = self.created_at
|
||||
m.user_id = self.user_id
|
||||
m.moderator_user_id = self.granted_by_user_id
|
||||
m.action = "Granted hat \"#{self.hat}\"" + (self.link.present? ?
|
||||
" (#{self.link})" : "")
|
||||
m.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<tr>
|
||||
<th width="15%">Date/Time</th>
|
||||
<th width="10%">Moderator</th>
|
||||
<th width="75%">Story/Comment/User, Changes, Reason</th>
|
||||
<th width="75%">Story/Comment/User, Action, Reason</th>
|
||||
</tr>
|
||||
<% bit = 0 %>
|
||||
<% @moderations.each do |mod| %>
|
||||
|
@ -21,8 +21,13 @@
|
|||
<% elsif mod.comment %>
|
||||
<a href="<%= mod.comment.url %>">Comment on <%=
|
||||
mod.comment.story.title %></a>
|
||||
<% elsif mod.user %>
|
||||
User <%= mod.user.try(:username) %>
|
||||
<% elsif mod.user_id %>
|
||||
<% if mod.user %>
|
||||
<a href="/u/<%= mod.user.username %>">User
|
||||
<%= mod.user.username %></a>
|
||||
<% else %>
|
||||
User <%= mod.user_id %> (Deleted)
|
||||
<% end %>
|
||||
<% end %></td>
|
||||
</tr>
|
||||
<tr class="row<%= bit %> <%= mod.reason.present?? "nobottom" : "" %>">
|
||||
|
|
Loading…
Reference in a new issue