'Likes' view an image + Tweak inbox page

* Hitting the Like button on a photo will mark it as viewed.
* Move the 'Report' button on the message inbox page, to instead be in
  the footer of each DM.
* Improve message reporting behavior to include the content of the
  message in the admin report.
This commit is contained in:
Noah Petherbridge 2024-09-26 20:56:16 -07:00
parent 7aa1d512fc
commit ab880148ad
3 changed files with 25 additions and 15 deletions

View File

@ -118,6 +118,11 @@ func Likes() http.HandlerFunc {
return
}
// Mark this photo as 'viewed' if it received a like.
// Example: on a gallery view the photo is only 'viewed' if interacted with (lightbox),
// going straight for the 'Like' button should count as well.
photo.View(currentUser.ID)
targetUser = user
}
} else {

View File

@ -26,6 +26,7 @@ func Contact() http.HandlerFunc {
subject = r.FormValue("subject")
title = "Contact Us"
message = r.FormValue("message")
footer string // appends to the message only when posting the feedback
replyTo = r.FormValue("email")
trap1 = r.FormValue("url") != "https://"
trap2 = r.FormValue("comment") != ""
@ -74,6 +75,14 @@ func Contact() http.HandlerFunc {
case "report.message":
tableName = "messages"
tableLabel = "Direct Message conversation"
// Find this message, and attach it to the report.
if msg, err := models.GetMessage(uint64(tableID)); err == nil {
footer = fmt.Sprintf(
"\n\n---\n\nThe reported DM said:\n\n%s",
markdown.Quotify(msg.Message),
)
}
case "report.comment":
tableName = "comments"
@ -141,7 +150,7 @@ func Contact() http.HandlerFunc {
fb := &models.Feedback{
Intent: intent,
Subject: subject,
Message: message,
Message: message + footer,
TableName: tableName,
TableID: uint64(tableID),
}

View File

@ -69,18 +69,7 @@
the main website and the chat room.
</div>
<div class="columns is-mobile">
<div class="column">
<button type="submit" class="button is-success">Send Reply</button>
</div>
<div class="column is-narrow">
<a href="/contact?intent=report&subject=report.message&id={{.MessageID}}"
class="button has-text-danger ml-4">
<span class="icon"><i class="fa fa-flag"></i></span>
<span>Report</span>
</a>
</div>
</div>
</form>
@ -151,15 +140,22 @@
<!-- Our message? We can delete it. -->
{{if eq $Root.CurrentUser.ID $SourceUser.ID}}
<form action="/messages/delete" method="POST" class="is-inline" onsubmit="return confirm('Delete this message?')">
<form action="/messages/delete" method="POST" class="is-inline"
onsubmit="return confirm('Do you want to DELETE this message?')">
{{InputCSRF}}
<input type="hidden" name="id" value="{{.ID}}">
<input type="hidden" name="next" value="{{$Root.Request.URL.Path}}">
<button class="button has-text-danger is-outline is-small p-1 ml-4">
<button class="button is-outline has-text-grey is-small ml-4">
<i class="fa fa-trash mr-2"></i>
Delete
</button>
</form>
{{else}}
<a href="/contact?intent=report&subject=report.message&id={{.ID}}"
class="button is-outline is-small has-text-danger ml-4">
<span class="icon"><i class="fa fa-flag"></i></span>
<span>Report</span>
</a>
{{end}}
</div>