File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
controllers/simple_discussion
views/simple_discussion/forum_posts Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,13 @@ def is_moderator_or_owner?(object)
1212 end
1313 helper_method :is_moderator_or_owner?
1414
15+ def is_owner? ( object )
16+ object . user == current_user
17+ end
18+ helper_method :is_owner?
19+
1520 def is_moderator?
16- current_user & .moderator?
21+ current_user . respond_to? ( :moderator? ) && current_user . moderator?
1722 end
1823 helper_method :is_moderator?
1924
Original file line number Diff line number Diff line change 3737 < div class ="user-avatar mr-2 " > < img src ="<%= gravatar_url_for ( forum_post . user . email , size : 30 ) %> " alt ="avatar of user " > </ div >
3838 < div class ="details d-flex flex-column justify-content-between ">
3939 < p class ="title "> <%= forum_post . user . name %> <%= forum_user_badge ( forum_post . user ) %>
40- <% if is_moderator_or_owner ?( forum_post ) %> (You)<% end %>
40+ <% if is_owner ?( forum_post ) %> (You)<% end %>
4141 </ p >
4242 < p class ="subtitle "> <%= t ( 'on' ) %> <%= forum_post . created_at . strftime ( "%b %d, %Y" ) %> </ p >
4343 </ div >
You can’t perform that action at this time.
0 commit comments