diff --git a/app/controllers/simple_discussion/application_controller.rb b/app/controllers/simple_discussion/application_controller.rb index 7ed17df..4d1a8cc 100644 --- a/app/controllers/simple_discussion/application_controller.rb +++ b/app/controllers/simple_discussion/application_controller.rb @@ -12,8 +12,13 @@ def is_moderator_or_owner?(object) end helper_method :is_moderator_or_owner? + def is_owner?(object) + object.user == current_user + end + helper_method :is_owner? + def is_moderator? - current_user&.moderator? + current_user.respond_to?(:moderator?) && current_user.moderator? end helper_method :is_moderator? diff --git a/app/views/simple_discussion/forum_posts/_forum_post.html.erb b/app/views/simple_discussion/forum_posts/_forum_post.html.erb index fe17edf..3655b67 100644 --- a/app/views/simple_discussion/forum_posts/_forum_post.html.erb +++ b/app/views/simple_discussion/forum_posts/_forum_post.html.erb @@ -37,7 +37,7 @@
<%= forum_post.user.name %> <%= forum_user_badge(forum_post.user) %> - <% if is_moderator_or_owner?(forum_post) %>(You)<% end %> + <% if is_owner?(forum_post) %>(You)<% end %>
<%= t('on') %> <%= forum_post.created_at.strftime("%b %d, %Y") %>