Commit 22f50988ec480a841dc80f423a11e3f5f8029ae7
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'hub-fixes' into stable
Showing
3 changed files
with
5 additions
and
5 deletions
Show diff stats
plugins/community_hub/lib/community_hub_plugin/hub.rb
plugins/community_hub/lib/community_hub_plugin/hub_helper.rb
1 | 1 | module CommunityHubPlugin::HubHelper |
2 | 2 | |
3 | 3 | def mediator?(hub) |
4 | - logged_in? && (hub.author.id == user.id || hub.mediators.include?(user.id)) ? true : false | |
4 | + logged_in? && (user && hub.allow_edit?(user) || hub.mediators.include?(user.id)) | |
5 | 5 | end |
6 | 6 | |
7 | - def promoted?(hub, user_id) | |
8 | - logged_in? && (hub.author.id == user_id || hub.mediators.include?(user_id)) ? true : false | |
7 | + def promoted?(hub, person) | |
8 | + logged_in? && (hub.allow_edit?(person) || hub.mediators.include?(person.id)) | |
9 | 9 | end |
10 | 10 | |
11 | 11 | def pinned_message?(hub, message_id) | ... | ... |
plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | <% if mediation.source != 'twitter' && mediation.source != 'facebook' %> |
25 | 25 | |
26 | 26 | <li class="promote"> |
27 | - <% if !promoted?(hub, mediation.created_by.id) %> | |
27 | + <% if !promoted?(hub, mediation.created_by) %> | |
28 | 28 | <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.id %>,<%= mediation.created_by.id %>); return false;"> |
29 | 29 | <img class="not-promoted" src="/plugins/community_hub/icons/hub-not-promote-icon.png" title="<%= _("User not promoted") %>" /> |
30 | 30 | </a> | ... | ... |