Removed ability to change collection type after creation

refs https://github.com/TryGhost/Team/issues/3169

- Being able to change the collection type comes with extra complications we don't wan to support just yet. This came up as a part of the PR review here - 1bc2a604c3 (r1239783573).
This commit is contained in:
Naz 2023-06-26 12:08:34 +07:00 committed by naz
parent 623599af1e
commit cf48d4ef5c
2 changed files with 1 additions and 21 deletions

View File

@ -267,7 +267,7 @@ export class CollectionsService {
}
}
if ((collection.type === 'automatic' || data.type === 'automatic') && data.filter) {
if (collection.type === 'automatic' && data.filter) {
await this.updateAutomaticCollectionItems(collection, data.filter);
}

View File

@ -299,26 +299,6 @@ describe('CollectionsService', function () {
assert.equal(collection.posts.length, 2, 'Collection should have two posts');
});
it('Populates collection when the type is changed to automatic and filter is present', async function () {
const collection = await collectionsService.createCollection({
title: 'I am automatic',
description: 'testing automatic collection',
type: 'manual'
});
assert.equal(collection.type, 'manual', 'Collection should be manual');
assert.equal(collection.posts.length, 0, 'Collection should have no posts');
const automaticCollection = await collectionsService.edit({
id: collection.id,
type: 'automatic',
filter: 'featured:true'
});
assert.equal(automaticCollection?.posts.length, 2, 'Collection should have two featured post');
assert.equal(automaticCollection?.posts[0].id, 'post-3-featured', 'Collection should have the correct post');
});
it('Updates the automatic collection posts when the filter is changed', async function () {
let collection = await collectionsService.createCollection({
title: 'I am automatic',