WIP notification settings

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-06-01 18:08:03 +02:00
parent 6adbbc6a1d
commit 58bffc5c66
34 changed files with 1127 additions and 136 deletions

View File

@@ -50,6 +50,10 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
field(:updated_at, :datetime, description: "When was the comment updated")
field(:deleted_at, :datetime, description: "When was the comment deleted")
field(:published_at, :datetime, description: "When was the comment published")
field(:is_announcement, non_null(:boolean),
description: "Whether this comment needs to be announced to participants"
)
end
@desc "The list of visibility options for a comment"
@@ -86,6 +90,8 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
arg(:event_id, non_null(:id), description: "The event under which this comment is")
arg(:in_reply_to_comment_id, :id, description: "The comment ID this one replies to")
arg(:is_announcement, :boolean, description: "Should this comment be announced to everyone?")
resolve(&Comment.create_comment/3)
end
@@ -94,6 +100,8 @@ defmodule Mobilizon.GraphQL.Schema.Discussions.CommentType do
arg(:text, non_null(:string), description: "The comment updated body")
arg(:comment_id, non_null(:id), description: "The comment ID")
arg(:is_announcement, :boolean, description: "Should this comment be announced to everyone?")
resolve(&Comment.update_comment/3)
end

View File

@@ -8,6 +8,7 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
alias Mobilizon.Events
alias Mobilizon.GraphQL.Resolvers.{Media, User}
alias Mobilizon.GraphQL.Resolvers.Users.ActivitySettings
alias Mobilizon.GraphQL.Schema
import_types(Schema.SortType)
@@ -131,6 +132,11 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
resolve: &Media.user_size/3,
description: "The total size of all the media from this user (from all their actors)"
)
field(:activity_settings, list_of(:activity_setting),
resolve: &ActivitySettings.user_activity_settings/3,
description: "The user's activity settings"
)
end
@desc "The list of roles an user can have"

View File

@@ -0,0 +1,23 @@
defmodule Mobilizon.GraphQL.Schema.Users.ActivitySetting do
@moduledoc """
Schema representation for PushSubscription
"""
use Absinthe.Schema.Notation
alias Mobilizon.GraphQL.Resolvers.Users.ActivitySettings
object :activity_setting do
field(:key, :string)
field(:method, :string)
field(:enabled, :boolean)
field(:user, :user)
end
object :activity_setting_mutations do
field :update_activity_setting, :activity_setting do
arg(:key, non_null(:string))
arg(:method, non_null(:string))
arg(:enabled, non_null(:boolean))
resolve(&ActivitySettings.upsert_user_activity_setting/3)
end
end
end