Commit e244874f83eed21c9086099ccb7f09d9a6a38f91

Authored by Simiao Carvalho
1 parent e6fcb8a8

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 60 :requestor => community_rating.person,
61 61 :source => community_rating.community,
62 62 :community_rating => community_rating,
63   - :environment => environment
  63 + :organization => community_rating.community
64 64 )
65 65 )
66 66 end
... ... @@ -73,4 +73,8 @@ class CommunitiesRatingsPluginProfileController &lt; ProfileController
73 73 session[:notice] = _("Sorry, there were problems rating this profile.")
74 74 end
75 75 end
  76 +
  77 + def permission
  78 + :manage_memberships
  79 + end
76 80 end
... ...
plugins/communities_ratings/db/migrate/20150710171028_add_communities_rating_config_to_environment.rb
... ... @@ -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 3  
4 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 7 belongs_to :source, :class_name => 'Community', :foreign_key => :source_id
8 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 13 DATA_FIELDS = ['body']
14 14 DATA_FIELDS.each do |field|
... ... @@ -28,7 +28,7 @@ class CreateCommunityRatingComment &lt; Task
28 28 end
29 29  
30 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 32 {:requestor => self.requestor.name, :source => self.source.name, :body => self.body }
33 33  
34 34 {:message => message}
... ... @@ -38,6 +38,10 @@ class CreateCommunityRatingComment &lt; Task
38 38 true
39 39 end
40 40  
  41 + def icon
  42 + {:type => :profile_image, :profile => requestor, :url => requestor.url}
  43 + end
  44 +
41 45 # tells if this request was rejected
42 46 def rejected?
43 47 self.status == Task::Status::CANCELLED
... ... @@ -91,7 +95,7 @@ class CreateCommunityRatingComment &lt; Task
91 95 identifier = self.source.identifier
92 96 # The use of url_for doesn't allow the /social within the Public Software
93 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 99 end
96 100  
97 101 end
... ...