From 8935ecb3edd1c74044627090e81df33b66ad39f5 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Sat, 12 Mar 2022 21:32:42 +1300 Subject: [PATCH] Requests --- .gitattributes | 1 + .../classic/config/bonfire_boundaries.exs | 12 +++++++----- flavours/classic/config/bonfire_data.exs | 19 +++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..c9b0d48d60 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +mix.lock merge=binary \ No newline at end of file diff --git a/flavours/classic/config/bonfire_boundaries.exs b/flavours/classic/config/bonfire_boundaries.exs index 00ee0f68ed..1cd7c117f6 100755 --- a/flavours/classic/config/bonfire_boundaries.exs +++ b/flavours/classic/config/bonfire_boundaries.exs @@ -18,6 +18,7 @@ verbs = %{ mention: %{id: "0EFERENC1NGTH1NGSE1SEWHERE", verb: "Mention"}, # mention a user or object. tag: %{id: "4ATEG0R1S1NGNGR0VP1NGSTVFF", verb: "Tag"}, # tag a user or object in an object. message: %{id: "40NTACTW1THAPR1VATEMESSAGE", verb: "Message"}, # send a direct message to the user. + request: %{id: "1NEEDPERM1SS10NT0D0TH1SN0W", verb: "Request"}, # request to do another verb (eg. request to follow) } all_verb_names = Enum.map(verbs, &elem(&1, 0)) @@ -89,16 +90,17 @@ config :bonfire, ### (where values are assumed to be true). grants: %{ ### Public ACLs need their permissions filling out - guests_may_see_read: %{guest: [:read, :see]}, - guests_may_see: %{guest: [:read]}, - guests_may_read: %{guest: [:read]}, - locals_may_interact: %{local: [:read, :see, :mention, :tag, :boost, :flag, :like, :follow]}, - locals_may_reply: %{local: [:read, :see, :mention, :tag, :boost, :flag, :like, :follow, :reply]}, + guests_may_see_read: %{guest: [:read, :see, :request]}, + guests_may_see: %{guest: [:read, :request]}, + guests_may_read: %{guest: [:read, :request]}, + locals_may_interact: %{local: [:read, :see, :mention, :tag, :boost, :like, :follow, :request]}, # interact but not reply + locals_may_reply: %{local: [:read, :see, :mention, :tag, :boost, :like, :follow, :reply, :request]}, # interact and reply # TODO: are we doing this because of instance-wide blocking? nobody_can_anything: %{ghost_them: verbs_negative.(all_verb_names)}, nobody_can_reach: %{silence_them: verbs_negative.([:mention, :message, :reply])}, nobody_can_see: %{silence_me: verbs_negative.([:see])}, } +# end of global boundaries negative_grants = [ :nobody_can_anything, :nobody_can_reach, :nobody_can_see, # instance-wide negative permissions diff --git a/flavours/classic/config/bonfire_data.exs b/flavours/classic/config/bonfire_data.exs index 814437717c..510367e4b3 100755 --- a/flavours/classic/config/bonfire_data.exs +++ b/flavours/classic/config/bonfire_data.exs @@ -60,7 +60,7 @@ alias Bonfire.Data.Identity.{ } alias Bonfire.Data.Social.{ Activity, Article, Block, Bookmark, Created, Feed, FeedPublish, Message, Follow, - Boost, Like, Flag, Mention, Post, PostContent, Profile, Replied, + Boost, Like, Flag, Mention, Post, PostContent, Profile, Replied, Request } alias Bonfire.Classify.Category alias Bonfire.Geolocate.Geolocation @@ -81,10 +81,12 @@ alias Bonfire.{Tag, Tag.Tagged} edge = quote do has_many :controlled, unquote(Controlled), foreign_key: :id, references: :id has_many :activities, unquote(Activity), foreign_key: :object_id, references: :id + has_one :request, unquote(Request), foreign_key: :id, references: :id end edges = quote do unquote(edge) - # has_one :edge, unquote(Edge), foreign_key: :id + has_one :created, unquote(Created), foreign_key: :id + has_one :caretaker, unquote(Caretaker), foreign_key: :id has_one :activity, unquote(Activity), foreign_key: :object_id, references: :id # requires an ON clause end @@ -320,8 +322,6 @@ config :bonfire_data_social, FeedPublish, [] config :bonfire_data_social, Follow, [code: quote do - has_one :created, unquote(Created), foreign_key: :id - has_one :caretaker, unquote(Caretaker), foreign_key: :id unquote(edges) end] # belongs_to: [follower_character: {Character, foreign_key: :follower_id, define_field: false}], @@ -336,24 +336,23 @@ config :bonfire_data_social, Block, config :bonfire_data_social, Boost, [code: quote do - has_one :created, unquote(Created), foreign_key: :id - has_one :caretaker, unquote(Caretaker), foreign_key: :id unquote(edges) end] # has_one: [activity: {Activity, foreign_key: :object_id, references: :boosted_id}] # requires an ON clause config :bonfire_data_social, Like, [code: quote do - has_one :created, unquote(Created), foreign_key: :id - has_one :caretaker, unquote(Caretaker), foreign_key: :id unquote(edges) end] # has_one: [activity: {Activity, foreign_key: :object_id, references: :liked_id}] # requires an ON clause config :bonfire_data_social, Flag, [code: quote do - has_one :created, unquote(Created), foreign_key: :id - has_one :caretaker, unquote(Caretaker), foreign_key: :id + unquote(edges) + end] + +config :bonfire_data_social, Request, + [code: quote do unquote(edges) end]