diff --git a/app/views/profile/communities.rhtml b/app/views/profile/communities.rhtml
index dc4588f..22b974b 100644
--- a/app/views/profile/communities.rhtml
+++ b/app/views/profile/communities.rhtml
@@ -13,7 +13,7 @@
<%= button :back, _('Go back'), { :controller => 'profile' },
:help => _('Back to the page where you come from.') %>
<%= button :add, _('Create a new community'),
- :controller => 'memberships', :action => 'new_community' if logged_in? %>
+ :controller => 'memberships', :action => 'new_community' if logged_in? && user == profile %>
<% end %>
diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb
index fd42888..4723a4b 100644
--- a/test/functional/profile_controller_test.rb
+++ b/test/functional/profile_controller_test.rb
@@ -145,4 +145,17 @@ class ProfileControllerTest < Test::Unit::TestCase
assert_no_tag :tag => 'ul', :attributes => { :class => 'profile-info-data' }, :descendant => { :tag => 'a', :content => 'Control panel' }
end
+ should 'show create community in own profile' do
+ login_as(@profile.identifier)
+ get :communities, :profile => @profile.identifier
+ assert_tag :tag => 'a', :child => { :tag => 'span', :content => 'Create a new community' }
+ end
+
+ should 'not show create community on profile of other users' do
+ login_as(@profile.identifier)
+ person = create_user('person_1').person
+ get :communities, :profile => person.identifier
+ assert_no_tag :tag => 'a', :child => { :tag => 'span', :content => 'Create a new community' }
+ end
+
end
--
libgit2 0.21.2