mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 16:13:10 -06:00
Refresh dendrite subtree - pull changes for appservice bug (#457)
Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
This commit is contained in:
parent
6275dd0b25
commit
55341ef3cf
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -53,6 +53,7 @@ _testmain.go
|
|||
|
||||
# Default configuration file
|
||||
dendrite.yaml
|
||||
zion-appservice.yaml
|
||||
|
||||
# Database files
|
||||
*.db
|
||||
|
|
|
|||
|
|
@ -173,13 +173,14 @@ func (s *OutputRoomEventConsumer) sendEvents(
|
|||
return err
|
||||
}
|
||||
|
||||
// TODO: We should probably be more intelligent and pick something not
|
||||
// in the control of the event. A NATS timestamp header or something maybe.
|
||||
txnID := events[0].Event.OriginServerTS()
|
||||
// If the number of items in the array is different,
|
||||
// then this should be treated as a different transaction. Incorporate the length
|
||||
// of events into the transaction ID.
|
||||
txnID := fmt.Sprintf("%d_%d", events[0].Event.OriginServerTS(), len(transaction))
|
||||
|
||||
// Send the transaction to the appservice.
|
||||
// https://matrix.org/docs/spec/application_service/r0.1.2#put-matrix-app-v1-transactions-txnid
|
||||
address := fmt.Sprintf("%s/transactions/%d?access_token=%s", state.URL, txnID, url.QueryEscape(state.HSToken))
|
||||
address := fmt.Sprintf("%s/transactions/%s?access_token=%s", state.URL, txnID, url.QueryEscape(state.HSToken))
|
||||
req, err := http.NewRequestWithContext(ctx, "PUT", address, bytes.NewBuffer(transaction))
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue