mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23: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
|
||||
}
|
||||
|
||||
// Get age of the event from original timestamp and current time
|
||||
// TODO: Consider removing age as not many app services use it
|
||||
event.Age = nowMilli - event.OriginServerTimestamp
|
||||
// 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
|
||||
// TODO: Consider removing age as not many app services use it
|
||||
Age: nowMilli - event.OriginServerTimestamp,
|
||||
}
|
||||
|
||||
// TODO: Synapse does this. It's unnecessary to send Sender and UserID as the
|
||||
// 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",
|
||||
"repository": "https://github.com/matrix-org/gomatrixserverlib",
|
||||
"revision": "38a4f0f648bf357adc4bdb601cdc0535cee14e21",
|
||||
"revision": "4c45af876608399b13cf891e2d9f89f01c67137a",
|
||||
"branch": "master"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,17 +15,23 @@
|
|||
|
||||
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
|
||||
// application service as part of a transaction.
|
||||
type ApplicationServiceEvent struct {
|
||||
Age int64 `json:"age,omitempty"`
|
||||
Content RawJSON `json:"content,omitempty"`
|
||||
EventID string `json:"event_id,omitempty"`
|
||||
OriginServerTimestamp int64 `json:"origin_server_ts,omitempty"`
|
||||
RoomID string `json:"room_id,omitempty"`
|
||||
Sender string `json:"sender,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
Unsigned ApplicationServiceUnsigned `json:"unsigned,omitempty"`
|
||||
Content RawJSON `json:"content,omitempty"`
|
||||
EventID string `json:"event_id,omitempty"`
|
||||
OriginServerTimestamp int64 `json:"origin_server_ts,omitempty"`
|
||||
RoomID string `json:"room_id,omitempty"`
|
||||
Sender string `json:"sender,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationServiceTransaction is the transaction that is sent off to an
|
||||
|
|
|
|||
|
|
@ -261,6 +261,9 @@ func newPowerLevelContentFromAuthEvents(authEvents AuthEventProvider, creatorUse
|
|||
// 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
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ type RespState struct {
|
|||
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
|
||||
// them in an order where every event comes after its auth events.
|
||||
// Each event will only appear once in the output list.
|
||||
|
|
|
|||
Loading…
Reference in a new issue