landed E-mail subscription delivery

This commit is contained in:
2026-01-29 15:52:24 -07:00
parent a18a7c70f7
commit 184c614163
11 changed files with 229 additions and 4 deletions
+19
View File
@@ -240,6 +240,25 @@ func (t *Topic) GetBozos(ctx context.Context, u *User) ([]TopicBozo, error) {
return rc, nil
}
// GetSubscribers returns an array of UIDs of every user that subscribed to the topic.
func (t *Topic) GetSubscribers(ctx context.Context) ([]int32, error) {
rs, err := amdb.QueryContext(ctx, "SELECT uid FROM topicsettings WHERE topicid = ? AND subscribe <> 0", t.TopicId)
if err != nil {
return nil, err
}
rc := make([]int32, 0)
for rs.Next() {
var tmp int32
err = rs.Scan(&tmp)
if err == nil {
rc = append(rc, tmp)
} else {
break
}
}
return rc, err
}
// TopicSettings contains per-user settings for topics, including the "last read" message pointer.
type TopicSettings struct {
TopicId int32 `db:"topicid"` // unique ID of the topic