can [:create, :destroy], :session
can [:read, :data, :georss], Trace
can [:read, :create, :suspended, :auth_success, :auth_failure], User
- can [:read, :update], :account_terms
can :read, UserBlock
end
if user&.active?
can :welcome, :site
- can :read, :deletion
+ can :read, [:deletion, :account_terms]
if Settings.status != "database_offline"
can [:subscribe, :unsubscribe], Changeset
can [:read, :destroy], :oauth2_authorized_application
can [:read, :create, :destroy], :oauth2_authorization
can [:update, :destroy], :account
+ can :update, :account_terms
can :read, :dashboard
can [:create, :subscribe, :unsubscribe], DiaryEntry
can :update, DiaryEntry, :user => user
can [:create], DiaryComment
- can [:make_friend, :remove_friend], Friendship
+ can [:show, :create, :destroy], Follow
can [:read, :create, :mark, :unmute, :destroy], Message
can [:close, :reopen], Note
can [:read, :update], :preference
can [:hide, :unhide], [DiaryEntry, DiaryComment]
can [:read, :resolve, :ignore, :reopen], Issue
can :create, IssueComment
- can [:set_status, :destroy], User
+
+ can [:update], :user_status
can [:read, :update], :users_list
can [:create, :destroy], UserRole
end
<% if current_user %>
<li>
<% if current_user.friends_with?(@user) %>
- <%= link_to t(".remove as friend"), remove_friend_path(:display_name => @user.display_name), :method => :post %>
+ <%= link_to t(".unfollow"), follow_path(:display_name => @user.display_name), :method => :delete %>
<% else %>
- <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name), :method => :post %>
+ <%= link_to t(".follow"), follow_path(:display_name => @user.display_name), :method => :post %>
<% end %>
</li>
<% end %>
</small>
</div>
- <% if can?(:set_status, User) || can?(:destroy, User) %>
+ <% if can?(:update, :user_status) %>
<nav class='secondary-actions'>
<ul class='clearfix'>
- <% if can? :set_status, User %>
- <% if @user.may_activate? %>
- <li>
- <%= link_to t(".activate_user"), set_status_user_path(:event => "activate", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
- </li>
- <% end %>
-
- <% if @user.may_unsuspend? %>
- <li>
- <%= link_to t(".unsuspend_user"), set_status_user_path(:event => "unsuspend", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
- </li>
- <% end %>
-
- <% if @user.may_confirm? %>
- <li>
- <%= link_to t(".confirm_user"), set_status_user_path(:event => "confirm", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
- </li>
- <% end %>
-
- <% if @user.may_unconfirm? %>
- <li>
- <%= link_to t(".unconfirm_user"), set_status_user_path(:event => "unconfirm", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
- </li>
- <% end %>
-
- <% if @user.may_hide? %>
- <li>
- <%= link_to t(".hide_user"), set_status_user_path(:event => "hide", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
- </li>
- <% end %>
-
- <% if @user.may_unhide? %>
- <li>
- <%= link_to t(".unhide_user"), set_status_user_path(:event => "unhide", :display_name => @user.display_name), :method => :post, :data => { :confirm => t(".confirm") } %>
- </li>
- <% end %>
- <% end %>
-
- <% if can?(:destroy, User) && @user.may_soft_destroy? %>
- <li>
- <%= link_to t(".delete_user"), user_path(:display_name => @user.display_name), :method => :delete, :data => { :confirm => t(".confirm") } %>
+ <% if @user.may_activate? %>
+ <li>
+ <%= link_to t(".activate_user"), user_status_path(@user, :event => "activate"), :method => :put, :data => { :confirm => t(".confirm") } %>
+ </li>
+ <% end %>
+
+ <% if @user.may_unsuspend? %>
+ <li>
+ <%= link_to t(".unsuspend_user"), user_status_path(@user, :event => "unsuspend"), :method => :put, :data => { :confirm => t(".confirm") } %>
+ </li>
+ <% end %>
+
+ <% if @user.may_confirm? %>
+ <li>
+ <%= link_to t(".confirm_user"), user_status_path(@user, :event => "confirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
+ </li>
+ <% end %>
+
+ <% if @user.may_unconfirm? %>
+ <li>
+ <%= link_to t(".unconfirm_user"), user_status_path(@user, :event => "unconfirm"), :method => :put, :data => { :confirm => t(".confirm") } %>
+ </li>
+ <% end %>
+
+ <% if @user.may_hide? %>
+ <li>
+ <%= link_to t(".hide_user"), user_status_path(@user, :event => "hide"), :method => :put, :data => { :confirm => t(".confirm") } %>
+ </li>
+ <% end %>
+
+ <% if @user.may_unhide? %>
+ <li>
+ <%= link_to t(".unhide_user"), user_status_path(@user, :event => "unhide"), :method => :put, :data => { :confirm => t(".confirm") } %>
+ </li>
+ <% end %>
+
+ <% if @user.may_soft_destroy? %>
+ <li>
+ <%= link_to t(".delete_user"), user_status_path(@user, :event => "soft_destroy"), :method => :put, :data => { :confirm => t(".confirm") } %>
</li>
<% end %>
</ul>
# user pages
get "/user/terms", :to => redirect(:path => "/account/terms")
- resources :users, :path => "user", :param => :display_name, :only => [:new, :create, :show, :destroy] do
+ resources :users, :path => "user", :param => :display_name, :only => [:new, :create, :show] do
resource :role, :controller => "user_roles", :path => "roles/:role", :only => [:create, :destroy]
scope :module => :users do
resource :issued_blocks, :path => "blocks_by", :only => :show
resource :received_blocks, :path => "blocks", :only => [:show, :edit, :destroy]
+ resource :status, :only => :update
end
end
get "/user/:display_name/account", :to => redirect(:path => "/account/edit")
- post "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
resource :account, :only => [:edit, :update, :destroy] do
scope :module => :accounts do
resource :profile, :only => [:edit, :update]
# friendships
- match "/user/:display_name/make_friend" => "friendships#make_friend", :via => [:get, :post], :as => "make_friend"
- match "/user/:display_name/remove_friend" => "friendships#remove_friend", :via => [:get, :post], :as => "remove_friend"
+ scope "/user/:display_name" do
+ resource :follow, :only => [:create, :destroy, :show], :path => "follow"
+
+ get "make_friend", :to => redirect("/user/%{display_name}/follow")
+ get "remove_friend", :to => redirect("/user/%{display_name}/follow")
+ end
# user lists
namespace :users do