Easy comment thread unsubscribe links in Notifications

This commit is contained in:
Noah Petherbridge 2024-08-07 22:15:47 -07:00
parent f1cf1bd958
commit 01c38c5c21
3 changed files with 30 additions and 8 deletions

View File

@ -81,7 +81,7 @@ func Subscription() http.HandlerFunc {
if subscribe {
session.Flash(w, r, "You will now be notified about comments on this page.")
} else {
session.Flash(w, r, "You will no longer be notified about new comments on this page.")
session.Flash(w, r, "You will no longer be notified about new comments on that thread.")
}
}
}

View File

@ -208,4 +208,14 @@ img {
.nonshy-htsignup {
display: none;
}
/* Dashboard notification page styles */
.nonshy-notification-row {
position: relative;
}
.nonshy-notif-delete-button {
position: absolute;
top: 4px;
right: 4px;
}

View File

@ -480,6 +480,14 @@
{{$Body := $Root.NotifMap.Get .ID}}
<tr>
<td class="nonshy-notification-row" data-notification-id="{{.ID}}">
<!-- Delete button for just this notification -->
<button type="button"
class="button is-danger px-2 py-1 is-small nonshy-notif-delete-button"
data-notification-id="{{.ID}}"
title="Remove this notification from your feed">
<i class="fa fa-xmark mr"></i>
</button>
<div class="columns">
<div class="column is-narrow has-text-centered">
{{if not .Read}}
@ -655,13 +663,17 @@
<small title="{{.CreatedAt.Format "2006-01-02 15:04:05"}}">
{{SincePrettyCoarse .CreatedAt}} ago.
<!-- Delete button for just this notification -->
<button type="button"
class="button is-danger is-light is-small nonshy-notif-delete-button"
data-notification-id="{{.ID}}"
title="Remove this notification from your feed">
<i class="fa fa-xmark mr-1"></i> Clear
</button>
<!-- Contextual "Unsubscribe" buttons -->
{{if or (eq .Type "also_posted") (eq .Type "also_comment")}}
<small>
<a href="/comments/subscription?table_name={{.TableName}}&table_id={{.TableID}}&next={{UrlEncode $Root.Request.URL.String}}&subscribe=false"
class="has-text-warning is-small"
title="Turn off notifications about this thread"
onclick="return confirm('Do you want to turn off notifications about this comment thread?')">
<i class="fa fa-microphone-slash mr-1"></i> Mute this thread
</a>
</small>
{{end}}
</small>
</div>