hooled up "scribble message"
This commit is contained in:
@@ -115,6 +115,8 @@ func Topics(ctxt ui.AmContext) (string, any, error) {
|
||||
if firstTopic >= 1 {
|
||||
ctxt.VarMap().Set("urlReadNew", fmt.Sprintf("%s/r/%d", urlStem, firstTopic))
|
||||
}
|
||||
} else {
|
||||
ctxt.SetSession("topic.traverser", nil)
|
||||
}
|
||||
|
||||
tz := prefs.Location()
|
||||
|
||||
@@ -239,6 +239,43 @@ func HideMessage(ctxt ui.AmContext) (string, any, error) {
|
||||
return "redirect", fmt.Sprintf("/comm/%s/conf/%s/r/%d?r=%d&ac=1", ctxt.CurrentCommunity().Alias, ctxt.GetScratch("currentAlias"), topic.Number, hdrs[0].Num), nil
|
||||
}
|
||||
|
||||
/* ScribbleMessage scribbles a topic message.
|
||||
* 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 ScribbleMessage(ctxt ui.AmContext) (string, any, error) {
|
||||
if ctxt.CurrentUser().IsAnon {
|
||||
ctxt.SetRC(http.StatusForbidden)
|
||||
return ui.ErrorPage(ctxt, ENOPERM)
|
||||
}
|
||||
conf := ctxt.GetScratch("currentConference").(*database.Conference)
|
||||
myLevel := ctxt.GetScratch("levelInConference").(uint16)
|
||||
topic := ctxt.GetScratch("currentTopic").(*database.Topic)
|
||||
msgNum, err := strconv.Atoi(ctxt.URLParam("msg"))
|
||||
if err != nil {
|
||||
return ui.ErrorPage(ctxt, err)
|
||||
}
|
||||
hdrs, err := database.AmGetPostRange(ctxt.Ctx(), topic, int32(msgNum), int32(msgNum))
|
||||
if err != nil {
|
||||
return ui.ErrorPage(ctxt, err)
|
||||
} else if len(hdrs) != 1 {
|
||||
return ui.ErrorPage(ctxt, errors.New("internal error getting post reference"))
|
||||
}
|
||||
if (hdrs[0].CreatorUid != ctxt.CurrentUserId()) && !conf.TestPermission("Conference.Nuke", myLevel) {
|
||||
ctxt.SetRC(http.StatusForbidden)
|
||||
return ui.ErrorPage(ctxt, ENOPERM)
|
||||
}
|
||||
err = hdrs[0].Scribble(ctxt.Ctx(), ctxt.CurrentUser(), ctxt.RemoteIP())
|
||||
if err != nil {
|
||||
return ui.ErrorPage(ctxt, err)
|
||||
}
|
||||
return "redirect", fmt.Sprintf("/comm/%s/conf/%s/r/%d?r=%d&ac=1", ctxt.CurrentCommunity().Alias, ctxt.GetScratch("currentAlias"), topic.Number, hdrs[0].Num), nil
|
||||
}
|
||||
|
||||
/* TopicManage displays the "manage topic" page.
|
||||
* Parameters:
|
||||
* ctxt - The AmContext for the request.
|
||||
|
||||
@@ -40,7 +40,7 @@ _(italicized items can be deferred)_
|
||||
- Freeze/Unfreeze
|
||||
- Archive/Unarchive
|
||||
- Delete
|
||||
- Post Scribble
|
||||
- ~~Post Scribble~~
|
||||
- Post Nuke
|
||||
- Post Filter User
|
||||
- Post Move
|
||||
|
||||
@@ -108,6 +108,7 @@ func setupEcho() *echo.Echo {
|
||||
opsGroup := confGroup.Group("/op/:topic", ui.SetTopic)
|
||||
opsGroup.GET("/hide", ui.AmWrap(HideTopic))
|
||||
opsGroup.GET("/hide/:msg", ui.AmWrap(HideMessage))
|
||||
opsGroup.GET("/scribble/:msg", ui.AmWrap(ScribbleMessage))
|
||||
opsGroup.GET("/manage", ui.AmWrap(TopicManage))
|
||||
|
||||
return e
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if canScribble }}
|
||||
<a href="/TODO"
|
||||
<a href="{{ topicListLink }}/op/{{ topicNum }}/scribble/{{ p.Num }}"
|
||||
class="bg-yellow-600 hover:bg-yellow-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Scribble</a>
|
||||
{{ end }}
|
||||
{{ if false }}{* TODO *}
|
||||
|
||||
Reference in New Issue
Block a user