mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-15 01:53:09 -06:00
Refine SenderID/UserID usage
This commit is contained in:
parent
7cf96a865d
commit
b324f7eccc
|
|
@ -615,7 +615,12 @@ func (s *OutputRoomEventConsumer) notifyLocal(ctx context.Context, event *rstype
|
||||||
// evaluatePushRules fetches and evaluates the push rules of a local
|
// evaluatePushRules fetches and evaluates the push rules of a local
|
||||||
// user. Returns actions (including dont_notify).
|
// user. Returns actions (including dont_notify).
|
||||||
func (s *OutputRoomEventConsumer) evaluatePushRules(ctx context.Context, event *rstypes.HeaderedEvent, mem *localMembership, roomSize int) ([]*pushrules.Action, error) {
|
func (s *OutputRoomEventConsumer) evaluatePushRules(ctx context.Context, event *rstypes.HeaderedEvent, mem *localMembership, roomSize int) ([]*pushrules.Action, error) {
|
||||||
if event.SenderID() == mem.UserID {
|
user := ""
|
||||||
|
userID, err := event.UserID()
|
||||||
|
if err == nil {
|
||||||
|
user = userID.String()
|
||||||
|
}
|
||||||
|
if user == mem.UserID {
|
||||||
// SPEC: Homeservers MUST NOT notify the Push Gateway for
|
// SPEC: Homeservers MUST NOT notify the Push Gateway for
|
||||||
// events that the user has sent themselves.
|
// events that the user has sent themselves.
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
@ -767,7 +772,7 @@ func (s *OutputRoomEventConsumer) notifyHTTP(ctx context.Context, event *rstypes
|
||||||
ID: event.EventID(),
|
ID: event.EventID(),
|
||||||
RoomID: event.RoomID(),
|
RoomID: event.RoomID(),
|
||||||
RoomName: roomName,
|
RoomName: roomName,
|
||||||
Sender: event.SenderID(),
|
Sender: event.SenderID(), // TODO: Should push use UserIDs?
|
||||||
Type: event.Type(),
|
Type: event.Type(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue