fixed bugs in community profile

This commit is contained in:
2025-10-18 16:45:43 -06:00
parent 83bd817630
commit 94c3877819
8 changed files with 80 additions and 25 deletions
+2 -2
View File
@@ -273,10 +273,10 @@ func (c *Community) SetProfileData(name string, alias string, synopsis *string,
create_lvl uint16, delete_lvl uint16, join_lvl uint16) error {
c.Mutex.Lock()
defer c.Mutex.Unlock()
_, err := amdb.Exec(`UPDATE communities SET commname = ?, alias = ?, synopsis = ? rules = ?, language = ?,
_, err := amdb.Exec(`UPDATE communities SET commname = ?, alias = ?, synopsis = ?, rules = ?, language = ?,
joinkey = ?, membersonly = ?, hide_dir = ?, hide_search = ?, read_lvl = ?, write_lvl = ?, create_lvl = ?,
delete_lvl = ?, join_lvl = ?, lastupdate = NOW() WHERE commid = ?`,
name, alias, synopsis, rules, joinkey, membersonly, hideDirectory, hideSearch, read_lvl, write_lvl,
name, alias, synopsis, rules, language, joinkey, membersonly, hideDirectory, hideSearch, read_lvl, write_lvl,
create_lvl, delete_lvl, join_lvl, c.Id)
if err == nil {
c.Name = name
+10
View File
@@ -208,6 +208,7 @@ func (r *CfgRole) LevelStr() string {
type RoleList interface {
Roles() []Role
Default() Role
FindForLevel(uint16) Role
}
func (r *CfgRoleList) Roles() []Role {
@@ -222,6 +223,15 @@ func (r *CfgRoleList) Default() Role {
return r.defptr
}
func (r *CfgRoleList) FindForLevel(level uint16) Role {
for _, rp := range r.roleptrs {
if rp.level == level {
return rp
}
}
return nil
}
/* AmRole returns a Role given a string ID.
* Parameters:
* id - ID of the role to look up.