X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f99c383318c4f9ea15639f0566f3e42db4e2c8b1..7c89e7c0b418c5c4d9692b5e153946571a6ea994:/app/views/users/show.html.erb
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 87eb9b45f..7e8b45185 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -35,7 +35,7 @@
<% end %>
- <% if current_user and current_user.moderator? and current_user.blocks_created.exists? %>
+ <% if can?(:create, UserBlock) and current_user.blocks_created.exists? %>
<%= link_to t(".blocks by me"), :controller => "user_blocks", :action => "blocks_by", :display_name => current_user.display_name %>
<%= number_with_delimiter(current_user.blocks_created.active.size) %>
@@ -96,7 +96,7 @@
<% end %>
- <% if current_user and current_user.moderator? %>
+ <% if can?(:create, UserBlock) %>
<%= link_to t(".create_block"), :controller => "user_blocks", :action => "new", :display_name => @user.display_name %>
@@ -111,34 +111,38 @@
<% end %>
- <% if current_user and current_user.administrator? %>
+ <% if can?(:set_status, User) || can?(:delete, User) %>
- <% if ["active", "confirmed"].include? @user.status %>
- -
- <%= link_to t(".deactivate_user"), set_status_user_path(:status => "pending", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
-
- <% elsif ["pending"].include? @user.status %>
- -
- <%= link_to t(".activate_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
-
- <% end %>
+ <% if can? :set_status, User %>
+ <% if ["active", "confirmed"].include? @user.status %>
+ -
+ <%= link_to t(".deactivate_user"), set_status_user_path(:status => "pending", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
+
+ <% elsif ["pending"].include? @user.status %>
+ -
+ <%= link_to t(".activate_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
+
+ <% end %>
- <% if ["active", "suspended"].include? @user.status %>
- -
- <%= link_to t(".confirm_user"), set_status_user_path(:status => "confirmed", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
-
+ <% if ["active", "suspended"].include? @user.status %>
+ -
+ <%= link_to t(".confirm_user"), set_status_user_path(:status => "confirmed", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
+
+ <% end %>
+ -
+ <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %>
+ <%= link_to t(".hide_user"), set_status_user_path(:status => "deleted", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
+ <% else %>
+ <%= link_to t(".unhide_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
+
+ <% end %>
<% end %>
+ <% if can? :delete, User %>
-
- <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %>
- <%= link_to t(".hide_user"), set_status_user_path(:status => "deleted", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
- <% else %>
- <%= link_to t(".unhide_user"), set_status_user_path(:status => "active", :display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
+ <%= link_to t(".delete_user"), delete_user_path(:display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
<% end %>
- -
- <%= link_to t(".delete_user"), delete_user_path(:display_name => @user.display_name), :data => { :confirm => t(".confirm") } %>
-
<% end %>
@@ -194,7 +198,7 @@
<%= content_tag "div", "", :id => "map", :class => "content_map", :data => { :user => user_data } %>
<% end %>
- <% friends = @user.friends.collect(&:befriendee) %>
+ <% friends = @user.friends %>
<% nearby = @user.nearby - friends %>