3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 11:12:44 +01:00

Merge pull request #1812 from slingamn/cstransfer

fix case where CS TRANSFER as an operator required acceptance
This commit is contained in:
Shivaram Lingamneni 2021-11-02 20:58:51 -04:00 committed by GitHub
commit d488cf7f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -541,14 +541,12 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm
chname = regInfo.Name
account := client.Account()
isFounder := account != "" && account == regInfo.Founder
var oper *Oper
if !isFounder {
oper = client.Oper()
if !oper.HasRoleCapab("chanreg") {
oper := client.Oper()
hasPrivs := oper.HasRoleCapab("chanreg")
if !isFounder && !hasPrivs {
service.Notice(rb, client.t("Insufficient privileges"))
return
}
}
target := params[1]
targetAccount, err := server.accounts.LoadAccount(params[1])
if err != nil {
@ -569,7 +567,7 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm
server.snomasks.Send(sno.LocalOpers, message)
server.logger.Info("opers", message)
}
status, err := channel.Transfer(client, target, oper != nil)
status, err := channel.Transfer(client, target, hasPrivs)
if err == nil {
switch status {
case channelTransferComplete:

View File

@ -1080,6 +1080,9 @@ func schemaChangeV21To22(config *Config, tx *buntdb.Tx) error {
if !strings.HasPrefix(key, settingsPrefix) {
return false
}
if value == "" {
return true
}
account := strings.TrimPrefix(key, settingsPrefix)
if _, err := tx.Get("account.verified " + account); err != nil {
return true