Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appservice/consumers/roomserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (s *OutputRoomEventConsumer) sendEvents(

// If txnID is not defined, generate one from the events.
if txnID == "" {
txnID = fmt.Sprintf("%d_%d", events[0].PDU.OriginServerTS(), len(transaction))
txnID = fmt.Sprintf("%d_%d", events[0].OriginServerTS(), len(transaction))
}

// Send the transaction to the appservice.
Expand Down
4 changes: 2 additions & 2 deletions clientapi/auth/login_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func (t *LoginTypeToken) LoginFromJSON(ctx context.Context, reqBytes []byte) (*L
}
}

r.Login.Identifier.Type = "m.id.user"
r.Login.Identifier.User = res.Data.UserID
r.Identifier.Type = "m.id.user"
r.Identifier.User = res.Data.UserID

cleanup := func(ctx context.Context, authRes *util.JSONResponse) {
if authRes == nil {
Expand Down
4 changes: 2 additions & 2 deletions federationapi/routing/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func GetUserDevices(

for _, dev := range res.Devices {
var key fclient.RespUserDeviceKeys
err := json.Unmarshal(dev.DeviceKeys.KeyJSON, &key)
err := json.Unmarshal(dev.KeyJSON, &key)
if err != nil {
util.GetLogger(req.Context()).WithError(err).Warnf("malformed device key: %s", string(dev.DeviceKeys.KeyJSON))
util.GetLogger(req.Context()).WithError(err).Warnf("malformed device key: %s", string(dev.KeyJSON))
continue
}

Expand Down
2 changes: 1 addition & 1 deletion federationapi/routing/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestHandleQueryProfile(t *testing.T) {
fedMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicFederationPathPrefix).Subrouter().UseEncodedPath()
natsInstance := jetstream.NATSInstance{}
routers.Federation = fedMux
cfg.FederationAPI.Matrix.SigningIdentity.ServerName = testOrigin
cfg.FederationAPI.Matrix.ServerName = testOrigin
cfg.FederationAPI.Matrix.Metrics.Enabled = false
fedClient := fakeFedClient{}
serverKeyAPI := &signing.YggdrasilKeys{}
Expand Down
2 changes: 1 addition & 1 deletion federationapi/routing/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestHandleQueryDirectory(t *testing.T) {
fedMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicFederationPathPrefix).Subrouter().UseEncodedPath()
natsInstance := jetstream.NATSInstance{}
routers.Federation = fedMux
cfg.FederationAPI.Matrix.SigningIdentity.ServerName = testOrigin
cfg.FederationAPI.Matrix.ServerName = testOrigin
cfg.FederationAPI.Matrix.Metrics.Enabled = false
fedClient := fakeFedClient{}
serverKeyAPI := &signing.YggdrasilKeys{}
Expand Down
2 changes: 1 addition & 1 deletion federationapi/routing/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestHandleSend(t *testing.T) {
fedMux := mux.NewRouter().SkipClean(true).PathPrefix(httputil.PublicFederationPathPrefix).Subrouter().UseEncodedPath()
natsInstance := jetstream.NATSInstance{}
routers.Federation = fedMux
cfg.FederationAPI.Matrix.SigningIdentity.ServerName = testOrigin
cfg.FederationAPI.Matrix.ServerName = testOrigin
cfg.FederationAPI.Matrix.Metrics.Enabled = false
fedapi := fedAPI.NewInternalAPI(processCtx, cfg, cm, &natsInstance, nil, nil, nil, nil, true)
serverKeyAPI := &signing.YggdrasilKeys{}
Expand Down
4 changes: 2 additions & 2 deletions roomserver/internal/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (r *RoomserverInternalAPI) SetFederationAPI(fsAPI fsAPI.RoomserverFederatio
RSAPI: r,
}

if err := r.Inputer.Start(); err != nil {
if err := r.Start(); err != nil {
logrus.WithError(err).Panic("failed to start roomserver input API")
}
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func (r *RoomserverInternalAPI) StateQuerier() gomatrixserverlib.StateQuerier {
func (r *RoomserverInternalAPI) HandleInvite(
ctx context.Context, inviteEvent *types.HeaderedEvent,
) error {
outputEvents, err := r.Inviter.ProcessInviteMembership(ctx, inviteEvent)
outputEvents, err := r.ProcessInviteMembership(ctx, inviteEvent)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions roomserver/internal/perform/perform_invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (q *QueryState) GetAuthEvents(ctx context.Context, event gomatrixserverlib.
}

func (q *QueryState) GetState(ctx context.Context, roomID spec.RoomID, stateWanted []gomatrixserverlib.StateKeyTuple) ([]gomatrixserverlib.PDU, error) {
info, err := q.Database.RoomInfo(ctx, roomID.String())
info, err := q.RoomInfo(ctx, roomID.String())
if err != nil {
return nil, fmt.Errorf("failed to load RoomInfo: %w", err)
}
Expand All @@ -55,7 +55,7 @@ func (q *QueryState) GetState(ctx context.Context, roomID spec.RoomID, stateWant
for _, stateNID := range stateEntries {
stateNIDs = append(stateNIDs, stateNID.EventNID)
}
stateEvents, err := q.Database.Events(ctx, info.RoomVersion, stateNIDs)
stateEvents, err := q.Events(ctx, info.RoomVersion, stateNIDs)
if err != nil {
return nil, fmt.Errorf("failed to obtain required events: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion roomserver/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ func (v *StateResolution) loadStateEvents(
panic(fmt.Errorf("corrupt DB: Missing event numeric ID %d", entry.EventNID))
}
result = append(result, event.PDU)
eventIDMap[event.PDU.EventID()] = entry
eventIDMap[event.EventID()] = entry
v.events[entry.EventNID] = event.PDU
}
return result, eventIDMap, nil
Expand Down
2 changes: 1 addition & 1 deletion roomserver/types/headered_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (h *HeaderedEvent) CacheCost() int {
}

func (h *HeaderedEvent) MarshalJSON() ([]byte, error) {
return h.PDU.ToHeaderedJSON()
return h.ToHeaderedJSON()
}

func (j *HeaderedEvent) UnmarshalJSON(data []byte) error {
Expand Down
14 changes: 7 additions & 7 deletions userapi/internal/user_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,20 +836,20 @@ func (a *UserInternalAPI) QueryNotifications(ctx context.Context, req *api.Query
func (a *UserInternalAPI) PerformPusherSet(ctx context.Context, req *api.PerformPusherSetRequest, res *struct{}) error {
util.GetLogger(ctx).WithFields(logrus.Fields{
"localpart": req.Localpart,
"pushkey": req.Pusher.PushKey,
"display_name": req.Pusher.AppDisplayName,
"pushkey": req.PushKey,
"display_name": req.AppDisplayName,
}).Info("PerformPusherCreation")
if !req.Append {
err := a.DB.RemovePushers(ctx, req.Pusher.AppID, req.Pusher.PushKey)
err := a.DB.RemovePushers(ctx, req.AppID, req.PushKey)
if err != nil {
return err
}
}
if req.Pusher.Kind == "" {
return a.DB.RemovePusher(ctx, req.Pusher.AppID, req.Pusher.PushKey, req.Localpart, req.ServerName)
if req.Kind == "" {
return a.DB.RemovePusher(ctx, req.AppID, req.PushKey, req.Localpart, req.ServerName)
}
if req.Pusher.PushKeyTS == 0 {
req.Pusher.PushKeyTS = int64(time.Now().Unix())
if req.PushKeyTS == 0 {
req.PushKeyTS = int64(time.Now().Unix())
}
return a.DB.UpsertPusher(ctx, req.Pusher, req.Localpart, req.ServerName)
}
Expand Down