"new" flag on conference hotlist sidebox works (it's a bell)

This commit is contained in:
2026-01-26 16:26:51 -07:00
parent c83ac65f7e
commit 58aa01361d
4 changed files with 20 additions and 2 deletions
+10
View File
@@ -302,6 +302,16 @@ func (c *Conference) TouchPost(ctx context.Context, tx *sqlx.Tx, u *User, lastPo
return cs, nil return cs, nil
} }
// UnreadMessages returns the total number of unread messages in a conference for a user.
func (c *Conference) UnreadMessages(ctx context.Context, u *User) (int32, error) {
row := amdb.QueryRowContext(ctx, `SELECT SUM(t.top_message - IFNULL(s.last_message,-1))
FROM topics t LEFT JOIN topicsettings s ON t.topicid = s.topicid AND s.uid = ?
WHERE t.confid = ? AND t.archived = 0 AND (s.hidden IS NULL OR s.hidden = 0)`, u.Uid, c.ConfId)
var rc int32
err := row.Scan(&rc)
return rc, err
}
/* AmGetConference returns a conference given its ID. /* AmGetConference returns a conference given its ID.
* Parameters: * Parameters:
* ctx - Standard Go context value. * ctx - Standard Go context value.
+1 -1
View File
@@ -42,7 +42,7 @@
- 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 - ~~"New" flag on Conference Hotlist sidebox~~
- Manage on Conference Hotlist sidebox - Manage on Conference Hotlist sidebox
- Sidebox configuration - Sidebox configuration
- Topics view: - Topics view:
+8 -1
View File
@@ -133,13 +133,20 @@ func buildFeaturedConferences(ctxt ui.AmContext, uid int32, out *RenderedSidebox
lk := fmt.Sprintf("/comm/%s/conf/%s", comm.Alias, alias[0]) lk := fmt.Sprintf("/comm/%s/conf/%s", comm.Alias, alias[0])
out.Items[i].Link = &lk out.Items[i].Link = &lk
out.Items[i].Flags = make(map[string]bool) out.Items[i].Flags = make(map[string]bool)
// TODO: add "New" indicator out.Items[i].Flags["new"] = false
if !user.IsAnon {
nnew, err := conf.UnreadMessages(ctxt.Ctx(), user)
if err == nil {
out.Items[i].Flags["new"] = (nnew > 0)
}
}
} }
out.Flags = make(map[string]bool) out.Flags = make(map[string]bool)
out.Flags["canManage"] = !(user.IsAnon) out.Flags["canManage"] = !(user.IsAnon)
out.TemplateName = "sb_ftrconf.jet" out.TemplateName = "sb_ftrconf.jet"
} }
} }
_ = in
return err return err
} }
+1
View File
@@ -22,6 +22,7 @@
<a href="{{ item.Link }}" class="text-blue-700 hover:text-blue-900 font-bold">{{ item.Text }}</a> <a href="{{ item.Link }}" class="text-blue-700 hover:text-blue-900 font-bold">{{ item.Text }}</a>
<span class="text-black"> ({{ item.Text2 }})</span> <span class="text-black"> ({{ item.Text2 }})</span>
</div> </div>
{{ if item.Flags["new"] }}<span class="ml-1" title="There are new messages in this conference">🔔</span>{{ end }}
</div> </div>
{{ end }} {{ end }}
{{ else }} {{ else }}