From 871fba20a3ccd88a9c42c3ceeaab0d966fd0796c Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 20 Jan 2021 11:51:07 +1000 Subject: [PATCH] metadata-store: add permissions field --- pkg/arvo/lib/metadata-json.hoon | 11 +++++++++++ pkg/arvo/sur/metadata-store.hoon | 12 ++++++++++++ pkg/interface/src/logic/api/metadata.ts | 4 +++- pkg/interface/src/types/metadata-update.ts | 3 +++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/lib/metadata-json.hoon b/pkg/arvo/lib/metadata-json.hoon index d8784c41c4..a8ca48af31 100644 --- a/pkg/arvo/lib/metadata-json.hoon +++ b/pkg/arvo/lib/metadata-json.hoon @@ -53,6 +53,13 @@ ?> ?=([%s *] jon) (rash p.jon hex) :: + ++ permissions + %- su + ;~ pose + (tag %$) + (tag %reader-comments) + == + :: ++ metadata %- ot :~ [%title so] @@ -63,8 +70,11 @@ [%module so] [%picture so] [%preview bo] + [%permissions permissions] == :: + ++ tag |*(a=@tas (cold a (jest a))) + :: ++ md-resource ^- $-(json ^md-resource) %- ot @@ -86,6 +96,7 @@ [%module s+module.met] [%picture s+picture.met] [%preview b+preview.met] + [%permissions s+`@t`permissions.met] == :: ++ update-to-json diff --git a/pkg/arvo/sur/metadata-store.hoon b/pkg/arvo/sur/metadata-store.hoon index 08dc8ff8e5..1b49493023 100644 --- a/pkg/arvo/sur/metadata-store.hoon +++ b/pkg/arvo/sur/metadata-store.hoon @@ -18,6 +18,17 @@ :: +$ color @ux +$ url @t +:: +:: $permissions: tag identifying variation in permissions +:: +:: This will be passed to the graph-permissions mark +:: conversion to allow for custom permissions. +:: +:: %reader-comments: Allow readers to comment, regardless +:: of whether they can write. +:: %$: No variation +:: ++$ permissions ?(%reader-comments %$) +$ metadata $: title=cord description=cord @@ -27,6 +38,7 @@ module=term picture=url preview=? + =permissions == :: +$ metadata-action diff --git a/pkg/interface/src/logic/api/metadata.ts b/pkg/interface/src/logic/api/metadata.ts index f82c3cb24a..993c85ea59 100644 --- a/pkg/interface/src/logic/api/metadata.ts +++ b/pkg/interface/src/logic/api/metadata.ts @@ -22,7 +22,9 @@ export default class MetadataApi extends BaseApi { color, 'date-created': dateCreated, creator, - 'module': moduleName + 'module': moduleName, + preview: false, + permissions: '' } } }); diff --git a/pkg/interface/src/types/metadata-update.ts b/pkg/interface/src/types/metadata-update.ts index 5774fe4edc..4aff129d5b 100644 --- a/pkg/interface/src/types/metadata-update.ts +++ b/pkg/interface/src/types/metadata-update.ts @@ -62,4 +62,7 @@ export interface Metadata { module: string; url: string; preview: boolean; + permissions: Permissions; } + +export type Permissions = '' | 'reader-comments';