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 Follow
person PersonId person PersonId
target FollowerSetId target FollowerSetId
manual Bool
UniqueFollow person target UniqueFollow person target
RemoteFollow RemoteFollow
actor RemoteActorId actor RemoteActorId
target FollowerSetId target FollowerSetId
manual Bool
UniqueRemoteFollow actor target UniqueRemoteFollow actor target

View file

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

View file

@ -259,6 +259,10 @@ changes =
, addFieldPrimRequired "Delivery" True "forwarding" , addFieldPrimRequired "Delivery" True "forwarding"
-- 66 -- 66
, addEntities model_2019_05_03 , 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)) migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))