summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorraven <citrons@mondecitronne.com>2026-02-17 15:22:23 -0600
committerraven <citrons@mondecitronne.com>2026-02-17 15:22:23 -0600
commite85058daf7019777ac017a84253298390bcf2745 (patch)
tree70dde9056eb16ba863b880ec123c39896feded52 /server
parent86df926a15da7c5447788b00a34995e0512bd286 (diff)
only list nonempty direct channels
Diffstat (limited to 'server')
-rw-r--r--server/channel/channel.go3
-rw-r--r--server/server/command.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/server/channel/channel.go b/server/channel/channel.go
index ef066e5..3cdb76b 100644
--- a/server/channel/channel.go
+++ b/server/channel/channel.go
@@ -279,6 +279,9 @@ func (c *Channel) History(min, max int) []proto.Object {
err := c.kind.db.View(func(tx *bolt.Tx) error {
history := tx.Bucket([]byte("message history"))
channel := history.Bucket([]byte(c.id))
+ if channel == nil {
+ return nil
+ }
for index := min; index < max; index++ {
data := channel.Get([]byte(strconv.Itoa(index)))
diff --git a/server/server/command.go b/server/server/command.go
index 2dda9e3..bdc0282 100644
--- a/server/server/command.go
+++ b/server/server/command.go
@@ -232,6 +232,9 @@ func (s *server) SendRequest(r session.Request) {
case "unread":
include = c.Unread(r.From.UserId)
}
+ if r.Cmd.Kind == "direct-channels" {
+ include = include && len(c.History(0, 1)) > 0
+ }
info := c.InfoFor(r.From.UserId)
if include {
list = append(list, info)