diff --git a/plugins/community_hub/lib/community_hub_plugin/hub.rb b/plugins/community_hub/lib/community_hub_plugin/hub.rb index 42b7731..27264fc 100644 --- a/plugins/community_hub/lib/community_hub_plugin/hub.rb +++ b/plugins/community_hub/lib/community_hub_plugin/hub.rb @@ -58,6 +58,6 @@ class CommunityHubPlugin::Hub < Folder end def mediator?(user) - self.author.id == user.id || self.mediators.include?(user.id) ? true : false + self.allow_edit?(user) || self.mediators.include?(user.id) end end diff --git a/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb b/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb index 1764aea..8681abb 100644 --- a/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb +++ b/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb @@ -1,11 +1,11 @@ module CommunityHubPlugin::HubHelper def mediator?(hub) - logged_in? && (hub.author.id == user.id || hub.mediators.include?(user.id)) ? true : false + logged_in? && (user && hub.allow_edit?(user) || hub.mediators.include?(user.id)) end - def promoted?(hub, user_id) - logged_in? && (hub.author.id == user_id || hub.mediators.include?(user_id)) ? true : false + def promoted?(hub, person) + logged_in? && (hub.allow_edit?(person) || hub.mediators.include?(person.id)) end def pinned_message?(hub, message_id) diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb index 0bd451e..9c807ea 100644 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb +++ b/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb @@ -24,7 +24,7 @@ <% if mediation.source != 'twitter' && mediation.source != 'facebook' %>
  • - <% if !promoted?(hub, mediation.created_by.id) %> + <% if !promoted?(hub, mediation.created_by) %> " /> -- libgit2 0.21.2