]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'pull/5261'
authorAnton Khorev <tony29@yandex.ru>
Fri, 17 Jan 2025 01:01:22 +0000 (04:01 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 17 Jan 2025 01:01:22 +0000 (04:01 +0300)
1  2 
app/abilities/ability.rb
config/locales/en.yml
config/routes.rb

diff --combined app/abilities/ability.rb
index 05f4952ac21907e0c1fbdcd869f94f134449f726,4c5288307c6a9026e752f26f4222e61f00d1c176..5223920c9c8a37cc89b9162fb0ea813b4ec4bba8
@@@ -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
          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
diff --combined config/locales/en.yml
index 21a7ce0f2aa85d52c87f0d7f727cb1abcb6485dd,ff43a0787ab63d555c59624edb76e1b830d6878a..888079a6c6956035b6b5831cb1a01f0d0fd12f9f
@@@ -20,6 -20,9 +20,6 @@@ en
          create: Add Comment
        message:
          create: Send
 -      client_application:
 -        create: Register
 -        update: Update
        oauth2_application:
          create: Register
          update: Update
@@@ -89,7 -92,7 +89,7 @@@
          support_url: Support URL
          allow_read_prefs:  read their user preferences
          allow_write_prefs: modify their user preferences
-         allow_write_diary: create diary entries, comments and make friends
+         allow_write_diary: create diary entries and comments
          allow_write_api:   modify the map
          allow_read_gpx:    read their private GPS traces
          allow_write_gpx:   upload GPS traces
          readable_summary: human readable summary
          informal_translations: informal translations
          continue: "Continue"
 -        declined: "https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
          cancel: "Cancel"
          you need to accept or decline: "Please read and then either accept or decline the new Contributor Terms to continue."
          legale_select: "Country of residence:"
            france: "France"
            italy: "Italy"
            rest_of_world: "Rest of the world"
 +      update:
 +        terms accepted: "Thanks for accepting the new contributor terms!"
        terms_declined_flash:
          terms_declined_html: We are sorry that you have decided to not accept the new Contributor Terms. For more information, please see %{terms_declined_link}.
          terms_declined_link: this wiki page
        title: "Changesets"
        title_user: "Changesets by %{user}"
        title_user_link_html: "Changesets by %{user_link}"
-       title_friend: "Changesets by my friends"
+       title_followed: "Changesets by followings"
        title_nearby: "Changesets by nearby users"
        empty: "No changesets found."
        empty_area: "No changesets in this area."
      popup:
        your location: "Your location"
        nearby mapper: "Nearby mapper"
-       friend: "Friend"
+       following: "Following"
      show:
        title: My Dashboard
        no_home_location_html: "%{edit_profile_link} and set your home location to see nearby users."
        edit_your_profile: Edit your profile
-       my friends: My friends
-       no friends: You have not added any friends yet.
+       followings: Followings  
+       no followings: You have not followed any user yet.
        nearby users: "Other nearby users"
        no nearby users: "There are no other users who admit to mapping nearby yet."
-       friends_changesets: "friends' changesets"
-       friends_diaries: "friends' diary entries"
+       followed_changesets: "changesets"
+       followed_diaries: "diary entries"
        nearby_changesets: "nearby user changesets"
        nearby_diaries: "nearby user diary entries"
    diary_entries:
        use_map_link: Use Map
      index:
        title: "Users' Diaries"
-       title_friends: "Friends' Diaries"
+       title_followed: "Followings' Diaries"
        title_nearby: "Nearby Users' Diaries"
        user_title: "%{user}'s Diary"
        in_language_title: "Diary Entries in %{language}"
      not_found:
        title: File not found
        description: Couldn't find a file/directory/API operation by that name on the OpenStreetMap server (HTTP 404)
-   friendships:
-     make_friend:
-       heading: "Add %{user} as a friend?"
-       button: "Add as friend"
-       success: "%{name} is now your friend!"
-       failed: "Sorry, failed to add %{name} as a friend."
-       already_a_friend: "You are already friends with %{name}."
-       limit_exceeded: "You have friended a lot of users recently. Please wait a while before trying to friend any more."
-     remove_friend:
-       heading: "Unfriend %{user}?"
-       button: "Unfriend"
-       success: "%{name} was removed from your friends."
-       not_a_friend: "%{name} is not one of your friends."
+   follows:
+     show:
+       follow:
+         heading: "Do you want to follow %{user}?"
+         button: "Follow User"
+       unfollow:
+         heading: "Do you want to unfollow %{user}?"
+         button: "Unfollow User"
+     create:
+       success: "You are now following %{name}!"
+       failed: "Sorry, your request to follow %{name} has failed."
+       already_followed: "You already follow %{name}."
+       limit_exceeded: "You have followed a lot of users recently. Please wait a while before trying to follow any more."
+     destroy:
+       success: "You successfully unfollowed %{name}."
+       not_followed: "You are not following %{name}."
    geocoder:
      search:
        title:
        footer_html: "You can also read the message at %{readurl} and you can send a message to the author at %{replyurl}"
      friendship_notification:
        hi: "Hi %{to_user},"
-       subject: "[OpenStreetMap] %{user} added you as a friend"
-       had_added_you: "%{user} has added you as a friend on OpenStreetMap."
+       subject: "[OpenStreetMap] %{user} followed you"
+       followed_you: "%{user} is now following you on OpenStreetMap."
        see_their_profile: "You can see their profile at %{userurl}."
        see_their_profile_html: "You can see their profile at %{userurl}."
-       befriend_them: "You can also add them as a friend at %{befriendurl}."
-       befriend_them_html: "You can also add them as a friend at %{befriendurl}."
+       follow_them: "You can also follow them at %{followurl}."
+       follow_them_html: "You can also follow them at %{followurl}."
      gpx_details:
        details: "Your file details:"
        filename: Filename
    preferences:
      show:
        title: My Preferences
 -      preferred_editor: Preferred Editor
 -      preferred_languages: Preferred Languages
        preferred_site_color_scheme: Preferred Website Color Scheme
        site_color_schemes:
          auto: Auto
          auto: Auto
          light: Light
          dark: Dark
 -      edit_preferences: Edit Preferences
 -    edit:
 -      title: Edit Preferences
        save: Update Preferences
 -      cancel: Cancel
      update:
        failure: Couldn't update preferences.
      update_success_flash:
        openid: Sign-in using OpenStreetMap
        read_prefs: Read user preferences
        write_prefs: Modify user preferences
-       write_diary: Create diary entries, comments and make friends
+       write_diary: Create diary entries and comments
        write_api: Modify the map
        read_gpx: Read private GPS traces
        write_gpx: Upload GPS traces
          contributor_terms_url: "https://osmfoundation.org/wiki/Licence/Contributor_Terms"
          contributor_terms: "contributor terms"
        continue: Sign Up
 -      terms accepted: "Thanks for accepting the new contributor terms!"
        email_help:
          privacy_policy: privacy policy
          privacy_policy_url: https://osmfoundation.org/wiki/Privacy_Policy
        edits: Edits
        traces: Traces
        notes: Map Notes
-       remove as friend: Unfriend
-       add as friend: Add Friend
+       unfollow: Unfollow
+       follow: Follow
        mapper since: "Mapper since:"
        last map edit: "Last map edit:"
        no activity yet: "No activity yet"
diff --combined config/routes.rb
index 9cb3a63edc1878dd2d126a3d0c5c2653549eb167,0b18c47fd72b45e8e80a7cf9da5230085094bc32..39dd35f31d10f6d52bf2a6677454968e15f30498
@@@ -66,14 -66,14 +66,14 @@@ OpenStreetMap::Application.routes.draw 
      get "map" => "map#index"
  
      get "trackpoints" => "tracepoints#index"
 -
 -    get "user/:id" => "users#show", :id => /\d+/, :as => :api_user
 -    get "user/details" => "users#details"
 -    get "user/gpx_files" => "users#gpx_files"
 -    get "users" => "users#index", :as => :api_users
    end
  
    namespace :api, :path => "api/0.6" do
 +    resources :users, :only => :index
 +    resources :users, :path => "user", :id => /\d+/, :only => :show
 +    resources :user_traces, :path => "user/gpx_files", :module => :users, :controller => :traces, :only => :index
 +    get "user/details" => "users#details"
 +
      resources :user_preferences, :except => [:new, :create, :edit], :param => :preference_key, :path => "user/preferences" do
        collection do
          put "" => "user_preferences#update_all", :as => ""
    end
  
    resource :dashboard, :only => [:show]
 -  resource :preferences, :only => [:show, :edit, :update]
 +  resource :preferences, :only => [:show, :update]
 +  get "/preferences/edit", :to => redirect(:path => "/preferences")
    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