]> git.openstreetmap.org Git - rails.git/blob - app/helpers/note_helper.rb
Only the sender of a message should be able to mark it as read/unread
[rails.git] / app / helpers / note_helper.rb
1 module NoteHelper
2   include ActionView::Helpers::TranslationHelper
3
4   def note_event(event, at, by)
5     if by.nil?
6       t("notes.show.event_#{event}_by_anonymous_html",
7         :time_ago => friendly_date_ago(at))
8     else
9       t("notes.show.event_#{event}_by_html",
10         :time_ago => friendly_date_ago(at),
11         :user => note_author(by))
12     end
13   end
14
15   def note_author(author, link_options = {})
16     if author.nil?
17       ""
18     elsif author.status == "deleted"
19       t("users.no_such_user.deleted")
20     else
21       link_to h(author.display_name), link_options.merge(:controller => "/users", :action => "show", :display_name => author.display_name)
22     end
23   end
24 end