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