Commit 974bc04868ba4eee5a8ea05e5ec1f155c7907a60

Authored by Daniela Feitosa
2 parents 11762ec8 a4c344d9

Merge branch 'stable'

Conflicts:
	app/views/shared/block.rhtml
	debian/changelog
	debian/control
	script/production
app/controllers/public/profile_controller.rb
@@ -211,7 +211,8 @@ class ProfileController < PublicController @@ -211,7 +211,8 @@ class ProfileController < PublicController
211 211
212 def remove_activity 212 def remove_activity
213 begin 213 begin
214 - activity = current_person.tracked_actions.find(params[:activity_id]) 214 + raise if !can_edit_profile
  215 + activity = ActionTracker::Record.find(params[:activity_id])
215 activity.destroy 216 activity.destroy
216 render :text => _('Activity successfully removed.') 217 render :text => _('Activity successfully removed.')
217 rescue 218 rescue
@@ -219,6 +220,17 @@ class ProfileController < PublicController @@ -219,6 +220,17 @@ class ProfileController < PublicController
219 end 220 end
220 end 221 end
221 222
  223 + def remove_notification
  224 + begin
  225 + raise if !can_edit_profile
  226 + notification = ActionTrackerNotification.find(:first, :conditions => {:profile_id => profile.id, :action_tracker_id => params[:activity_id]})
  227 + notification.destroy
  228 + render :text => _('Notification successfully removed.')
  229 + rescue
  230 + render :text => _('You could not remove this notification.')
  231 + end
  232 + end
  233 +
222 def profile_info 234 def profile_info
223 begin 235 begin
224 @block = profile.blocks.find(params[:block_id]) 236 @block = profile.blocks.find(params[:block_id])
@@ -320,4 +332,8 @@ class ProfileController < PublicController @@ -320,4 +332,8 @@ class ProfileController < PublicController
320 20 332 20
321 end 333 end
322 334
  335 + def can_edit_profile
  336 + @can_edit_profile ||= user && user.has_permission?('edit_profile', profile)
  337 + end
  338 + helper_method :can_edit_profile
323 end 339 end
app/helpers/boxes_helper.rb
@@ -81,8 +81,8 @@ module BoxesHelper @@ -81,8 +81,8 @@ module BoxesHelper
81 box_decorator == DontMoveBlocks 81 box_decorator == DontMoveBlocks
82 end 82 end
83 83
84 - def display_block_content(block, main_content = nil)  
85 - content = block.main? ? wrap_main_content(main_content) : block.content 84 + def display_block_content(block, person, main_content = nil)
  85 + content = block.main? ? wrap_main_content(main_content) : block.content({:person => person})
86 result = extract_block_content(content) 86 result = extract_block_content(content)
87 footer_content = extract_block_content(block.footer) 87 footer_content = extract_block_content(block.footer)
88 unless footer_content.blank? 88 unless footer_content.blank?
app/models/article_block.rb
@@ -8,7 +8,7 @@ class ArticleBlock < Block @@ -8,7 +8,7 @@ class ArticleBlock < Block
8 _('This block displays one of your articles. You can edit the block to select which one of your articles is going to be displayed in the block.') 8 _('This block displays one of your articles. You can edit the block to select which one of your articles is going to be displayed in the block.')
9 end 9 end
10 10
11 - def content 11 + def content(args={})
12 block = self 12 block = self
13 lambda do 13 lambda do
14 block_title(block.title) + 14 block_title(block.title) +
app/models/block.rb
@@ -81,7 +81,7 @@ class Block < ActiveRecord::Base @@ -81,7 +81,7 @@ class Block < ActiveRecord::Base
81 # The method can also return <tt>nil</tt>, which means "no content". 81 # The method can also return <tt>nil</tt>, which means "no content".
82 # 82 #
83 # See BoxesHelper#extract_block_content for implementation details. 83 # See BoxesHelper#extract_block_content for implementation details.
84 - def content 84 + def content(args={})
85 "This is block number %d" % self.id 85 "This is block number %d" % self.id
86 end 86 end
87 87
app/models/blog_archives_block.rb
@@ -20,11 +20,15 @@ class BlogArchivesBlock &lt; Block @@ -20,11 +20,15 @@ class BlogArchivesBlock &lt; Block
20 blog_id && owner.blogs.exists?(blog_id) ? owner.blogs.find(blog_id) : owner.blog 20 blog_id && owner.blogs.exists?(blog_id) ? owner.blogs.find(blog_id) : owner.blog
21 end 21 end
22 22
23 - def content 23 + def visible_posts(person)
  24 + blog.posts.native_translations.select {|post| post.display_to?(person)}
  25 + end
  26 +
  27 + def content(args={})
24 owner_blog = self.blog 28 owner_blog = self.blog
25 return nil unless owner_blog 29 return nil unless owner_blog
26 results = '' 30 results = ''
27 - owner_blog.posts.native_translations.group_by {|i| i.published_at.year }.sort_by { |year,count| -year }.each do |year, results_by_year| 31 + visible_posts(args[:person]).group_by {|i| i.published_at.year }.sort_by { |year,count| -year }.each do |year, results_by_year|
28 results << content_tag('li', content_tag('strong', "#{year} (#{results_by_year.size})")) 32 results << content_tag('li', content_tag('strong', "#{year} (#{results_by_year.size})"))
29 results << "<ul class='#{year}-archive'>" 33 results << "<ul class='#{year}-archive'>"
30 results_by_year.group_by{|i| [ ('%02d' % i.published_at.month()), gettext(MONTHS[i.published_at.month() - 1])]}.sort.reverse.each do |month, results_by_month| 34 results_by_year.group_by{|i| [ ('%02d' % i.published_at.month()), gettext(MONTHS[i.published_at.month() - 1])]}.sort.reverse.each do |month, results_by_month|
app/models/categories_block.rb
@@ -28,7 +28,7 @@ class CategoriesBlock &lt; Block @@ -28,7 +28,7 @@ class CategoriesBlock &lt; Block
28 Category.top_level_for(self.owner).from_types(self.category_types) 28 Category.top_level_for(self.owner).from_types(self.category_types)
29 end 29 end
30 30
31 - def content 31 + def content(args={})
32 block = self 32 block = self
33 lambda do 33 lambda do
34 render :file => 'blocks/categories', :locals => { :block => block } 34 render :file => 'blocks/categories', :locals => { :block => block }
app/models/disabled_enterprise_message_block.rb
@@ -12,7 +12,7 @@ class DisabledEnterpriseMessageBlock &lt; Block @@ -12,7 +12,7 @@ class DisabledEnterpriseMessageBlock &lt; Block
12 _('Message') 12 _('Message')
13 end 13 end
14 14
15 - def content 15 + def content(args={})
16 message = self.owner.environment.message_for_disabled_enterprise || '' 16 message = self.owner.environment.message_for_disabled_enterprise || ''
17 lambda do 17 lambda do
18 render :file => 'blocks/disabled_enterprise_message', :locals => {:message => message} 18 render :file => 'blocks/disabled_enterprise_message', :locals => {:message => message}
app/models/environment_statistics_block.rb
@@ -12,7 +12,7 @@ class EnvironmentStatisticsBlock &lt; Block @@ -12,7 +12,7 @@ class EnvironmentStatisticsBlock &lt; Block
12 _('This block presents some statistics about your environment.') 12 _('This block presents some statistics about your environment.')
13 end 13 end
14 14
15 - def content 15 + def content(args={})
16 users = owner.people.visible.count 16 users = owner.people.visible.count
17 enterprises = owner.enterprises.visible.count 17 enterprises = owner.enterprises.visible.count
18 communities = owner.communities.visible.count 18 communities = owner.communities.visible.count
app/models/featured_products_block.rb
@@ -25,7 +25,7 @@ class FeaturedProductsBlock &lt; Block @@ -25,7 +25,7 @@ class FeaturedProductsBlock &lt; Block
25 self.owner.highlighted_products_with_image 25 self.owner.highlighted_products_with_image
26 end 26 end
27 27
28 - def content 28 + def content(args={})
29 block = self 29 block = self
30 lambda do 30 lambda do
31 render :file => 'blocks/featured_products', :locals => { :block => block } 31 render :file => 'blocks/featured_products', :locals => { :block => block }
app/models/feed_reader_block.rb
@@ -78,7 +78,7 @@ class FeedReaderBlock &lt; Block @@ -78,7 +78,7 @@ class FeedReaderBlock &lt; Block
78 self.save! 78 self.save!
79 end 79 end
80 80
81 - def content 81 + def content(args={})
82 block_title(title) + formatted_feed_content 82 block_title(title) + formatted_feed_content
83 end 83 end
84 84
app/models/highlights_block.rb
@@ -28,7 +28,7 @@ class HighlightsBlock &lt; Block @@ -28,7 +28,7 @@ class HighlightsBlock &lt; Block
28 shuffle ? block_images.shuffle : block_images 28 shuffle ? block_images.shuffle : block_images
29 end 29 end
30 30
31 - def content 31 + def content(args={})
32 block = self 32 block = self
33 lambda do 33 lambda do
34 render :file => 'blocks/highlights', :locals => { :block => block } 34 render :file => 'blocks/highlights', :locals => { :block => block }
app/models/link_list_block.rb
@@ -47,7 +47,7 @@ class LinkListBlock &lt; Block @@ -47,7 +47,7 @@ class LinkListBlock &lt; Block
47 _('This block can be used to create a menu of links. You can add, remove and update the links as you wish.') 47 _('This block can be used to create a menu of links. You can add, remove and update the links as you wish.')
48 end 48 end
49 49
50 - def content 50 + def content(args={})
51 block_title(title) + 51 block_title(title) +
52 content_tag('ul', 52 content_tag('ul',
53 links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_html(i))} 53 links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_html(i))}
app/models/location_block.rb
@@ -11,7 +11,7 @@ class LocationBlock &lt; Block @@ -11,7 +11,7 @@ class LocationBlock &lt; Block
11 _('Shows where the profile is on the material world.') 11 _('Shows where the profile is on the material world.')
12 end 12 end
13 13
14 - def content 14 + def content(args={})
15 profile = self.owner 15 profile = self.owner
16 title = self.title 16 title = self.title
17 if profile.lat 17 if profile.lat
app/models/login_block.rb
@@ -8,7 +8,7 @@ class LoginBlock &lt; Block @@ -8,7 +8,7 @@ class LoginBlock &lt; Block
8 _('This block presents a login/logout block.') 8 _('This block presents a login/logout block.')
9 end 9 end
10 10
11 - def content 11 + def content(args={})
12 lambda do 12 lambda do
13 render :file => 'blocks/login_block' 13 render :file => 'blocks/login_block'
14 end 14 end
app/models/main_block.rb
@@ -8,7 +8,7 @@ class MainBlock &lt; Block @@ -8,7 +8,7 @@ class MainBlock &lt; Block
8 _('This block presents the main content of your pages.') 8 _('This block presents the main content of your pages.')
9 end 9 end
10 10
11 - def content 11 + def content(args={})
12 nil 12 nil
13 end 13 end
14 14
app/models/my_network_block.rb
@@ -14,7 +14,7 @@ class MyNetworkBlock &lt; Block @@ -14,7 +14,7 @@ class MyNetworkBlock &lt; Block
14 _('This block displays some info about your networking.') 14 _('This block displays some info about your networking.')
15 end 15 end
16 16
17 - def content 17 + def content(args={})
18 block = self 18 block = self
19 lambda do 19 lambda do
20 render :file => 'blocks/my_network', :locals => { 20 render :file => 'blocks/my_network', :locals => {
app/models/products_block.rb
@@ -16,7 +16,7 @@ class ProductsBlock &lt; Block @@ -16,7 +16,7 @@ class ProductsBlock &lt; Block
16 _('This block presents a list of your products.') 16 _('This block presents a list of your products.')
17 end 17 end
18 18
19 - def content 19 + def content(args={})
20 block_title(title) + 20 block_title(title) +
21 content_tag( 21 content_tag(
22 'ul', 22 'ul',
app/models/profile_image_block.rb
@@ -10,7 +10,7 @@ class ProfileImageBlock &lt; Block @@ -10,7 +10,7 @@ class ProfileImageBlock &lt; Block
10 _('This block presents the profile image') 10 _('This block presents the profile image')
11 end 11 end
12 12
13 - def content 13 + def content(args={})
14 block = self 14 block = self
15 s = show_name 15 s = show_name
16 lambda do 16 lambda do
app/models/profile_info_block.rb
@@ -8,7 +8,7 @@ class ProfileInfoBlock &lt; Block @@ -8,7 +8,7 @@ class ProfileInfoBlock &lt; Block
8 _('Basic information about <i>%{user}</i>: how long <i>%{user}</i> is part of <i>%{env}</i> and useful links.') % { :user => self.owner.name(), :env => self.owner.environment.name() } 8 _('Basic information about <i>%{user}</i>: how long <i>%{user}</i> is part of <i>%{env}</i> and useful links.') % { :user => self.owner.name(), :env => self.owner.environment.name() }
9 end 9 end
10 10
11 - def content 11 + def content(args={})
12 block = self 12 block = self
13 lambda do 13 lambda do
14 render :file => 'blocks/profile_info', :locals => { :block => block } 14 render :file => 'blocks/profile_info', :locals => { :block => block }
app/models/profile_list_block.rb
@@ -37,7 +37,7 @@ class ProfileListBlock &lt; Block @@ -37,7 +37,7 @@ class ProfileListBlock &lt; Block
37 _('Clicking on the people or groups will take you to their home page.') 37 _('Clicking on the people or groups will take you to their home page.')
38 end 38 end
39 39
40 - def content 40 + def content(args={})
41 profiles = self.profile_list 41 profiles = self.profile_list
42 title = self.view_title 42 title = self.view_title
43 nl = "\n" 43 nl = "\n"
app/models/profile_search_block.rb
@@ -4,7 +4,7 @@ class ProfileSearchBlock &lt; Block @@ -4,7 +4,7 @@ class ProfileSearchBlock &lt; Block
4 _('Display a form to search the profile') 4 _('Display a form to search the profile')
5 end 5 end
6 6
7 - def content 7 + def content(args={})
8 title = self.title 8 title = self.title
9 lambda do 9 lambda do
10 render :file => 'blocks/profile_search', :locals => { :title => title } 10 render :file => 'blocks/profile_search', :locals => { :title => title }
app/models/raw_html_block.rb
@@ -6,7 +6,7 @@ class RawHTMLBlock &lt; Block @@ -6,7 +6,7 @@ class RawHTMLBlock &lt; Block
6 6
7 settings_items :html, :type => :text 7 settings_items :html, :type => :text
8 8
9 - def content 9 + def content(args={})
10 (title.blank? ? '' : block_title(title)) + html.to_s 10 (title.blank? ? '' : block_title(title)) + html.to_s
11 end 11 end
12 12
app/models/recent_documents_block.rb
@@ -15,7 +15,7 @@ class RecentDocumentsBlock &lt; Block @@ -15,7 +15,7 @@ class RecentDocumentsBlock &lt; Block
15 settings_items :limit, :type => :integer, :default => 5 15 settings_items :limit, :type => :integer, :default => 5
16 16
17 include ActionController::UrlWriter 17 include ActionController::UrlWriter
18 - def content 18 + def content(args={})
19 docs = self.limit.nil? ? owner.recent_documents : owner.recent_documents(self.limit) 19 docs = self.limit.nil? ? owner.recent_documents : owner.recent_documents(self.limit)
20 20
21 block_title(title) + 21 block_title(title) +
app/models/sellers_search_block.rb
@@ -16,7 +16,7 @@ class SellersSearchBlock &lt; Block @@ -16,7 +16,7 @@ class SellersSearchBlock &lt; Block
16 _('This block presents a search engine for products.') 16 _('This block presents a search engine for products.')
17 end 17 end
18 18
19 - def content 19 + def content(args={})
20 title = self.title 20 title = self.title
21 lambda do 21 lambda do
22 render :file => 'search/_sellers_form', :locals => { :title => title } 22 render :file => 'search/_sellers_form', :locals => { :title => title }
app/models/slideshow_block.rb
@@ -31,7 +31,7 @@ class SlideshowBlock &lt; Block @@ -31,7 +31,7 @@ class SlideshowBlock &lt; Block
31 gallery.images.reject {|item| item.folder?} 31 gallery.images.reject {|item| item.folder?}
32 end 32 end
33 33
34 - def content 34 + def content(args={})
35 block = self 35 block = self
36 if gallery 36 if gallery
37 images = block_images 37 images = block_images
app/models/tags_block.rb
@@ -19,7 +19,7 @@ class TagsBlock &lt; Block @@ -19,7 +19,7 @@ class TagsBlock &lt; Block
19 Try to add some tags to some articles and you'l see your tag cloud growing.") 19 Try to add some tags to some articles and you'l see your tag cloud growing.")
20 end 20 end
21 21
22 - def content 22 + def content(args={})
23 tags = owner.article_tags 23 tags = owner.article_tags
24 return '' if tags.empty? 24 return '' if tags.empty?
25 25
app/views/profile/_profile_activities.rhtml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <div class='profile-activity-description'> 6 <div class='profile-activity-description'>
7 <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p> 7 <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p>
8 <p class='profile-activity-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p> 8 <p class='profile-activity-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p>
9 - <%= button_to_remote(:delete, content_tag(:span, _('Remove')), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %> 9 + <%= button_to_remote(:delete, content_tag(:span, _('Remove')), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if can_edit_profile %>
10 </div> 10 </div>
11 <hr /> 11 <hr />
12 </li> 12 </li>
app/views/profile/_profile_network_activities.rhtml
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 <div class='profile-network-description'> 9 <div class='profile-network-description'>
10 <p class='profile-network-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p> 10 <p class='profile-network-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p>
11 <p class='profile-network-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p> 11 <p class='profile-network-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p>
  12 + <%= button_to_remote(:delete, content_tag(:span, _('Remove')), :url =>{:action => 'remove_notification', :activity_id => activity.id}, :update => "profile-network-item-#{activity.id}") if can_edit_profile %>
12 <p class='profile-network-where'><%= _('In community %s') % link_to(activity.target.name, activity.target.url) if !profile.is_a?(Community) && activity.target.is_a?(Community) %></p> 13 <p class='profile-network-where'><%= _('In community %s') % link_to(activity.target.name, activity.target.url) if !profile.is_a?(Community) && activity.target.is_a?(Community) %></p>
13 </div> 14 </div>
14 <div id='profile-network-message-<%= activity.id%>' style='display:none;'> 15 <div id='profile-network-message-<%= activity.id%>' style='display:none;'>
app/views/shared/block.rhtml
1 <% if block.cacheable? && use_cache %> 1 <% if block.cacheable? && use_cache %>
2 <% cache_timeout(block.cache_key, block.timeout) do %> 2 <% cache_timeout(block.cache_key, block.timeout) do %>
3 - <%= display_block_content(block, main_content) %> 3 + <%= display_block_content(block, user, main_content) %>
4 <% end %> 4 <% end %>
5 <% else %> 5 <% else %>
6 - <%= display_block_content(block, main_content) %> 6 + <%= display_block_content(block, user, main_content) %>
7 <% end %> 7 <% end %>
debian/changelog
@@ -9,6 +9,29 @@ noosfero (0.36.0~1) unstable; urgency=low @@ -9,6 +9,29 @@ noosfero (0.36.0~1) unstable; urgency=low
9 9
10 -- Antonio Terceiro <terceiro@colivre.coop.br> Sun, 27 Nov 2011 14:11:33 -0200 10 -- Antonio Terceiro <terceiro@colivre.coop.br> Sun, 27 Nov 2011 14:11:33 -0200
11 11
  12 +noosfero (0.35.2) unstable; urgency=low
  13 +
  14 + * Bugfixes version release
  15 +
  16 + -- Daniela Soares Feitosa <daniela@colivre.coop.br> Fri, 02 Mar 2012 13:36:02 -0300
  17 +
  18 +noosfero (0.35.2~1) unstable; urgency=low
  19 +
  20 + * Bugfixes version release
  21 + * Added missing Build dependencies to build in a clean chroot: rake, rails,
  22 + libferret-ruby, libwill-paginate-ruby, tango-icon-theme, rcov
  23 + * Noosfero needs a functioning MTA: added dependency on exim4 |
  24 + mail-transport-agent.
  25 + * /usr/share/dbconfig-common/scripts/noosfero/install/pgsql: run db:migrate
  26 + just after db:schema:load.
  27 + * etc/init.d/noosfero: forward fix for the Lenny → Squeeze upgrade. In
  28 + Squeeze, `rails` is an empty package that depends on rails-ruby1.8, but
  29 + rails-ruby1.8 is only unpacked *after* noosfero prerm runs. This way, the
  30 + initscript must be able to stop the services without any of the Rails
  31 + libraries available.
  32 +
  33 + -- Antonio Terceiro <terceiro@colivre.coop.br> Thu, 01 Mar 2012 14:37:15 -0300
  34 +
12 noosfero (0.35.1) unstable; urgency=low 35 noosfero (0.35.1) unstable; urgency=low
13 36
14 * Bugfixes version release 37 * Bugfixes version release
debian/control
@@ -3,7 +3,7 @@ Section: web @@ -3,7 +3,7 @@ Section: web
3 Priority: extra 3 Priority: extra
4 Maintainer: Noosfero developers <noosfero-dev@listas.softwarelivre.org> 4 Maintainer: Noosfero developers <noosfero-dev@listas.softwarelivre.org>
5 Uploaders: Antonio Terceiro <terceiro@colivre.coop.br> 5 Uploaders: Antonio Terceiro <terceiro@colivre.coop.br>
6 -Build-Depends: debhelper (>= 7.0.50~), po4a, libgettext-ruby-util, libgettext-ruby1.8, libsqlite3-ruby1.8, 6 +Build-Depends: debhelper (>= 7.0.50~), po4a, libgettext-ruby-util, libgettext-ruby1.8, libsqlite3-ruby1.8, rake, rails, libferret-ruby, libwill-paginate-ruby, tango-icon-theme, rcov
7 Standards-Version: 3.8.4 7 Standards-Version: 3.8.4
8 Homepage: http://noosfero.org/ 8 Homepage: http://noosfero.org/
9 Vcs-Git: git://git.colivre.coop.br/noosfero.git 9 Vcs-Git: git://git.colivre.coop.br/noosfero.git
@@ -11,7 +11,7 @@ Vcs-Browser: http://git.colivre.coop.br/?p=noosfero.git @@ -11,7 +11,7 @@ Vcs-Browser: http://git.colivre.coop.br/?p=noosfero.git
11 11
12 Package: noosfero 12 Package: noosfero
13 Architecture: all 13 Architecture: all
14 -Depends: rails (>= 2.3.5-1~), rails-ruby1.8 (>= 2.3.5-1~), ruby1.8, ruby, rake, libgettext-rails-ruby1.8, libsqlite3-ruby, libpgsql-ruby, libmysql-ruby, librmagick-ruby, libredcloth-ruby, libwill-paginate-ruby (>= 2.3.12-1~), iso-codes, libfeedparser-ruby, libferret-ruby, libdaemons-ruby, rcov, mongrel, mongrel-cluster, tango-icon-theme, libhpricot-ruby, iso-codes, memcached, debconf, dbconfig-common, postgresql, adduser, ${misc:Depends} 14 +Depends: rails (>= 2.3.5-1~), rails-ruby1.8 (>= 2.3.5-1~), ruby1.8, ruby, rake, libgettext-rails-ruby1.8, libsqlite3-ruby, libpgsql-ruby, libmysql-ruby, librmagick-ruby, libredcloth-ruby, libwill-paginate-ruby (>= 2.3.12-1~), iso-codes, libfeedparser-ruby, libferret-ruby, libdaemons-ruby, rcov, mongrel, mongrel-cluster, tango-icon-theme, libhpricot-ruby, iso-codes, memcached, debconf, dbconfig-common, postgresql, adduser, exim4 | mail-transport-agent, ${misc:Depends}
15 Recommends: postgresql-client 15 Recommends: postgresql-client
16 Description: free web-based platform for social networks 16 Description: free web-based platform for social networks
17 Noosfero is a web platform for social and solidarity economy networks with 17 Noosfero is a web platform for social and solidarity economy networks with
debian/dbinstall
@@ -8,4 +8,5 @@ sed -i -e &#39;s/adapter: pgsql/adapter: postgresql/&#39; /etc/noosfero/database.yml @@ -8,4 +8,5 @@ sed -i -e &#39;s/adapter: pgsql/adapter: postgresql/&#39; /etc/noosfero/database.yml
8 /etc/init.d/noosfero setup 8 /etc/init.d/noosfero setup
9 9
10 cd /usr/share/noosfero && su noosfero -c "rake db:schema:load RAILS_ENV=production" 10 cd /usr/share/noosfero && su noosfero -c "rake db:schema:load RAILS_ENV=production"
  11 +cd /usr/share/noosfero && su noosfero -c "rake db:migrate RAILS_ENV=production SCHEMA=/dev/null"
11 cd /usr/share/noosfero && su noosfero -c "rake db:data:minimal RAILS_ENV=production" 12 cd /usr/share/noosfero && su noosfero -c "rake db:data:minimal RAILS_ENV=production"
lib/noosfero.rb
1 module Noosfero 1 module Noosfero
2 PROJECT = 'noosfero' 2 PROJECT = 'noosfero'
3 - VERSION = '0.35.1' 3 + VERSION = '0.35.2'
4 4
5 def self.pattern_for_controllers_in_directory(dir) 5 def self.pattern_for_controllers_in_directory(dir)
6 disjunction = controllers_in_directory(dir).join('|') 6 disjunction = controllers_in_directory(dir).join('|')
script/production
@@ -40,10 +40,34 @@ do_start() { @@ -40,10 +40,34 @@ do_start() {
40 } 40 }
41 41
42 do_stop() { 42 do_stop() {
43 - ruby -S thin -C config/thin.yml stop  
44 - ./script/delayed_job stop  
45 - ./script/feed-updater stop  
46 - ./script/ferret_server -e $RAILS_ENV stop 43 +
  44 + # During Debian upgrades, it is possible that rails is not available (e.g.
  45 + # Lenny -> Squeeze), so the programs below might fail. If they do, we fall
  46 + # back to stopping the daemons by manually reading their PID files, killing
  47 + # them and wiping the PID files.
  48 +
  49 + ruby -S thin -C config/thin.yml stop ||
  50 + stop_via_pid_file tmp/pids/thin.*.pid
  51 +
  52 + ./script/delayed_job stop ||
  53 + stop_via_pid_file tmp/pids/delayed_job.pid
  54 +
  55 + ./script/feed-updater stop ||
  56 + stop_via_pid_file tmp/pids/feed-updater.default.pid
  57 +
  58 + ./script/ferret_server -e $RAILS_ENV stop ||
  59 + stop_via_pid_file tmp/pids/ferret.production.pid
  60 +}
  61 +
  62 +stop_via_pid_file() {
  63 + for pidfile in $@; do
  64 + if [ -e "$pidfile" ]; then
  65 + pid=$(cat $pidfile)
  66 + echo "Sentign TERM signal to stop $pid ..."
  67 + kill -TERM "$pid"
  68 + rm -f $pidfile
  69 + fi
  70 + done
47 } 71 }
48 72
49 environments_loop() { 73 environments_loop() {
test/functional/profile_controller_test.rb
@@ -1033,14 +1033,43 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -1033,14 +1033,43 @@ class ProfileControllerTest &lt; ActionController::TestCase
1033 assert_redirected_to :controller => 'account', :action => 'login' 1033 assert_redirected_to :controller => 'account', :action => 'login'
1034 end 1034 end
1035 1035
1036 - should "not remove an activity of another user" do  
1037 - login_as(profile.identifier)  
1038 - p1 = fast_create(Person)  
1039 - at = fast_create(ActionTracker::Record, :user_id => p1.id)  
1040 - atn = fast_create(ActionTrackerNotification, :profile_id => p1.id, :action_tracker_id => at.id)  
1041 - count = ActionTrackerNotification.count  
1042 - post :remove_activity, :profile => profile.identifier, :activity_id => at.id  
1043 - assert_equal count, ActionTrackerNotification.count 1036 + should "remove an activity of another person if user has permissions to edit it" do
  1037 + user = create_user('owner').person
  1038 + login_as(user.identifier)
  1039 + owner = create_user('owner').person
  1040 + activity = fast_create(ActionTracker::Record, :user_id => owner.id)
  1041 + @controller.stubs(:user).returns(user)
  1042 + @controller.stubs(:profile).returns(owner)
  1043 +
  1044 + assert_no_difference ActionTracker::Record, :count do
  1045 + post :remove_activity, :profile => owner.identifier, :activity_id => activity.id
  1046 + end
  1047 +
  1048 + owner.environment.add_admin(user)
  1049 +
  1050 + assert_difference ActionTracker::Record, :count, -1 do
  1051 + post :remove_activity, :profile => owner.identifier, :activity_id => activity.id
  1052 + end
  1053 + end
  1054 +
  1055 + should "remove a notification of another profile if user has permissions to edit it" do
  1056 + user = create_user('owner').person
  1057 + login_as(user.identifier)
  1058 + profile = fast_create(Profile)
  1059 + activity = fast_create(ActionTracker::Record, :user_id => user.id)
  1060 + fast_create(ActionTrackerNotification, :profile_id => profile.id, :action_tracker_id => activity.id)
  1061 + @controller.stubs(:user).returns(user)
  1062 + @controller.stubs(:profile).returns(profile)
  1063 +
  1064 + assert_no_difference ActionTrackerNotification, :count do
  1065 + post :remove_notification, :profile => profile.identifier, :activity_id => activity.id
  1066 + end
  1067 +
  1068 + profile.environment.add_admin(user)
  1069 +
  1070 + assert_difference ActionTrackerNotification, :count, -1 do
  1071 + post :remove_activity, :profile => profile.identifier, :activity_id => activity.id
  1072 + end
1044 end 1073 end
1045 1074
1046 should "not show the scrap button on network activity if the user don't follow the user" do 1075 should "not show the scrap button on network activity if the user don't follow the user" do
test/unit/blog_archives_block_test.rb
@@ -157,4 +157,22 @@ class BlogArchivesBlockTest &lt; ActiveSupport::TestCase @@ -157,4 +157,22 @@ class BlogArchivesBlockTest &lt; ActiveSupport::TestCase
157 end 157 end
158 end 158 end
159 159
  160 + should 'not count articles if the user can\'t see them' do
  161 + person = create_user('testuser').person
  162 + blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog_path')
  163 + block = fast_create(BlogArchivesBlock)
  164 +
  165 + feed = mock()
  166 + feed.stubs(:url).returns('feed_url')
  167 + blog.stubs(:feed).returns(feed)
  168 + block.stubs(:blog).returns(blog)
  169 + block.stubs(:owner).returns(profile)
  170 +
  171 + public_post = fast_create(TextileArticle, :profile_id => profile.id, :parent_id => blog.id, :published => true, :published_at => Time.mktime(2012, 'jan'))
  172 + private_post = fast_create(TextileArticle, :profile_id => profile.id, :parent_id => blog.id, :published => false, :published_at => Time.mktime(2012, 'jan'))
  173 +
  174 + assert_match /January \(1\)/, block.content({:person => person})
  175 + assert_match /January \(1\)/, block.content()
  176 + assert_match /January \(2\)/, block.content({:person => profile})
  177 + end
160 end 178 end