forked from CTFd/CTFd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression in notification deliverability (CTFd#1659)
* Fix regression in notification deliverability. Closes CTFd#1641 * Only master tabs were showing notifications * Only play the notification sound in the master tab * Clears notification form after notification submission * Add notification to admin notification list after creation. Closes CTFd#1651 * Remove `console.log` statements from minified production JS
- Loading branch information
Showing
41 changed files
with
237 additions
and
464 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
CTFd/themes/admin/assets/js/components/notifications/Notification.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<template> | ||
<div class="card bg-light mb-4"> | ||
<button | ||
type="button" | ||
:data-notif-id="this.id" | ||
class="delete-notification close position-absolute p-3" | ||
style="right:0;" | ||
data-dismiss="alert" | ||
aria-label="Close" | ||
@click="deleteNotification()" | ||
> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<div class="card-body"> | ||
<h3 class="card-title">{{ title }}</h3> | ||
<blockquote class="blockquote mb-0"> | ||
<p v-html="this.content"></p> | ||
<small class="text-muted"> | ||
<span :data-time="this.date">{{ this.localDate() }}</span> | ||
</small> | ||
</blockquote> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import CTFd from "core/CTFd"; | ||
import Moment from "moment"; | ||
export default { | ||
props: { | ||
id: Number, | ||
title: String, | ||
content: String, | ||
date: String | ||
}, | ||
methods: { | ||
localDate: function() { | ||
return Moment(this.date) | ||
.local() | ||
.format("MMMM Do, h:mm:ss A"); | ||
}, | ||
deleteNotification: function() { | ||
if (confirm("Are you sure you want to delete this notification?")) { | ||
CTFd.api | ||
.delete_notification({ notificationId: this.id }) | ||
.then(response => { | ||
if (response.success) { | ||
// Delete the current component | ||
// https://stackoverflow.com/a/55384005 | ||
this.$destroy(); | ||
this.$el.parentNode.removeChild(this.$el); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.