mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-04 03:08:14 +00:00
core: remember new origin for received forwarded messages (#4032)
This commit is contained in:
+5
-3
@@ -930,10 +930,12 @@ processChatCommand' vr = \case
|
||||
forwardMC ChatItem {content = CIRcvMsgContent fmc} = pure (fmc, MDRcv)
|
||||
forwardMC _ = throwChatError CEInvalidForward
|
||||
forwardCIFF :: ChatItem c d -> Maybe CIForwardedFrom -> Maybe CIForwardedFrom
|
||||
forwardCIFF ChatItem {meta = CIMeta {itemForwarded = Just ciff}} _ = Just ciff
|
||||
forwardCIFF _ ciff = ciff
|
||||
forwardCIFF ChatItem {meta = CIMeta {itemForwarded}} ciff = case itemForwarded of
|
||||
Nothing -> ciff
|
||||
Just CIFFUnknown -> ciff
|
||||
Just prevCIFF -> Just prevCIFF
|
||||
forwardCryptoFile :: ChatItem c d -> CM (Maybe CryptoFile)
|
||||
forwardCryptoFile ChatItem {file = Just CIFile {fileName, fileStatus, fileSource = Just fromCF@CryptoFile {filePath, cryptoArgs = fromArgs}}}
|
||||
forwardCryptoFile ChatItem {file = Just CIFile {fileName, fileStatus, fileSource = Just fromCF@CryptoFile {filePath}}}
|
||||
| ciFileLoaded fileStatus =
|
||||
chatReadVar filesFolder >>= \case
|
||||
Nothing ->
|
||||
|
||||
@@ -24,6 +24,7 @@ chatForwardTests = do
|
||||
it "from notes to notes" testForwardNotesToNotes -- TODO forward between different folders when supported
|
||||
describe "interactions with forwarded messages" $ do
|
||||
it "preserve original forward info" testForwardPreserveInfo
|
||||
it "received forwarded message is saved with new forward info" testForwardRcvMsgNewInfo
|
||||
it "quoted message is not included" testForwardQuotedMsg
|
||||
it "editing is prohibited" testForwardEditProhibited
|
||||
it "delete for other" testForwardDeleteForOther
|
||||
@@ -276,6 +277,34 @@ testForwardPreserveInfo =
|
||||
dan <# "#team alice> -> forwarded"
|
||||
dan <## " hey"
|
||||
|
||||
testForwardRcvMsgNewInfo :: HasCallStack => FilePath -> IO ()
|
||||
testForwardRcvMsgNewInfo =
|
||||
testChat4 aliceProfile bobProfile cathProfile danProfile $
|
||||
\alice bob cath dan -> do
|
||||
connectUsers bob dan
|
||||
createCCNoteFolder alice
|
||||
connectUsers alice bob
|
||||
connectUsers alice cath
|
||||
|
||||
dan #> "@bob hey"
|
||||
bob <# "dan> hey"
|
||||
|
||||
bob `send` "@alice <- @dan hey"
|
||||
bob <# "@alice <- @dan"
|
||||
bob <## " hey"
|
||||
alice <# "bob> -> forwarded"
|
||||
alice <## " hey"
|
||||
|
||||
alice `send` "* <- @bob hey"
|
||||
alice <# "* <- @bob"
|
||||
alice <## " hey"
|
||||
|
||||
alice `send` "@cath <- * hey"
|
||||
alice <# "@cath <- @bob"
|
||||
alice <## " hey"
|
||||
cath <# "alice> -> forwarded"
|
||||
cath <## " hey"
|
||||
|
||||
testForwardQuotedMsg :: HasCallStack => FilePath -> IO ()
|
||||
testForwardQuotedMsg =
|
||||
testChat3 aliceProfile bobProfile cathProfile $
|
||||
|
||||
Reference in New Issue
Block a user