@@ -104,6 +104,11 @@
top: 1px;
}
+.comment-enable-notifications {
+ display: inline-block;
+ margin-left: 1em;
+}
+
.rss-icon, .delete-comment, .undelete-comment, .edit-comment, .pin-comment {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
@@ -120,6 +120,10 @@ if (check_token()) {
} elseif (current_action("do_AddComment")) {
$uid = uid_from_sid($_COOKIE["AURSID"]);
list($ret, $output) = pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
+ $enable_notifications = isset($_REQUEST['enable_notifications']);
+ if ($ret && $enable_notifications != pkgbase_user_notify($uid, $base_id)) {
+ list($ret, $output) = pkgbase_notify(array($base_id), $enable_notifications);
+ }
$fragment = '#news';
} elseif (current_action("do_EditComment")) {
list($ret, $output) = pkgbase_edit_comment($_REQUEST['comment']);
@@ -13,6 +13,12 @@
</p>
<p>
<input type="submit" value="<?= (isset($comment_id)) ? __("Save") : __("Add Comment") ?>" />
+ <?php if (!isset($comment_id)): ?>
+ <span class="comment-enable-notifications">
+ <input type="checkbox" name="enable_notifications" id="id_enable_notifications" <?= pkgbase_user_notify($uid, $base_id) ? "checked" : "" ?> />
+ <label for="id_enable_notifications"><?= __("Enable notifications") ?></label>
+ </span>
+ <?php endif; ?>
</p>
</fieldset>
</form>