Skip to content

Commit 3997d92

Browse files
committed
Add allow notification option to comment forms
1 parent ed30051 commit 3997d92

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

packages/comment-widget/src/base-form.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,14 @@ export class BaseForm extends LitElement {
237237
</button> `
238238
: ''
239239
}
240+
240241
<div class="form-actions justify-end flex gap-2 flex-wrap items-center">
242+
243+
<div class="flex items-center gap-2">
244+
<input id="allowNotification" name="allowNotification" type="checkbox" checked />
245+
<label for="allowNotification" class="text-xs select-none text-text-3 hover:text-text-1 transition-all">${msg('Allow notification')}</label>
246+
</div>
247+
241248
${
242249
this.showCaptcha && this.captcha
243250
? html`
@@ -292,6 +299,7 @@ export class BaseForm extends LitElement {
292299
detail: {
293300
...data,
294301
content,
302+
allowNotification: data.allowNotification === 'on',
295303
},
296304
});
297305
this.dispatchEvent(event);

packages/comment-widget/src/comment-form.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ export class CommentForm extends LitElement {
8181

8282
const data = e.detail;
8383

84-
const { displayName, email, website, content } = data || {};
84+
const { displayName, email, website, content, allowNotification } =
85+
data || {};
8586

8687
const commentRequest: CommentRequest = {
8788
raw: content,
8889
content: content,
89-
// TODO: support user input
90-
allowNotification: true,
90+
allowNotification: allowNotification,
9191
subjectRef: {
9292
group: this.group,
9393
kind: this.kind,

packages/comment-widget/src/reply-form.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ export class ReplyForm extends LitElement {
8686

8787
const data = e.detail;
8888

89-
const { displayName, email, website, content } = data || {};
89+
const { displayName, email, website, content, allowNotification } =
90+
data || {};
9091

9192
const replyRequest: ReplyRequest = {
9293
raw: content,
9394
content: content,
94-
// TODO: support user input
95-
allowNotification: true,
95+
allowNotification: allowNotification,
9696
};
9797

9898
if (this.quoteReply) {

0 commit comments

Comments
 (0)