Localised the errors in /routes/panel/groups.go
Fixed a typo in a group manager phrase.
This commit is contained in:
parent
f6ab754743
commit
b02175d7ae
@ -98,8 +98,16 @@
|
||||
"register_username_too_long_prefix":"The username is too long, max: ",
|
||||
"register_email_fail":"We were unable to send the email for you to confirm that this email address belongs to you. You may not have access to some functionality until you do so. Please ask an administrator for assistance.",
|
||||
|
||||
"panel_groups_need_name":"The group name can't be left blank.",
|
||||
"panel_groups_cannot_edit_admin":"You need the EditGroupAdmin permission to edit an admin group.",
|
||||
"panel_groups_cannot_edit_supermod":"You need the EditGroupSuperMod permission to edit a super-mod group."
|
||||
"panel_groups_cannot_edit_supermod":"You need the EditGroupSuperMod permission to edit a super-mod group.",
|
||||
"panel_groups_cannot_edit_group_type":"You need the EditGroupGlobalPerms permission to change the group type.",
|
||||
"panel_groups_edit_cannot_designate_admin":"You need the EditGroupAdmin permission to designate this group as an admin group.",
|
||||
"panel_groups_edit_cannot_designate_supermod":"You need the EditGroupSuperMod permission to designate this group as a super-mod group.",
|
||||
"panel_groups_create_cannot_designate_admin":"You need the EditGroupAdmin permission to create admin groups",
|
||||
"panel_groups_create_cannot_designate_supermod":"You need the EditGroupSuperMod permission to create super-mod groups",
|
||||
"panel_groups_cannot_be_guest":"You can't designate a group as a guest group.",
|
||||
"panel_groups_invalid_group_type":"Invalid group type."
|
||||
},
|
||||
|
||||
"PageTitles": {
|
||||
|
@ -223,7 +223,7 @@ func GroupsEditSubmit(w http.ResponseWriter, r *http.Request, user common.User,
|
||||
|
||||
gname := r.FormValue("group-name")
|
||||
if gname == "" {
|
||||
return common.LocalError("The group name can't be left blank.", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_need_name"), w, r, user)
|
||||
}
|
||||
gtag := r.FormValue("group-tag")
|
||||
rank := r.FormValue("group-type")
|
||||
@ -242,30 +242,30 @@ func GroupsEditSubmit(w http.ResponseWriter, r *http.Request, user common.User,
|
||||
originalRank = "Member"
|
||||
}
|
||||
|
||||
if rank != originalRank {
|
||||
if rank != originalRank && originalRank != "Guest" {
|
||||
if !user.Perms.EditGroupGlobalPerms {
|
||||
return common.LocalError("You need the EditGroupGlobalPerms permission to change the group type.", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_edit_group_type"), w, r, user)
|
||||
}
|
||||
|
||||
switch rank {
|
||||
case "Admin":
|
||||
if !user.Perms.EditGroupAdmin {
|
||||
return common.LocalError("You need the EditGroupAdmin permission to designate this group as an admin group.", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_edit_cannot_designate_admin"), w, r, user)
|
||||
}
|
||||
err = group.ChangeRank(true, true, false)
|
||||
case "Mod":
|
||||
if !user.Perms.EditGroupSuperMod {
|
||||
return common.LocalError("You need the EditGroupSuperMod permission to designate this group as a super-mod group.", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_edit_cannot_designate_supermod"), w, r, user)
|
||||
}
|
||||
err = group.ChangeRank(false, true, false)
|
||||
case "Banned":
|
||||
err = group.ChangeRank(false, false, true)
|
||||
case "Guest":
|
||||
return common.LocalError("You can't designate a group as a guest group.", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_cannot_be_guest"), w, r, user)
|
||||
case "Member":
|
||||
err = group.ChangeRank(false, false, false)
|
||||
default:
|
||||
return common.LocalError("Invalid group type.", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_invalid_group_type"), w, r, user)
|
||||
}
|
||||
if err != nil {
|
||||
return common.InternalError(err, w, r)
|
||||
@ -348,7 +348,7 @@ func GroupsCreateSubmit(w http.ResponseWriter, r *http.Request, user common.User
|
||||
|
||||
groupName := r.PostFormValue("group-name")
|
||||
if groupName == "" {
|
||||
return common.LocalError("You need a name for this group!", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_need_name"), w, r, user)
|
||||
}
|
||||
groupTag := r.PostFormValue("group-tag")
|
||||
|
||||
@ -357,13 +357,13 @@ func GroupsCreateSubmit(w http.ResponseWriter, r *http.Request, user common.User
|
||||
groupType := r.PostFormValue("group-type")
|
||||
if groupType == "Admin" {
|
||||
if !user.Perms.EditGroupAdmin {
|
||||
return common.LocalError("You need the EditGroupAdmin permission to create admin groups", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_create_cannot_designate_admin"), w, r, user)
|
||||
}
|
||||
isAdmin = true
|
||||
isMod = true
|
||||
} else if groupType == "Mod" {
|
||||
if !user.Perms.EditGroupSuperMod {
|
||||
return common.LocalError("You need the EditGroupSuperMod permission to create admin groups", w, r, user)
|
||||
return common.LocalError(common.GetErrorPhrase("panel_groups_create_cannot_designate_supermod"), w, r, user)
|
||||
}
|
||||
isMod = true
|
||||
} else if groupType == "Banned" {
|
||||
|
Loading…
Reference in New Issue
Block a user