mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
feat(asymkey/llu): Only interpret .Reason as msgid if .Verified=false (#12019)
Split out from #12013. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12019 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Έλλεν Εμίλια Άννα Zscheile <fogti+devel@ytrizja.de> Co-committed-by: Έλλεν Εμίλια Άννα Zscheile <fogti+devel@ytrizja.de>
This commit is contained in:
parent
5f432e32c8
commit
cf26e4c891
1 changed files with 20 additions and 2 deletions
|
|
@ -20,14 +20,32 @@ func HandleCompositeErrorReason(handler llu.Handler, fset *token.FileSet, n *ast
|
||||||
}
|
}
|
||||||
|
|
||||||
// fields are normally named
|
// fields are normally named
|
||||||
|
var reason ast.Expr
|
||||||
|
verified := false
|
||||||
for _, i := range n.Elts {
|
for _, i := range n.Elts {
|
||||||
if kve, ok := i.(*ast.KeyValueExpr); ok {
|
if kve, ok := i.(*ast.KeyValueExpr); ok {
|
||||||
ident, ok = kve.Key.(*ast.Ident)
|
ident, ok = kve.Key.(*ast.Ident)
|
||||||
if ok && ident.Name == "Reason" {
|
if !ok {
|
||||||
handler.HandleGoTrArgument(fset, kve.Value, "")
|
continue
|
||||||
|
}
|
||||||
|
switch ident.Name {
|
||||||
|
case "Reason":
|
||||||
|
reason = kve.Value
|
||||||
|
case "Verified":
|
||||||
|
if valueIdent, ok := kve.Value.(*ast.Ident); ok {
|
||||||
|
switch valueIdent.Name {
|
||||||
|
case "true":
|
||||||
|
verified = true
|
||||||
|
case "false":
|
||||||
|
verified = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handler.OnWarning(fset, i.Pos(), "unable to parse ObjectVerification field assignment")
|
handler.OnWarning(fset, i.Pos(), "unable to parse ObjectVerification field assignment")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !verified && reason != nil {
|
||||||
|
handler.HandleGoTrArgument(fset, reason, "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue