diff --git a/conference_ops.go b/conference_ops.go index a33b710..4df308f 100644 --- a/conference_ops.go +++ b/conference_ops.go @@ -360,9 +360,37 @@ func TopicManage(ctxt ui.AmContext) (string, any, error) { } ctxt.VarMap().Set("canInvite", member) - ctxt.VarMap().Set("subscribed", false) // TODO - ctxt.VarMap().Set("bozos", make([]string, 0)) // TODO + // Get the filtered users list. + bozos, err := topic.GetBozos(ctxt.Ctx(), ctxt.CurrentUser()) + if err != nil { + return ui.ErrorPage(ctxt, err) + } + ctxt.VarMap().Set("bozos", bozos) + + ctxt.VarMap().Set("subscribed", false) // TODO ctxt.VarMap().Set("amsterdam_pageTitle", "Manage Topic: "+topic.Name) return "framed_template", "manage_topic.jet", nil } + +/* TopicRemoveBozo removes filtering from a specified user in the topic. + * Parameters: + * ctxt - The AmContext for the request. + * Returns: + * Command string dictating what to be rendered. + * Data as a parameter for the command string. + * Standard Go error status. + */ +func TopicRemoveBozo(ctxt ui.AmContext) (string, any, error) { + comm := ctxt.CurrentCommunity() + topic := ctxt.GetScratch("currentTopic").(*database.Topic) + bozoUid, err := strconv.Atoi(ctxt.URLParam("uid")) + if err != nil { + return ui.ErrorPage(ctxt, err) + } + err = topic.SetBozo(ctxt.Ctx(), ctxt.CurrentUser(), int32(bozoUid), false) + if err != nil { + return ui.ErrorPage(ctxt, err) + } + return "redirect", fmt.Sprintf("/comm/%s/conf/%s/op/%d/manage", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number), nil +} diff --git a/database/topic.go b/database/topic.go index f9a839a..c168392 100644 --- a/database/topic.go +++ b/database/topic.go @@ -181,7 +181,8 @@ func (t *Topic) GetBozos(ctx context.Context, u *User) ([]TopicBozo, error) { return make([]TopicBozo, 0), nil } rs, err := amdb.QueryContext(ctx, `SELECT b.bozo_uid, u.username, c.given_name, c.family_name - FROM topicbozo b, users u, contacts c WHERE b.topicid = ? AND b.uid = ? AND b.bozo_uid = u.uid AND u.contactid = c.contactid`, t.TopicId, u.Uid) + FROM topicbozo b, users u, contacts c WHERE b.topicid = ? AND b.uid = ? AND b.bozo_uid = u.uid AND u.contactid = c.contactid + ORDER BY u.username`, t.TopicId, u.Uid) if err != nil { return nil, err } diff --git a/main.go b/main.go index 82dac35..9866e1d 100644 --- a/main.go +++ b/main.go @@ -111,6 +111,7 @@ func setupEcho() *echo.Echo { opsGroup.GET("/scribble/:msg", ui.AmWrap(ScribbleMessage)) opsGroup.GET("/nuke/:msg", ui.AmWrap(NukeMessage)) opsGroup.GET("/manage", ui.AmWrap(TopicManage)) + opsGroup.GET("/rmbozo/:uid", ui.AmWrap(TopicRemoveBozo)) return e } diff --git a/ui/views/manage_topic.jet b/ui/views/manage_topic.jet index 96982bb..62d08e7 100644 --- a/ui/views/manage_topic.jet +++ b/ui/views/manage_topic.jet @@ -61,6 +61,39 @@ {{ if len(bozos) > 0 }} +
+
+ + + {{ range i, b := bozos }} + + + + + {{ end }} + +
+ + + <{{ b.Username }}> + {{ b.GivenName }} {{ b.FamilyName }} +
+
+
+ + +
+
+

How to update the filtered users:

+
+
+ + Click this symbol to cease filtering this user in this topic. +
+
+
+
{{ end }}