From: Andy Allan Date: Fri, 17 Jan 2025 17:55:02 +0000 (+0000) Subject: Merge pull request #5437 from AntonKhorev/user-status-resource X-Git-Tag: live~355 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/4370fe45add697f481ab88764aba8379eb3316c2?ds=inline;hp=-c Merge pull request #5437 from AntonKhorev/user-status-resource Use resourceful route for user status --- 4370fe45add697f481ab88764aba8379eb3316c2 diff --combined app/abilities/ability.rb index 5223920c9,651dc4973..e31e3e930 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@@ -24,12 -24,13 +24,12 @@@ class Abilit 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 @@@ -37,12 -38,11 +37,12 @@@ 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 @@@ -67,7 -67,8 +67,8 @@@ 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 diff --combined app/views/users/show.html.erb index 5a8c116c1,571976ee3..76bedf60e --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@@ -84,9 -84,9 +84,9 @@@ <% if current_user %>
  • <% 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 %>
  • <% end %> @@@ -161,50 -161,48 +161,48 @@@ - <% if can?(:set_status, User) || can?(:destroy, User) %> + <% if can?(:update, :user_status) %>