From: Anton Khorev Date: Fri, 17 Jan 2025 01:01:22 +0000 (+0300) Subject: Merge branch 'pull/5261' X-Git-Tag: live~280 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/3eccf65d8cf2ceb13050f5c8d1396546631994be?hp=-c Merge branch 'pull/5261' --- 3eccf65d8cf2ceb13050f5c8d1396546631994be diff --combined app/abilities/ability.rb index 05f4952ac,4c5288307..5223920c9 --- 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 diff --combined config/locales/en.yml index 21a7ce0f2,ff43a0787..888079a6c --- a/config/locales/en.yml +++ b/config/locales/en.yml @@@ -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 @@@ -318,6 -321,7 +318,6 @@@ 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:" @@@ -325,8 -329,6 +325,8 @@@ 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 @@@ -476,7 -478,7 +476,7 @@@ 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." @@@ -542,17 -544,17 +542,17 @@@ 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: @@@ -563,7 -565,7 +563,7 @@@ 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}" @@@ -684,19 -686,22 +684,22 @@@ 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: @@@ -1660,12 -1665,12 +1663,12 @@@ 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 @@@ -1868,6 -1873,8 +1871,6 @@@ 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 @@@ -1878,7 -1885,11 +1881,7 @@@ 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: @@@ -2690,7 -2701,7 +2693,7 @@@ 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 @@@ -2773,6 -2784,7 +2776,6 @@@ 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 @@@ -2809,8 -2821,8 +2812,8 @@@ 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 9cb3a63ed,0b18c47fd..39dd35f31 --- a/config/routes.rb +++ b/config/routes.rb @@@ -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 => "" @@@ -284,13 -284,16 +284,17 @@@ 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