mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Updated email role restrictions
no issue. Only admins and owners should have access to sending emails. Updated relevant templates to restrict access to emails for non-admins/owners
This commit is contained in:
parent
727a38d5d1
commit
e866808193
@ -6,6 +6,7 @@ import {inject as service} from '@ember/service';
|
||||
|
||||
export default Component.extend({
|
||||
ghostPaths: service(),
|
||||
session: service(),
|
||||
|
||||
tagName: 'li',
|
||||
classNames: ['gh-list-row', 'gh-posts-list-item'],
|
||||
|
@ -8,6 +8,7 @@ import {inject as service} from '@ember/service';
|
||||
export default Component.extend({
|
||||
feature: service(),
|
||||
settings: service(),
|
||||
session: service(),
|
||||
post: null,
|
||||
saveType: null,
|
||||
|
||||
|
@ -9,6 +9,7 @@ export default Component.extend({
|
||||
|
||||
post: null,
|
||||
saveType: null,
|
||||
session: service(),
|
||||
isClosing: null,
|
||||
|
||||
// used to set minDate in datepicker
|
||||
|
@ -130,7 +130,7 @@
|
||||
</button>
|
||||
{{svg-jar "arrow-right"}}
|
||||
</li>
|
||||
{{#if (and this.feature.members (eq this.post.displayName "post"))}}
|
||||
{{#if (and this.feature.members (eq this.post.displayName "post") this.session.user.isOwnerOrAdmin)}}
|
||||
<li class="nav-list-item" {{action "showSubview" "email-settings"}} data-test-button="email-settings">
|
||||
<button type="button">
|
||||
<b>Email newsletter</b>
|
||||
|
@ -43,20 +43,22 @@
|
||||
</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if (or this.post.email (and this.post.isScheduled this.post.sendEmailWhenPublished))}}
|
||||
{{#if (eq this.post.email.status "failed")}}
|
||||
<span data-tooltip="Failed to send post by email" class="gh-content-status-emailed error">
|
||||
{{svg-jar "send-email" class="stroke-red"}}
|
||||
</span>
|
||||
{{else}}
|
||||
{{#if this.isScheduled}}
|
||||
<span data-tooltip="To be sent by email" class="gh-content-status-emailed scheduled">
|
||||
{{svg-jar "send-email" class="stroke-green-d2"}}
|
||||
{{#if this.session.user.isOwnerOrAdmin}}
|
||||
{{#if (or this.post.email (and this.post.isScheduled this.post.sendEmailWhenPublished))}}
|
||||
{{#if (eq this.post.email.status "failed")}}
|
||||
<span data-tooltip="Failed to send post by email" class="gh-content-status-emailed error">
|
||||
{{svg-jar "send-email" class="stroke-red"}}
|
||||
</span>
|
||||
{{else}}
|
||||
<span data-tooltip="Sent by email" class="gh-content-status-emailed">
|
||||
{{svg-jar "send-email" class="stroke-midgrey"}}
|
||||
</span>
|
||||
{{#if this.isScheduled}}
|
||||
<span data-tooltip="To be sent by email" class="gh-content-status-emailed scheduled">
|
||||
{{svg-jar "send-email" class="stroke-green-d2"}}
|
||||
</span>
|
||||
{{else}}
|
||||
<span data-tooltip="Sent by email" class="gh-content-status-emailed">
|
||||
{{svg-jar "send-email" class="stroke-midgrey"}}
|
||||
</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
@ -27,36 +27,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if this.canSendEmail}}
|
||||
<div class="gh-publishmenu-section">
|
||||
<div class="gh-publishmenu-radio gh-publishmenu-email">
|
||||
{{#if this.backgroundLoader.isRunning}}
|
||||
<div class="gh-loading-spinner" style="zoom: 50%"></div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-email-label {{if disableEmailOption "pe-none"}}">
|
||||
<label class="gh-publishmenu-radio-label {{unless this.memberCount "midgrey"}}" for="email-when-published-checkbox">Send by email</label>
|
||||
{{#if this.memberCount}}
|
||||
<div class="gh-publishmenu-radio-desc">Deliver post to members</div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-radio-desc">You haven't got any members</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="for-switch small {{if disableEmailOption "pe-none"}}">
|
||||
<div class="switch container" for="email-when-published-checkbox">
|
||||
<Input
|
||||
@checked={{this.sendEmailWhenPublished}}
|
||||
@type="checkbox"
|
||||
@id="email-when-published-checkbox"
|
||||
@name="email-when-published"
|
||||
@disabled={{disableEmailOption}}
|
||||
/>
|
||||
<span class="input-toggle-component gh-publishmenu-email-checkbox"
|
||||
{{on "click" (toggle "sendEmailWhenPublished" this)}}></span>
|
||||
{{#if (and this.canSendEmail this.session.user.isOwnerOrAdmin)}}
|
||||
<div class="gh-publishmenu-section">
|
||||
<div class="gh-publishmenu-radio gh-publishmenu-email">
|
||||
{{#if this.backgroundLoader.isRunning}}
|
||||
<div class="gh-loading-spinner" style="zoom: 50%"></div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-email-label {{if disableEmailOption "pe-none"}}">
|
||||
<label class="gh-publishmenu-radio-label {{unless this.memberCount "midgrey"}}" for="email-when-published-checkbox">Send by email</label>
|
||||
{{#if this.memberCount}}
|
||||
<div class="gh-publishmenu-radio-desc">Deliver post to members</div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-radio-desc">You haven't got any members</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="for-switch small {{if disableEmailOption "pe-none"}}">
|
||||
<div class="switch container" for="email-when-published-checkbox">
|
||||
<Input
|
||||
@checked={{this.sendEmailWhenPublished}}
|
||||
@type="checkbox"
|
||||
@id="email-when-published-checkbox"
|
||||
@name="email-when-published"
|
||||
@disabled={{disableEmailOption}}
|
||||
/>
|
||||
<span class="input-toggle-component gh-publishmenu-email-checkbox"
|
||||
{{on "click" (toggle "sendEmailWhenPublished" this)}}></span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
||||
|
@ -26,31 +26,33 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{#unless this.post.email}}
|
||||
<section class="gh-publishmenu-section">
|
||||
<div class="gh-publishmenu-radio gh-publishmenu-email">
|
||||
{{#if this.backgroundLoader.isRunning}}
|
||||
<div class="gh-loading-spinner" style="zoom: 50%"></div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-email-label">
|
||||
<label class="gh-publishmenu-radio-label pe-none midgrey"
|
||||
for="email-when-published-checkbox">Send by email</label>
|
||||
{{#if this.memberCount}}
|
||||
<div class="gh-publishmenu-radio-desc">Deliver post to members</div>
|
||||
{{#if this.session.user.isOwnerOrAdmin}}
|
||||
{{#unless this.post.email}}
|
||||
<section class="gh-publishmenu-section">
|
||||
<div class="gh-publishmenu-radio gh-publishmenu-email">
|
||||
{{#if this.backgroundLoader.isRunning}}
|
||||
<div class="gh-loading-spinner" style="zoom: 50%"></div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-radio-desc">You haven't got any members</div>
|
||||
<div class="gh-publishmenu-email-label">
|
||||
<label class="gh-publishmenu-radio-label pe-none midgrey"
|
||||
for="email-when-published-checkbox">Send by email</label>
|
||||
{{#if this.memberCount}}
|
||||
<div class="gh-publishmenu-radio-desc">Deliver post to members</div>
|
||||
{{else}}
|
||||
<div class="gh-publishmenu-radio-desc">You haven't got any members</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="for-switch small pe-none">
|
||||
<div class="switch container" for="email-when-published-checkbox">
|
||||
<Input @checked={{post.sendEmailWhenPublished}} @type="checkbox" @id="email-when-published-checkbox"
|
||||
@name="email-when-published" @disabled={{disableEmailOption}} />
|
||||
<span class="input-toggle-component gh-publishmenu-email-checkbox"
|
||||
{{on "click" (toggle "sendEmailWhenPublished" this)}}></span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="for-switch small pe-none">
|
||||
<div class="switch container" for="email-when-published-checkbox">
|
||||
<Input @checked={{post.sendEmailWhenPublished}} @type="checkbox" @id="email-when-published-checkbox"
|
||||
@name="email-when-published" @disabled={{disableEmailOption}} />
|
||||
<span class="input-toggle-component gh-publishmenu-email-checkbox"
|
||||
{{on "click" (toggle "sendEmailWhenPublished" this)}}></span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</section>
|
||||
{{/unless}}
|
||||
</section>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user