Refactor friendships controller and model

This commit is contained in:
nertc 2025-01-14 11:33:56 +04:00
parent 2b7a48029b
commit be11f2075e
27 changed files with 317 additions and 338 deletions

View file

@ -686,17 +686,20 @@ en:
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: "Do you want to follow %{user}?"
button: "Follow User"
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."
remove_friend:
heading: "Do you want to unfollow %{user}?"
button: "Unfollow"
destroy:
success: "You successfully unfollowed %{name}."
not_followed: "You are not following %{name}."
geocoder:

View file

@ -288,8 +288,12 @@ OpenStreetMap::Application.routes.draw 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