mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-09 12:11:03 +00:00
25 lines
657 B
Go
25 lines
657 B
Go
package internal
|
|
|
|
import "github.com/nxshock/signaller/internal/models/publicrooms"
|
|
|
|
func roomsToPublicRoomsChunks(rooms []Room) []publicrooms.PublicRoomsChunk {
|
|
var chunks []publicrooms.PublicRoomsChunk
|
|
|
|
for _, room := range rooms {
|
|
chunk := publicrooms.PublicRoomsChunk{
|
|
// TODO: Aliases:
|
|
CanonicalAlias: room.AliasName(),
|
|
Name: room.Name(),
|
|
NumJoinedMembers: len(room.Users()),
|
|
RoomID: room.ID(),
|
|
Topic: room.Topic(),
|
|
WorldReadable: room.WorldReadable(),
|
|
GuestCanJoin: room.GuestCanJoin(),
|
|
AvatarURL: room.AvatarURL()}
|
|
|
|
chunks = append(chunks, chunk)
|
|
}
|
|
|
|
return chunks
|
|
}
|