mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-14 18:33:09 -06:00
Update gomatrixserverlib and use Unsigned AS event prop
This commit is contained in:
parent
c341415b07
commit
db2e40cac9
|
|
@ -174,9 +174,12 @@ func retrieveEvents(eventRows *sql.Rows) (events []gomatrixserverlib.Application
|
||||||
maxID = id
|
maxID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Portion of the event that is unsigned due to rapid change
|
||||||
|
event.Unsigned = gomatrixserverlib.ApplicationServiceUnsigned{
|
||||||
// Get age of the event from original timestamp and current time
|
// Get age of the event from original timestamp and current time
|
||||||
// TODO: Consider removing age as not many app services use it
|
// TODO: Consider removing age as not many app services use it
|
||||||
event.Age = nowMilli - event.OriginServerTimestamp
|
Age: nowMilli - event.OriginServerTimestamp,
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Synapse does this. It's unnecessary to send Sender and UserID as the
|
// TODO: Synapse does this. It's unnecessary to send Sender and UserID as the
|
||||||
// same value. Do app services really require this? :)
|
// same value. Do app services really require this? :)
|
||||||
|
|
|
||||||
2
vendor/manifest
vendored
2
vendor/manifest
vendored
|
|
@ -135,7 +135,7 @@
|
||||||
{
|
{
|
||||||
"importpath": "github.com/matrix-org/gomatrixserverlib",
|
"importpath": "github.com/matrix-org/gomatrixserverlib",
|
||||||
"repository": "https://github.com/matrix-org/gomatrixserverlib",
|
"repository": "https://github.com/matrix-org/gomatrixserverlib",
|
||||||
"revision": "38a4f0f648bf357adc4bdb601cdc0535cee14e21",
|
"revision": "4c45af876608399b13cf891e2d9f89f01c67137a",
|
||||||
"branch": "master"
|
"branch": "master"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,16 @@
|
||||||
|
|
||||||
package gomatrixserverlib
|
package gomatrixserverlib
|
||||||
|
|
||||||
|
// ApplicationServiceUnsigned is the contents of the unsigned field of an
|
||||||
|
// ApplicationServiceEvent.
|
||||||
|
type ApplicationServiceUnsigned struct {
|
||||||
|
Age int64 `json:"age,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// ApplicationServiceEvent is an event format that is sent off to an
|
// ApplicationServiceEvent is an event format that is sent off to an
|
||||||
// application service as part of a transaction.
|
// application service as part of a transaction.
|
||||||
type ApplicationServiceEvent struct {
|
type ApplicationServiceEvent struct {
|
||||||
Age int64 `json:"age,omitempty"`
|
Unsigned ApplicationServiceUnsigned `json:"unsigned,omitempty"`
|
||||||
Content RawJSON `json:"content,omitempty"`
|
Content RawJSON `json:"content,omitempty"`
|
||||||
EventID string `json:"event_id,omitempty"`
|
EventID string `json:"event_id,omitempty"`
|
||||||
OriginServerTimestamp int64 `json:"origin_server_ts,omitempty"`
|
OriginServerTimestamp int64 `json:"origin_server_ts,omitempty"`
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,9 @@ func newPowerLevelContentFromAuthEvents(authEvents AuthEventProvider, creatorUse
|
||||||
// If there is no power level event then the creator gets level 100
|
// If there is no power level event then the creator gets level 100
|
||||||
// https://github.com/matrix-org/synapse/blob/v0.18.5/synapse/api/auth.py#L569
|
// https://github.com/matrix-org/synapse/blob/v0.18.5/synapse/api/auth.py#L569
|
||||||
c.userLevels = map[string]int64{creatorUserID: 100}
|
c.userLevels = map[string]int64{creatorUserID: 100}
|
||||||
|
// If there is no power level event then the state_default is level 0
|
||||||
|
// https://github.com/matrix-org/synapse/blob/v0.18.5/synapse/api/auth.py#L997
|
||||||
|
c.stateDefaultLevel = 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@ type RespState struct {
|
||||||
AuthEvents []Event `json:"auth_chain"`
|
AuthEvents []Event `json:"auth_chain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A RespEventAuth is the content of a response to GET /_matrix/federation/v1/event_auth/{roomID}/{eventID}
|
||||||
|
type RespEventAuth struct {
|
||||||
|
// A list of events needed to authenticate the state events.
|
||||||
|
AuthEvents []Event `json:"auth_chain"`
|
||||||
|
}
|
||||||
|
|
||||||
// Events combines the auth events and the state events and returns
|
// Events combines the auth events and the state events and returns
|
||||||
// them in an order where every event comes after its auth events.
|
// them in an order where every event comes after its auth events.
|
||||||
// Each event will only appear once in the output list.
|
// Each event will only appear once in the output list.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue