Commit 077742183c0820cb37d40918938e86d9b5810e9b

Authored by Simiao Carvalho
Committed by Fabio Teixeira
1 parent b33ee222

Moderation is know for the organization admin

Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Signed-off-by: Simião Carvalho <simiaosimis@gmail.com>
plugins/communities_ratings/controllers/communities_ratings_plugin_profile_controller.rb
@@ -60,7 +60,7 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController @@ -60,7 +60,7 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController
60 :requestor => community_rating.person, 60 :requestor => community_rating.person,
61 :source => community_rating.community, 61 :source => community_rating.community,
62 :community_rating => community_rating, 62 :community_rating => community_rating,
63 - :environment => environment 63 + :organization => community_rating.community
64 ) 64 )
65 ) 65 )
66 end 66 end
@@ -73,4 +73,8 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController @@ -73,4 +73,8 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController
73 session[:notice] = _("Sorry, there were problems rating this profile.") 73 session[:notice] = _("Sorry, there were problems rating this profile.")
74 end 74 end
75 end 75 end
  76 +
  77 + def permission
  78 + :manage_memberships
  79 + end
76 end 80 end
plugins/communities_ratings/db/migrate/20150710171028_add_communities_rating_config_to_environment.rb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -class AddCommunitiesRatingConfigToEnvironment < ActiveRecord::Migration  
2 - def change  
3 - add_column :environments, :communities_ratings_cooldown, :integer, :default => 24  
4 - add_column :environments, :communities_ratings_default_rating, :integer, :default => 1  
5 - add_column :environments, :communities_ratings_order, :string, :default => "most recent"  
6 - add_column :environments, :communities_ratings_per_page, :integer, :default => 10  
7 - add_column :environments, :communities_ratings_vote_once, :boolean, :default => false  
8 - end  
9 -end  
plugins/communities_ratings/lib/create_community_rating_comment.rb
@@ -3,12 +3,12 @@ class CreateCommunityRatingComment &lt; Task @@ -3,12 +3,12 @@ class CreateCommunityRatingComment &lt; Task
3 3
4 validates_presence_of :requestor_id, :community_rating, :target_id 4 validates_presence_of :requestor_id, :community_rating, :target_id
5 5
6 - attr_accessible :community_rating, :source, :body, :requestor, :reject_explanation, :environment 6 + attr_accessible :community_rating, :source, :body, :requestor, :reject_explanation, :organization
7 belongs_to :source, :class_name => 'Community', :foreign_key => :source_id 7 belongs_to :source, :class_name => 'Community', :foreign_key => :source_id
8 belongs_to :community_rating 8 belongs_to :community_rating
9 9
10 - alias :environment :target  
11 - alias :environment= :target= 10 + alias :organization :target
  11 + alias :organization= :target=
12 12
13 DATA_FIELDS = ['body'] 13 DATA_FIELDS = ['body']
14 DATA_FIELDS.each do |field| 14 DATA_FIELDS.each do |field|
@@ -28,7 +28,7 @@ class CreateCommunityRatingComment &lt; Task @@ -28,7 +28,7 @@ class CreateCommunityRatingComment &lt; Task
28 end 28 end
29 29
30 def information 30 def information
31 - message = _("%{requestor} wants to create a comment in the \"%{source}\" community. <div class=\"comment\"> Comment: <br> \"%{body}\"</div>") % 31 + message = _("<div class=\"comment\">%{requestor} wants to create a comment in the \"%{source}\" community.<br> Comment: <br> \"%{body}\"</div>") %
32 {:requestor => self.requestor.name, :source => self.source.name, :body => self.body } 32 {:requestor => self.requestor.name, :source => self.source.name, :body => self.body }
33 33
34 {:message => message} 34 {:message => message}
@@ -38,6 +38,10 @@ class CreateCommunityRatingComment &lt; Task @@ -38,6 +38,10 @@ class CreateCommunityRatingComment &lt; Task
38 true 38 true
39 end 39 end
40 40
  41 + def icon
  42 + {:type => :profile_image, :profile => requestor, :url => requestor.url}
  43 + end
  44 +
41 # tells if this request was rejected 45 # tells if this request was rejected
42 def rejected? 46 def rejected?
43 self.status == Task::Status::CANCELLED 47 self.status == Task::Status::CANCELLED
@@ -91,7 +95,7 @@ class CreateCommunityRatingComment &lt; Task @@ -91,7 +95,7 @@ class CreateCommunityRatingComment &lt; Task
91 identifier = self.source.identifier 95 identifier = self.source.identifier
92 # The use of url_for doesn't allow the /social within the Public Software 96 # The use of url_for doesn't allow the /social within the Public Software
93 # portal. That's why the url is mounted so 'hard coded' 97 # portal. That's why the url is mounted so 'hard coded'
94 - url = "#{environment.top_url}/profile/#{identifier}" 98 + url = "#{organization.top_url}/profile/#{identifier}"
95 end 99 end
96 100
97 end 101 end