mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 21:03:29 +03:00
Replaced newsletterId usage with newsletter
refs https://github.com/TryGhost/Team/issues/1569 refs https://github.com/TryGhost/Team/issues/1596 refs https://github.com/TryGhost/Team/issues/1576 - Removed some usages of post.newsletterId with post.newsletter - Renamed newsletterId adapterOption from newsletterId to newsletter, in preparation of https://github.com/TryGhost/Team/issues/1596 (still sending newsletter_id) - Removed newsletterId property of post model
This commit is contained in:
parent
a5fe1fa48c
commit
98e80cb6f8
@ -18,8 +18,9 @@ export default class Post extends ApplicationAdapter {
|
||||
parsedUrl.searchParams.append('email_recipient_filter', emailRecipientFilter);
|
||||
}
|
||||
|
||||
if (snapshot?.adapterOptions?.newsletterId) {
|
||||
const newsletterId = snapshot.adapterOptions.newsletterId;
|
||||
if (snapshot?.adapterOptions?.newsletter) {
|
||||
// TODO: rename newsletter_id to newsletter once changed in the backend
|
||||
const newsletterId = snapshot.adapterOptions.newsletter;
|
||||
parsedUrl.searchParams.append('newsletter_id', newsletterId);
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ export class PublishOptions {
|
||||
const adapterOptions = {};
|
||||
|
||||
if (willEmail) {
|
||||
adapterOptions.newsletterId = this.newsletter.id;
|
||||
adapterOptions.newsletter = this.newsletter.id;
|
||||
adapterOptions.emailRecipientFilter = this.recipientFilter;
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ export default Component.extend({
|
||||
|
||||
try {
|
||||
// will show alert for non-date related failed validations
|
||||
post = yield this.saveTask.perform({sendEmailWhenPublished, newsletterId: this.selectedNewsletter?.id, emailOnly});
|
||||
post = yield this.saveTask.perform({sendEmailWhenPublished, newsletter: this.selectedNewsletter?.id, emailOnly});
|
||||
|
||||
this._cachePublishedAtBlogTZ();
|
||||
|
||||
|
@ -110,10 +110,8 @@ export default class ModalPostPreviewEmailComponent extends Component {
|
||||
let {post} = this.args;
|
||||
|
||||
// Fetch newsletter
|
||||
if (!this.newsletter && post.newsletterId) {
|
||||
const newsletters = (await this.store.query('newsletter', {filter: 'status:active+id:' + post.newsletterId, limit: 1})).toArray();
|
||||
const defaultNewsletter = newsletters[0];
|
||||
this.newsletter = defaultNewsletter;
|
||||
if (!this.newsletter && post.newsletter) {
|
||||
this.newsletter = post.newsletter;
|
||||
}
|
||||
|
||||
if (!this.newsletter) {
|
||||
|
@ -492,7 +492,7 @@ export default class EditorController extends Controller {
|
||||
if (options.sendEmailWhenPublished && (isPublishing || isScheduling)) {
|
||||
options.adapterOptions = Object.assign({}, options.adapterOptions, {
|
||||
sendEmailWhenPublished: options.sendEmailWhenPublished,
|
||||
newsletterId: options.newsletterId
|
||||
newsletter: options.newsletter
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -111,9 +111,6 @@ export default Model.extend(Comparable, ValidationEngine, {
|
||||
featureImageAlt: attr('string'),
|
||||
featureImageCaption: attr('string'),
|
||||
|
||||
// TODO: delete when newsletter relationship/embed is fully defined
|
||||
newsletterId: attr(),
|
||||
|
||||
authors: hasMany('user', {embedded: 'always', async: false}),
|
||||
createdBy: belongsTo('user', {async: true}),
|
||||
email: belongsTo('email', {async: false}),
|
||||
|
Loading…
Reference in New Issue
Block a user