fixed bug in AmNewPost and filling in default pseud for post box

This commit is contained in:
2026-01-05 23:05:52 -07:00
parent e581d7ded5
commit dd3a2ec677
4 changed files with 50 additions and 56 deletions
+16
View File
@@ -178,6 +178,22 @@ func (c *Conference) Settings(ctx context.Context, u *User) (*ConferenceSettings
return &(dbdata[0]), nil
}
// DefaultPseud returns the default pseud for a user in the conference.
func (c *Conference) DefaultPseud(ctx context.Context, u *User) (string, error) {
settings, err := c.Settings(ctx, u)
if err != nil {
return "", err
}
if settings != nil && settings.DefaultPseud != nil {
return *settings.DefaultPseud, nil
}
ci, err := u.ContactInfo(ctx)
if err != nil {
return "", err
}
return ci.FullName(false), nil
}
// TouchUpdate updates the "last update" date/time in the conference.
func (c *Conference) TouchUpdate(ctx context.Context, tx *sqlx.Tx, lastUpdate time.Time) error {
_, err := tx.ExecContext(ctx, "UPDATE confs SET lastupdate = ? WHERE confid = ?", lastUpdate, c.ConfId)
+1 -1
View File
@@ -178,7 +178,7 @@ func AmNewPost(ctx context.Context, conf *Conference, topic *Topic, user *User,
hdr := &(dbdata[0])
// Add the post data.
_, err = tx.ExecContext(ctx, "INSERT INTO postdata (postid, data) VALUES (?, ?)", int32(xid), hdr.PostId)
_, err = tx.ExecContext(ctx, "INSERT INTO postdata (postid, data) VALUES (?, ?)", hdr.PostId, post)
if err != nil {
return nil, err
}