Wired up user comment notifications toggle

This commit is contained in:
Kevin Ansfield 2022-07-06 18:32:13 +02:00
parent 27212475f3
commit 87eafc1ae4
3 changed files with 16 additions and 11 deletions

View File

@ -4,8 +4,8 @@ import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard';
import isNumber from 'ghost-admin/utils/isNumber';
import validator from 'validator';
import windowProxy from 'ghost-admin/utils/window-proxy';
import {action, computed} from '@ember/object';
import {alias, and, not, or, readOnly} from '@ember/object/computed';
import {computed} from '@ember/object';
import {isArray as isEmberArray} from '@ember/array';
import {run} from '@ember/runloop';
import {inject as service} from '@ember/service';
@ -381,6 +381,10 @@ export default Controller.extend({
}
},
toggleCommentNotifications: action(function (event) {
this.user.commentNotifications = event.target.checked;
}),
_exportDb(filename) {
this.utils.downloadFile(`${this.ghostPaths.url.api('db')}?filename=${filename}`);
},

View File

@ -35,6 +35,7 @@ export default BaseModel.extend(ValidationEngine, {
facebook: attr('facebook-url-user'),
twitter: attr('twitter-url-user'),
tour: attr('json-string'),
commentNotifications: attr(),
ghostPaths: service(),
ajax: service(),

View File

@ -292,7 +292,7 @@
/>
<GhErrorMessage @errors={{this.user.errors}} @property="bio" data-test-error="user-bio" />
<p>
Recommended: <strong>200</strong> characters.
Recommended: <strong>200</strong> characters.
You've used {{gh-count-down-characters this.user.bio 200}}
</p>
</GhFormGroup>
@ -306,15 +306,15 @@
<p>Send notifications on members commenting on your posts</p>
</div>
<div class="for-switch">
<label class="switch" for={{notifications.comment}}>
<Input
{{!-- @checked={{newsletter.subscribed}} --}}
@type="checkbox"
id={{notifications.comment}}
name="comment-emails"
data-test-checkbox="member-subscribed"
{{!-- {{on "click" (fn this.updateNewsletterPreference newsletter)}} --}}
/>
<label class="switch" for="comment-notifications">
<input
id="comment-notifications"
type="checkbox"
checked={{this.user.commentNotifications}}
class="gh-input"
{{on "change" this.toggleCommentNotifications}}
data-test-checkbox="comment-notifications"
>
<span class="input-toggle-component"></span>
</label>
</div>