Commit 22f50988ec480a841dc80f423a11e3f5f8029ae7

Authored by Francisco Júnior
2 parents a9370dcb 570e7432

Merge branch 'hub-fixes' into stable

plugins/community_hub/lib/community_hub_plugin/hub.rb
@@ -58,6 +58,6 @@ class CommunityHubPlugin::Hub < Folder @@ -58,6 +58,6 @@ class CommunityHubPlugin::Hub < Folder
58 end 58 end
59 59
60 def mediator?(user) 60 def mediator?(user)
61 - self.author.id == user.id || self.mediators.include?(user.id) ? true : false 61 + self.allow_edit?(user) || self.mediators.include?(user.id)
62 end 62 end
63 end 63 end
plugins/community_hub/lib/community_hub_plugin/hub_helper.rb
1 module CommunityHubPlugin::HubHelper 1 module CommunityHubPlugin::HubHelper
2 2
3 def mediator?(hub) 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 end 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 end 9 end
10 10
11 def pinned_message?(hub, message_id) 11 def pinned_message?(hub, message_id)
plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <% if mediation.source != 'twitter' && mediation.source != 'facebook' %> 24 <% if mediation.source != 'twitter' && mediation.source != 'facebook' %>
25 25
26 <li class="promote"> 26 <li class="promote">
27 - <% if !promoted?(hub, mediation.created_by.id) %> 27 + <% if !promoted?(hub, mediation.created_by) %>
28 <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.id %>,<%= mediation.created_by.id %>); return false;"> 28 <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.id %>,<%= mediation.created_by.id %>); return false;">
29 <img class="not-promoted" src="/plugins/community_hub/icons/hub-not-promote-icon.png" title="<%= _("User not promoted") %>" /> 29 <img class="not-promoted" src="/plugins/community_hub/icons/hub-not-promote-icon.png" title="<%= _("User not promoted") %>" />
30 </a> 30 </a>