add user_id has option on posts query
This commit is contained in:
@@ -29,7 +29,7 @@ class PostsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def query_params
|
def query_params
|
||||||
params.permit(:scope, :terms)
|
params.permit(:scope, :terms, :user_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_params
|
def post_params
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class PostsQueryResolverService
|
|||||||
scope = Post.all
|
scope = Post.all
|
||||||
|
|
||||||
scope = scope.by_user_follows(current_user) if filter[:scope] == 'follows' && current_user
|
scope = scope.by_user_follows(current_user) if filter[:scope] == 'follows' && current_user
|
||||||
|
socpe = scope.where(filter[:user_id]) if filter[:user_id]
|
||||||
scope = filter_by_terms(scope) if filter[:terms]
|
scope = filter_by_terms(scope) if filter[:terms]
|
||||||
|
|
||||||
scope
|
scope
|
||||||
|
|||||||
Reference in New Issue
Block a user