mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-22 02:12:20 +00:00
Fix SetTopic mutex infinity lock
This commit is contained in:
parent
f8c6a259e2
commit
4fc26f127e
@ -114,14 +114,16 @@ func (user *User) SetTopic(room internal.Room, topic string) models.ApiError {
|
|||||||
memRoom := room.(*Room)
|
memRoom := room.(*Room)
|
||||||
|
|
||||||
memRoom.mutex.Lock()
|
memRoom.mutex.Lock()
|
||||||
defer memRoom.mutex.Unlock()
|
|
||||||
|
|
||||||
if memRoom.creator.ID() != user.ID() { // TODO: currently only creator can change topic
|
if memRoom.creator.ID() != user.ID() { // TODO: currently only creator can change topic
|
||||||
|
memRoom.mutex.Unlock()
|
||||||
return models.NewError(models.M_FORBIDDEN, "")
|
return models.NewError(models.M_FORBIDDEN, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
memRoom.topic = topic
|
memRoom.topic = topic
|
||||||
|
|
||||||
|
memRoom.mutex.Unlock()
|
||||||
|
|
||||||
rEvent := &RoomEvent{
|
rEvent := &RoomEvent{
|
||||||
Type: rooms.Topic,
|
Type: rooms.Topic,
|
||||||
Sender: user,
|
Sender: user,
|
||||||
|
Loading…
Reference in New Issue
Block a user