DB: Allow actors to mark they've just been created by someone

This will be used for sending that someone a grant with Admin access
This commit is contained in:
Pere Lev 2023-06-19 11:38:25 +03:00
parent c838cece7b
commit 0bd2ca8d5d
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
5 changed files with 9 additions and 3 deletions

View file

@ -1136,7 +1136,7 @@ createPatchTrackerC (Entity pidUser personUser) senderActor maybeCap localRecips
insertLoom now name msummary obiidCreate repoID = do
actor@(Entity actorID _) <-
insertActor now name (fromMaybe "" msummary)
insertActor now name (fromMaybe "" msummary) (Just $ personActor personUser)
loomID <- insert Loom
{ loomNextTicket = 1
, loomActor = actorID
@ -1372,7 +1372,7 @@ createRepositoryC (Entity pidUser personUser) senderActor maybeCap localRecips r
insertRepo now name msummary createID = do
actor@(Entity actorID _) <-
insertActor now name (fromMaybe "" msummary)
insertActor now name (fromMaybe "" msummary) (Just $ personActor personUser)
repoID <- insert Repo
{ repoVcs = vcs
, repoProject = Nothing
@ -1635,6 +1635,7 @@ createTicketTrackerC (Entity pidUser personUser) senderActor maybeCap localRecip
, actorInbox = ibid
, actorOutbox = obid
, actorFollowers = fsid
, actorJustCreatedBy = Just $ personActor personUser
}
did <- insert Deck
{ deckActor = aid

View file

@ -666,6 +666,7 @@ instance AccountDB AccountPersistDB' where
, actorInbox = ibid
, actorOutbox = obid
, actorFollowers = fsid
, actorJustCreatedBy = Nothing
}
aid <- insert actor
let defTime = UTCTime (ModifiedJulianDay 0) 0

View file

@ -2954,6 +2954,8 @@ changes hLocal ctx =
, removeEntity "Role"
-- 539
, addFieldPrimRequired "Collab" ("RoleAdmin" :: String) "role"
-- 540
, addFieldRefOptional "Actor" Nothing "justCreatedBy" "Actor"
]
migrateDB

View file

@ -129,7 +129,7 @@ getRemoteActorURI actor = do
(instanceHost inztance)
(remoteObjectIdent object)
insertActor now name desc = do
insertActor now name desc mby = do
ibid <- insert Inbox
obid <- insert Outbox
fsid <- insert FollowerSet
@ -140,6 +140,7 @@ insertActor now name desc = do
, actorInbox = ibid
, actorOutbox = obid
, actorFollowers = fsid
, actorJustCreatedBy = mby
}
actorID <- insert actor
return $ Entity actorID actor

View file

@ -118,6 +118,7 @@ Actor
inbox InboxId
outbox OutboxId
followers FollowerSetId
justCreatedBy ActorId Maybe
UniqueActorInbox inbox
UniqueActorOutbox outbox