core: communicate group join rejection (#5661)

This commit is contained in:
spaced4ndy
2025-02-26 09:25:54 +00:00
committed by Evgeny Poberezkin
parent 511ff1d35c
commit f701ffa4e0
11 changed files with 246 additions and 57 deletions
+12
View File
@@ -844,6 +844,12 @@ data ChatResponse
| CRAppSettings {appSettings :: AppSettings}
| CRTimedAction {action :: String, durationMilliseconds :: Int64}
| CRCustomChatResponse {user_ :: Maybe User, response :: Text}
| CRTerminalEvent TerminalEvent
deriving (Show)
data TerminalEvent
= TEGroupLinkRejected {user :: User, groupInfo :: GroupInfo, groupRejectionReason :: GroupRejectionReason}
| TERejectingGroupJoinRequestMember {user :: User, groupInfo :: GroupInfo, member :: GroupMember, groupRejectionReason :: GroupRejectionReason}
deriving (Show)
data DeletedRcvQueue = DeletedRcvQueue
@@ -1491,6 +1497,10 @@ chatCmdError user = CRChatCmdError user . ChatError . CECommandError
throwChatError :: ChatErrorType -> CM a
throwChatError = throwError . ChatError
toViewTE :: TerminalEvent -> CM ()
toViewTE = toView . CRTerminalEvent
{-# INLINE toViewTE #-}
-- | Emit local events.
toView :: ChatResponse -> CM ()
toView = lift . toView'
@@ -1630,6 +1640,8 @@ $(JQ.deriveJSON (sumTypeJSON $ dropPrefix "RCSR") ''RemoteCtrlStopReason)
$(JQ.deriveJSON (sumTypeJSON $ dropPrefix "RHSR") ''RemoteHostStopReason)
$(JQ.deriveJSON (sumTypeJSON $ dropPrefix "TE") ''TerminalEvent)
$(JQ.deriveJSON (sumTypeJSON $ dropPrefix "CR") ''ChatResponse)
$(JQ.deriveFromJSON defaultJSON ''ArchiveConfig)