core: fix channel profile updates breaking link (#6762)

This commit is contained in:
spaced4ndy
2026-04-09 10:23:46 +00:00
committed by GitHub
parent 312e99b61d
commit 7194755f8d
3 changed files with 85 additions and 4 deletions
+5 -1
View File
@@ -1195,6 +1195,9 @@ sendHistory user gInfo@GroupInfo {membership} m@GroupMember {activeConn = Just c
where
descrEvent_ :: Maybe (ChatMsgEvent 'Json)
descrEvent_
-- in channels sendHistory runs on the relay, which cannot author XMsgNew (GRRelay < GRObserver);
-- the welcome message reaches new members via the channel link data instead
| useRelays' gInfo = Nothing
| m `supportsVersion` groupHistoryIncludeWelcomeVersion = do
let GroupInfo {groupProfile = GroupProfile {description}} = gInfo
fmap (\descr -> XMsgNew $ MCSimple $ extMsgContent (MCText descr) Nothing) description
@@ -1299,7 +1302,8 @@ setGroupLinkData nm user gInfo gLink = do
(conn, groupRelays) <- withFastStore $ \db ->
(,) <$> getGroupLinkConnection db vr user gInfo <*> liftIO (getConnectedGroupRelays db gInfo)
let (userLinkData, crClientData) = groupLinkData gInfo gLink groupRelays
sLnk <- shortenShortLink' . toShortGroupLink =<< withAgent (\a -> setConnShortLink a nm (aConnId conn) SCMContact userLinkData (Just crClientData))
tagShortLink = if useRelays' gInfo then toShortChannelLink else toShortGroupLink
sLnk <- shortenShortLink' . tagShortLink =<< withAgent (\a -> setConnShortLink a nm (aConnId conn) SCMContact userLinkData (Just crClientData))
withFastStore' $ \db -> setGroupLinkShortLink db gLink sLnk
setGroupLinkDataAsync :: User -> GroupInfo -> GroupLink -> CM ()
+4 -1
View File
@@ -3138,7 +3138,10 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
(ci, cInfo) <- saveRcvChatItemNoParse user cd msg brokerTs (CIRcvGroupEvent $ RGEGroupUpdated p')
groupMsgToView cInfo ci
createGroupFeatureChangedItems user cd CIRcvGroupFeature g g''
void $ forkIO $ void $ setGroupLinkData' NRMBackground user g''
-- in channels, link data is updated by the owner making the change in runUpdateGroupProfile;
-- other owners receiving the update do not refresh the same link
unless (useRelays' g'') $
void $ forkIO $ void $ setGroupLinkData' NRMBackground user g''
Just _ -> updateGroupPrefs_ msgSigned g m $ fromMaybe defaultBusinessGroupPrefs $ groupPreferences p'
pure $ Just DJSGroup {jobSpec = DJDeliveryJob {includePending = True}}