Skip to content

Commit 3658dd5

Browse files
authored
Merge branch 'master' into markdown-syntax-extensions
2 parents ff24eb5 + 734f8a4 commit 3658dd5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/controllers/simple_discussion/application_controller.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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

app/views/simple_discussion/forum_posts/_forum_post.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
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') %> &nbsp;<%= forum_post.created_at.strftime("%b %d, %Y") %></p>
4343
</div>

0 commit comments

Comments
 (0)