mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
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:
parent
623599af1e
commit
cf48d4ef5c
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user