diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-09 16:17:21 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-09 16:17:21 -0500 |
| commit | de6bd8a7c9b12524e3c127605bd7e485d906429d (patch) | |
| tree | c08dc3cc2aa1d4557f4d6513122d7a732c403f52 /server/channel/channel.go | |
| parent | bcab4b13e119b8f2e821af238e18dab34a88f754 (diff) | |
exclude sender name from DM name
Diffstat (limited to 'server/channel/channel.go')
| -rw-r--r-- | server/channel/channel.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/server/channel/channel.go b/server/channel/channel.go index 056b942..c4d2000 100644 --- a/server/channel/channel.go +++ b/server/channel/channel.go @@ -88,11 +88,18 @@ func (cs *ChannelStore) ByName(name string) *Channel { } func (c *Channel) Name() string { + return c.NameFor("") +} + +func (c *Channel) NameFor(uid string) string { if !c.isDirect { return c.name } else { var members []string for member := range c.members { + if member == uid && len(c.members) > 1 { + continue + } u := c.store.world.GetObject(member) if u != nil { members = append(members, u.GetInfo().Fields[""]) @@ -216,8 +223,14 @@ func (c *Channel) Kind() string { } } +func (c *Channel) GetInfoFor(uid string) proto.Object { + return proto.Object { + c.Kind(), c.id, map[string]string {"": c.NameFor(uid)}, + } +} + func (c *Channel) GetInfo() proto.Object { - return proto.Object {c.Kind(), c.id, map[string]string {"": c.Name()}} + return c.GetInfoFor("") } func (t Tombstone) GetInfo() proto.Object { |
