Fix room.ID() method

This commit is contained in:
nxshock 2019-07-24 20:02:04 +05:00
parent b27c537374
commit a05a6dfb54
2 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,8 @@ type Room struct {
events []RoomEvent
server *Backend
mutex sync.RWMutex
}
@ -27,7 +29,7 @@ func (room *Room) ID() string {
room.mutex.RLock()
defer room.mutex.RUnlock()
return room.id
return "!" + room.id + ":" + room.server.hostname
}
func (room *Room) Name() string {

View File

@ -26,6 +26,7 @@ func TestCreateRoom(t *testing.T) {
assert.Equal(t, request.Topic, room.Topic())
assert.Equal(t, user.ID(), room.Creator().ID())
assert.Equal(t, 1, len(backend.rooms))
assert.Equal(t, "!"+room.(*Room).id+":"+backend.hostname, room.ID())
}
func TestCreateAlreadyExistingRoom(t *testing.T) {