core: do not create group history item (#3586)

* core: do not create group history item

* fix tests
This commit is contained in:
Evgeny Poberezkin 2023-12-23 19:56:01 +00:00 committed by GitHub
parent b8cb954882
commit 2834b192ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View file

@ -4783,7 +4783,7 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
createGroupFeatureItems :: GroupInfo -> GroupMember -> m () createGroupFeatureItems :: GroupInfo -> GroupMember -> m ()
createGroupFeatureItems g@GroupInfo {fullGroupPreferences} m = createGroupFeatureItems g@GroupInfo {fullGroupPreferences} m =
forM_ allGroupFeatures $ \(AGF f) -> do forM_ allGroupFeatureItems $ \(AGF f) -> do
let p = getGroupPreference f fullGroupPreferences let p = getGroupPreference f fullGroupPreferences
(_, param) = groupFeatureState p (_, param) = groupFeatureState p
createInternalChatItem user (CDGroupRcv g m) (CIRcvGroupFeature (toGroupFeature f) (toGroupPreference p) param) Nothing createInternalChatItem user (CDGroupRcv g m) (CIRcvGroupFeature (toGroupFeature f) (toGroupPreference p) param) Nothing
@ -5986,7 +5986,7 @@ createFeatureItems user Contact {mergedPreferences = cups} ct'@Contact {mergedPr
createGroupFeatureChangedItems :: (MsgDirectionI d, ChatMonad m) => User -> ChatDirection 'CTGroup d -> (GroupFeature -> GroupPreference -> Maybe Int -> CIContent d) -> GroupInfo -> GroupInfo -> m () createGroupFeatureChangedItems :: (MsgDirectionI d, ChatMonad m) => User -> ChatDirection 'CTGroup d -> (GroupFeature -> GroupPreference -> Maybe Int -> CIContent d) -> GroupInfo -> GroupInfo -> m ()
createGroupFeatureChangedItems user cd ciContent GroupInfo {fullGroupPreferences = gps} GroupInfo {fullGroupPreferences = gps'} = createGroupFeatureChangedItems user cd ciContent GroupInfo {fullGroupPreferences = gps} GroupInfo {fullGroupPreferences = gps'} =
forM_ allGroupFeatures $ \(AGF f) -> do forM_ allGroupFeatureItems $ \(AGF f) -> do
let state = groupFeatureState $ getGroupPreference f gps let state = groupFeatureState $ getGroupPreference f gps
pref' = getGroupPreference f gps' pref' = getGroupPreference f gps'
state'@(_, int') = groupFeatureState pref' state'@(_, int') = groupFeatureState pref'

View file

@ -184,17 +184,19 @@ groupFeatureAllowed' :: GroupFeatureI f => SGroupFeature f -> FullGroupPreferenc
groupFeatureAllowed' feature prefs = groupFeatureAllowed' feature prefs =
getField @"enable" (getGroupPreference feature prefs) == FEOn getField @"enable" (getGroupPreference feature prefs) == FEOn
allGroupFeatures :: [AGroupFeature] allGroupFeatureItems :: [AGroupFeature]
allGroupFeatures = allGroupFeatureItems =
[ AGF SGFTimedMessages, [ AGF SGFTimedMessages,
AGF SGFDirectMessages, AGF SGFDirectMessages,
AGF SGFFullDelete, AGF SGFFullDelete,
AGF SGFReactions, AGF SGFReactions,
AGF SGFVoice, AGF SGFVoice,
AGF SGFFiles, AGF SGFFiles
AGF SGFHistory
] ]
allGroupFeatures :: [AGroupFeature]
allGroupFeatures = allGroupFeatureItems <> [AGF SGFHistory]
groupPrefSel :: SGroupFeature f -> GroupPreferences -> Maybe (GroupFeaturePreference f) groupPrefSel :: SGroupFeature f -> GroupPreferences -> Maybe (GroupFeaturePreference f)
groupPrefSel f ps = case f of groupPrefSel f ps = case f of
SGFTimedMessages -> ps.timedMessages SGFTimedMessages -> ps.timedMessages

View file

@ -221,8 +221,8 @@ groupFeatures'' =
((0, "Full deletion: off"), Nothing, Nothing), ((0, "Full deletion: off"), Nothing, Nothing),
((0, "Message reactions: on"), Nothing, Nothing), ((0, "Message reactions: on"), Nothing, Nothing),
((0, "Voice messages: on"), Nothing, Nothing), ((0, "Voice messages: on"), Nothing, Nothing),
((0, "Files and media: on"), Nothing, Nothing), ((0, "Files and media: on"), Nothing, Nothing)
((0, "Recent history: on"), Nothing, Nothing) -- ((0, "Recent history: on"), Nothing, Nothing)
] ]
itemId :: Int -> String itemId :: Int -> String