Skip to content

Commit 7deb77d

Browse files
authored
fix bug in reactions unmarshaling (#27)
1 parent f60e867 commit 7deb77d

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44

55
## Added
66

7-
- `Account.SetUiConfig()`, `Account.GetUiConfig()`, `Bot.SetUiConfig()` and `Bot.GetUiConfig()`
7+
- `Bot.SetUiConfig()` and `Bot.GetUiConfig()`
8+
- new `MsgType`: `MsgVcard`
89

910
### Changed
1011

11-
- dependencies: upgrade jrpc2 to version v1.0.0
12+
- dependencies: upgrade jrpc2 to version v1.1.2
1213
- breaking: `EventHandler` and `NewMsgHandler` now have an extra parameter "bot"
13-
- breaking: retrieve events via long polling (added to JSON-RPC server in: https://github.com/deltachat/deltachat-core-rust/pull/4341/)
14-
- breaking: minimum Delta Chat core version required v1.114.0
14+
- breaking: retrieve events via long polling (added to JSON-RPC server in: https://github.com/chatmail/core/pull/4341/)
15+
- breaking: minimum Chatmail core version required: 2.14.0
16+
- breaking: required golang version: 1.25
1517

1618
### Fixed
1719

18-
- fix `Account.SetAvatar()`, allow to discard avatar
20+
- fix `Reactions` type
1921

2022
## v0.17.0
2123

deltachat/rpc_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,3 +474,30 @@ func TestChat_Groups(t *testing.T) {
474474
assert.Nil(t, err)
475475
})
476476
}
477+
478+
func TestMsg_Reactions(t *testing.T) {
479+
t.Parallel()
480+
acfactory.WithOnlineAccount(func(rpc *Rpc, accId AccountId) {
481+
chatId, err := rpc.CreateGroupChat(accId, "test group", false)
482+
require.Nil(t, err)
483+
484+
var msgId MsgId
485+
msgId, err = rpc.SendMsg(accId, chatId, MsgData{Text: "test message"})
486+
require.Nil(t, err)
487+
488+
_, err = rpc.SendReaction(accId, msgId, ":)")
489+
require.Nil(t, err)
490+
491+
data, err2 := rpc.GetMessageReactions(accId, msgId)
492+
require.Nil(t, err2)
493+
reactions := data.Unwrap().Reactions
494+
require.Len(t, reactions, 1)
495+
require.Equal(t, reactions[0].Emoji, ":)")
496+
497+
msg, err := rpc.GetMessage(accId, msgId)
498+
require.Nil(t, err)
499+
reactions = msg.Reactions.Reactions
500+
require.Len(t, reactions, 1)
501+
require.Equal(t, reactions[0].Emoji, ":)")
502+
})
503+
}

deltachat/types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,13 @@ type WebxdcMsgInfo struct {
206206
InternetAccess bool
207207
}
208208

209+
type Reaction struct {
210+
Emoji string
211+
Count uint32
212+
IsFromSelf bool
213+
}
214+
209215
type Reactions struct {
210216
ReactionsByContact map[ContactId][]string
211-
Reactions map[string]int // Unique reactions and their count
217+
Reactions []Reaction
212218
}

scripts/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fi
2424
if ! command -v deltachat-rpc-server &> /dev/null
2525
then
2626
echo "deltachat-rpc-server not found, installing..."
27-
curl -L https://github.com/deltachat/deltachat-core-rust/releases/latest/download/deltachat-rpc-server-x86_64-linux --output deltachat-rpc-server
27+
curl -L https://github.com/chatmail/core/releases/download/v2.14.0/deltachat-rpc-server-x86_64-linux --output deltachat-rpc-server
2828
chmod +x deltachat-rpc-server
2929
export PATH=`pwd`:"$PATH"
3030
fi

0 commit comments

Comments
 (0)