aboutsummaryrefslogtreecommitdiff
path: root/userapi/util
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-11-11 16:41:37 +0000
committerGitHub <noreply@github.com>2022-11-11 16:41:37 +0000
commit529df30b5649e67a2f98114e6640d259cba53566 (patch)
treebcb994ce79916f14c9a11cd11f32063411332585 /userapi/util
parente177e0ae73d7cc34ffb9869681a6bf177f805205 (diff)
Virtual hosting schema and logic changes (#2876)
Note that virtual users cannot federate correctly yet.
Diffstat (limited to 'userapi/util')
-rw-r--r--userapi/util/devices.go8
-rw-r--r--userapi/util/notify.go7
2 files changed, 9 insertions, 6 deletions
diff --git a/userapi/util/devices.go b/userapi/util/devices.go
index cbf3bd28..c55fc799 100644
--- a/userapi/util/devices.go
+++ b/userapi/util/devices.go
@@ -2,10 +2,12 @@ package util
import (
"context"
+ "fmt"
"github.com/matrix-org/dendrite/internal/pushgateway"
"github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/dendrite/userapi/storage"
+ "github.com/matrix-org/gomatrixserverlib"
log "github.com/sirupsen/logrus"
)
@@ -17,10 +19,10 @@ type PusherDevice struct {
}
// GetPushDevices pushes to the configured devices of a local user.
-func GetPushDevices(ctx context.Context, localpart string, tweaks map[string]interface{}, db storage.Database) ([]*PusherDevice, error) {
- pushers, err := db.GetPushers(ctx, localpart)
+func GetPushDevices(ctx context.Context, localpart string, serverName gomatrixserverlib.ServerName, tweaks map[string]interface{}, db storage.Database) ([]*PusherDevice, error) {
+ pushers, err := db.GetPushers(ctx, localpart, serverName)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("db.GetPushers: %w", err)
}
devices := make([]*PusherDevice, 0, len(pushers))
diff --git a/userapi/util/notify.go b/userapi/util/notify.go
index ff206bd3..fc0ab39b 100644
--- a/userapi/util/notify.go
+++ b/userapi/util/notify.go
@@ -8,6 +8,7 @@ import (
"github.com/matrix-org/dendrite/internal/pushgateway"
"github.com/matrix-org/dendrite/userapi/storage"
"github.com/matrix-org/dendrite/userapi/storage/tables"
+ "github.com/matrix-org/gomatrixserverlib"
log "github.com/sirupsen/logrus"
)
@@ -16,8 +17,8 @@ import (
// a single goroutine is started when talking to the Push
// gateways. There is no way to know when the background goroutine has
// finished.
-func NotifyUserCountsAsync(ctx context.Context, pgClient pushgateway.Client, localpart string, db storage.Database) error {
- pusherDevices, err := GetPushDevices(ctx, localpart, nil, db)
+func NotifyUserCountsAsync(ctx context.Context, pgClient pushgateway.Client, localpart string, serverName gomatrixserverlib.ServerName, db storage.Database) error {
+ pusherDevices, err := GetPushDevices(ctx, localpart, serverName, nil, db)
if err != nil {
return err
}
@@ -26,7 +27,7 @@ func NotifyUserCountsAsync(ctx context.Context, pgClient pushgateway.Client, loc
return nil
}
- userNumUnreadNotifs, err := db.GetNotificationCount(ctx, localpart, tables.AllNotifications)
+ userNumUnreadNotifs, err := db.GetNotificationCount(ctx, localpart, serverName, tables.AllNotifications)
if err != nil {
return err
}