app/controllers/federails/client/followings_controller.rb in federails-0.1.0 vs app/controllers/federails/client/followings_controller.rb in federails-0.2.0
- old
+ new
@@ -2,10 +2,18 @@
module Client
class FollowingsController < Federails::ApplicationController
before_action :authenticate_user!
before_action :set_following, only: [:accept, :destroy]
+ # GET /app/followings/new?uri={uri}
+ def new
+ # Find actor (and fetch if necessary)
+ actor = Actor.find_or_create_by_federation_url(params[:uri])
+ # Redirect to local profile page which will have a follow button on it
+ redirect_to federails.client_actor_url(actor)
+ end
+
# PUT /app/followings/:id/accept
# PUT /app/followings/:id/accept.json
def accept
respond_to do |format|
url = federails.client_actor_url @following.actor
@@ -60,10 +68,10 @@
private
# Use callbacks to share common setup or constraints between actions.
def set_following
- @following = Following.find(params[:id])
+ @following = Following.find_param(params[:id])
authorize @following, policy_class: Federails::Client::FollowingPolicy
end
# Only allow a list of trusted parameters through.
def following_params