mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 09:43:10 -06:00
Use reserver username
Check that we actually got roomData
This commit is contained in:
parent
c08a8db23e
commit
c3c55eb704
|
|
@ -72,7 +72,7 @@ global:
|
|||
server_notices:
|
||||
enabled: false
|
||||
# The server localpart to be used when sending notices, ensure this is not yet taken
|
||||
local_part: "server"
|
||||
local_part: "_server"
|
||||
# The displayname to be used when sending notices
|
||||
display_name: "Server alerts"
|
||||
# The mxid of the avatar to use
|
||||
|
|
|
|||
|
|
@ -98,18 +98,19 @@ func (r *Leaver) performLeaveRoomByID(
|
|||
}, accData); err != nil {
|
||||
return nil, fmt.Errorf("unable to query account data")
|
||||
}
|
||||
roomData := accData.RoomAccountData[req.RoomID]
|
||||
tagData, ok := roomData["m.tag"]
|
||||
if ok {
|
||||
tags := gomatrix.TagContent{}
|
||||
if err = json.Unmarshal(tagData, &tags); err != nil {
|
||||
return nil, fmt.Errorf("unable to unmarshal tag content")
|
||||
}
|
||||
if _, ok = tags.Tags["m.server_notice"]; ok {
|
||||
return nil, fmt.Errorf("Unable to reject server notice invite")
|
||||
|
||||
if roomData, ok := accData.RoomAccountData[req.RoomID]; ok {
|
||||
tagData, ok := roomData["m.tag"]
|
||||
if ok {
|
||||
tags := gomatrix.TagContent{}
|
||||
if err = json.Unmarshal(tagData, &tags); err != nil {
|
||||
return nil, fmt.Errorf("unable to unmarshal tag content")
|
||||
}
|
||||
if _, ok = tags.Tags["m.server_notice"]; ok {
|
||||
return nil, fmt.Errorf("Unable to reject server notice invite")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// There's no invite pending, so first of all we want to find out
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ type ServerNotices struct {
|
|||
|
||||
func (c *ServerNotices) Defaults(generate bool) {
|
||||
if generate {
|
||||
c.LocalPart = "server"
|
||||
c.LocalPart = "_server"
|
||||
c.DisplayName = "Server Alert"
|
||||
c.RoomName = "Server Alert"
|
||||
c.AvatarURL = ""
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ global:
|
|||
username: metrics
|
||||
password: metrics
|
||||
server_notices:
|
||||
local_part: "server"
|
||||
local_part: "_server"
|
||||
display_name: "Server alerts"
|
||||
avatar: ""
|
||||
room_name: "Server Alerts"
|
||||
|
|
|
|||
Loading…
Reference in a new issue