1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-28 13:04:54 +09:00

When project receives remote ticket comment, add author to followers

This commit is contained in:
fr33domlover 2019-05-03 23:55:49 +00:00
parent 5770c62692
commit f6eaca2fa8
3 changed files with 12 additions and 4 deletions

View file

@ -130,12 +130,14 @@ FollowerSet
Follow
person PersonId
target FollowerSetId
manual Bool
UniqueFollow person target
RemoteFollow
actor RemoteActorId
target FollowerSetId
manual Bool
UniqueRemoteFollow actor target

View file

@ -731,7 +731,7 @@ handleProjectInbox now shrRecip prjRecip iidSender hSender raidSender body raw a
mremotesHttp <- runDBExcept $ do
(sid, fsid, jid, did, meparent) <- getContextAndParent num mparent
lift $ join <$> do
mmid <- insertToDiscussion luNote published did meparent
mmid <- insertToDiscussion luNote published did meparent fsid
for mmid $ \ (ractid, mid) -> do
updateOrphans luNote did mid
for msig $ \ sig -> do
@ -808,7 +808,7 @@ handleProjectInbox now shrRecip prjRecip iidSender hSender raidSender body raw a
return mid
Nothing -> return $ Right $ l2f hParent luParent
return (sid, ticketFollowers t, jid, did, meparent)
insertToDiscussion luNote published did meparent = do
insertToDiscussion luNote published did meparent fsid = do
ractid <- either entityKey id <$> insertBy' RemoteActivity
{ remoteActivityInstance = iidSender
, remoteActivityIdent = activityId activity
@ -839,7 +839,9 @@ handleProjectInbox now shrRecip prjRecip iidSender hSender raidSender body raw a
Nothing -> do
delete mid
return Nothing
Just _ -> return $ Just (ractid, mid)
Just _ -> do
insertUnique_ $ RemoteFollow raidSender fsid False
return $ Just (ractid, mid)
updateOrphans luNote did mid = do
let uNote = l2f hSender luNote
related <- selectOrphans uNote (E.==.)
@ -1088,7 +1090,7 @@ handleOutboxNote host (Note mluNote luAttrib aud muParent muContext mpublished c
unless (messageRoot m == did) $
throwE "Remote parent belongs to a different discussion"
return mid
lift $ insertUnique_ $ Follow pid (ticketFollowers t)
lift $ insertUnique_ $ Follow pid (ticketFollowers t) False
return (did, Left <$> mmidParent, Just (sid, ticketFollowers t))
Nothing -> do
(rd, rdnew) <- lift $ do

View file

@ -259,6 +259,10 @@ changes =
, addFieldPrimRequired "Delivery" True "forwarding"
-- 66
, addEntities model_2019_05_03
-- 67
, addFieldPrimRequired "Follow" False "manual"
-- 68
, addFieldPrimRequired "RemoteFollow" False "manual"
]
migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))