I have a Phoenix web application and am using Absinthe for subscriptions that are triggered whenever a new Comment
is added to a Topic
. I am trying to send a subscription only if the user is a member of a topic, and otherwise not send something at all.
So far I've tried playing with config
as mentioned in the Subscription docs but it seems like that it is only executed when creating the subscription and not when it is triggered. I'm hoping it is something as simple as:
resolve fn comment, _, %{context: context} ->
if User.member_of?(context.user, commment.topic) do
{:ok, comment}
else
:noreply
end
end
For now, I'm just returning {:ok, nil}
but I'm hoping there is a better way to achieve this.