conference sidebox is now filled in

This commit is contained in:
2026-01-26 16:11:05 -07:00
parent 0dd66709d9
commit c83ac65f7e
8 changed files with 43 additions and 21 deletions
+2 -1
View File
@@ -880,7 +880,8 @@ func AmCreateCommunity(ctx context.Context, name string, alias string, hostUid i
// validate alias does not already exist
row := tx.QueryRowContext(ctx, "SELECT commid FROM communities WHERE alias = ?", alias)
err := row.Err()
var tmpcid int32
err := row.Scan(&tmpcid)
if err != sql.ErrNoRows {
if err == nil {
err = errors.New("a community with that alias already exists")
+8 -1
View File
@@ -56,6 +56,9 @@ func lookupCommunityContact(ctx context.Context, id int32) (int32, error) {
var rc int32 = -1
row := amdb.QueryRowContext(ctx, "SELECT contactid FROM contacts WHERE owner_commid = ?", id)
err := row.Scan(&rc)
if err == sql.ErrNoRows {
return -1, nil
}
return rc, err
}
@@ -64,6 +67,9 @@ func lookupUserContact(ctx context.Context, uid int32) (int32, error) {
var rc int32 = -1
row := amdb.QueryRowContext(ctx, "SELECT contactid FROM contacts WHERE owner_uid = ? AND owner_commid = -1", uid)
err := row.Scan(&rc)
if err == sql.ErrNoRows {
return -1, nil
}
return rc, err
}
@@ -143,7 +149,8 @@ func (ci *ContactInfo) Save(ctx context.Context) (bool, error) {
if !emailChange {
// we don't THINK the E-mail address is changing, but we could be wrong...
row := amdb.QueryRowContext(ctx, "SELECT contactid FROM contacts WHERE contactid = ? AND email = ?", ci.ContactId, ci.Email)
err := row.Err()
var tmpcid int32
err := row.Scan(&tmpcid)
if err == sql.ErrNoRows {
emailChange = true
} else if err != nil {
+4 -2
View File
@@ -24,11 +24,13 @@ import (
*/
func AmIsEmailAddressBanned(ctx context.Context, address string) (bool, error) {
row := amdb.QueryRowContext(ctx, "SELECT by_uid FROM emailban WHERE address = ?", address)
switch row.Err() {
var uid int32
err := row.Scan(&uid)
switch err {
case nil:
return true, nil
case sql.ErrNoRows:
return false, nil
}
return false, row.Err()
return false, err
}
+4 -2
View File
@@ -146,13 +146,15 @@ func AmSetGlobalProperty(ctx context.Context, index int32, value string) error {
_, updateMode := globalProps[index]
if !updateMode {
row := amdb.QueryRowContext(ctx, "SELECT data FROM propglobal WHERE ndx = ?", index)
switch row.Err() {
var tmpdata string
err := row.Scan(&tmpdata)
switch err {
case nil:
updateMode = true
case sql.ErrNoRows:
updateMode = false
default:
return row.Err()
return err
}
}
var err error = nil
+13 -13
View File
@@ -698,31 +698,32 @@ func AmCreateNewUser(ctx context.Context, username string, password string, remi
// Test if the user name is already taken.
row := tx.QueryRowContext(ctx, "SELECT uid FROM users WHERE username = ?", username)
if row.Err() == nil {
var tmpuid int32
err := row.Scan(&tmpuid)
if err == nil {
log.Warnf("username \"%s\" already exists", username)
return nil, errors.New("that user name already exists. Please try again")
} else if row.Err() != sql.ErrNoRows {
return nil, row.Err()
} else if err != sql.ErrNoRows {
return nil, err
}
// Insert the user record.
_, err2 := tx.ExecContext(ctx, `INSERT INTO users (username, passhash, verify_email, lockout, email_confnum,
_, err = tx.ExecContext(ctx, `INSERT INTO users (username, passhash, verify_email, lockout, email_confnum,
base_lvl, created, lastaccess, passreminder, description, dob) VALUES (?, ?, 0, 0, ?, ?, NOW(), NOW(), ?, '', ?)`,
username, hashPassword(password), util.GenerateRandomConfirmationNumber(), AmDefaultRole("Global.NewUser").Level(),
reminder, dob)
if err2 != nil {
return nil, err2
if err != nil {
return nil, err
}
// Read back the user, which also puts it in the cache.
user, err3 := AmGetUserByName(ctx, username, tx)
if err3 != nil {
return nil, err3
user, err := AmGetUserByName(ctx, username, tx)
if err != nil {
return nil, err
}
log.Debugf("...created new user \"%s\" with UID %d", username, user.Uid)
// add user preferences
_, err := tx.ExecContext(ctx, "INSERT INTO userprefs (uid) VALUES (?)", user.Uid)
if err != nil {
if _, err = tx.ExecContext(ctx, "INSERT INTO userprefs (uid) VALUES (?)", user.Uid); err != nil {
return nil, err
}
@@ -732,8 +733,7 @@ func AmCreateNewUser(ctx context.Context, username string, password string, remi
return nil, err
}
for _, p := range props {
_, err := tx.ExecContext(ctx, "INSERT INTO propuser (uid, ndx, data) VALUES (?, ?, ?)", user.Uid, p.Index, p.Data)
if err != nil {
if _, err = tx.ExecContext(ctx, "INSERT INTO propuser (uid, ndx, data) VALUES (?, ?, ?)", user.Uid, p.Index, p.Data); err != nil {
return nil, err
}
}
+4 -2
View File
@@ -5,7 +5,7 @@
- Error handling: shift titles and templates for different error codes
- Find Posts
- Services mechanism: Conference vtable
- User creation: copy conference hotlists
- ~~User creation: copy conference hotlists ~~
- Calendar (top menu link)
- Chat (top menu link)
- Documentation (top menu link)
@@ -41,7 +41,9 @@
- Post Move
- Post Publish
- Manage Communities on communities sidebox
- Conference Hotlist sidebox
- ~~Conference Hotlist sidebox~~
- "New" flag on Conference Hotlist sidebox
- Manage on Conference Hotlist sidebox
- Sidebox configuration
- Topics view:
- Find
+1
View File
@@ -136,6 +136,7 @@ func buildFeaturedConferences(ctxt ui.AmContext, uid int32, out *RenderedSidebox
// TODO: add "New" indicator
}
out.Flags = make(map[string]bool)
out.Flags["canManage"] = !(user.IsAnon)
out.TemplateName = "sb_ftrconf.jet"
}
}
+7
View File
@@ -28,5 +28,12 @@
<div class="text-small">No conferences in hotlist.</div>
{{ end }}
</div>
{{ if sb.Flags["canManage"] }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[ <a href="/TODO/manage_hotlist" class="text-blue-700 hover:text-blue-900">Manage</a> ]
</span>
</div>
{{ end }}
</div>
</div>