Skip to content

Commit

Permalink
馃悰 delete all content if subscriber is associated with a post (#7962)
Browse files Browse the repository at this point in the history
closes #7875
- we need to delete the subscribers before deleting the posts
  • Loading branch information
kirrg001 authored and kevinansfield committed Feb 8, 2017
1 parent cc01547 commit 72e9f0a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/server/api/db.js
Expand Up @@ -92,6 +92,7 @@ db = {

function deleteContent() {
var collections = [
models.Subscriber.findAll(queryOpts),
models.Post.findAll(queryOpts),
models.Tag.findAll(queryOpts)
];
Expand Down
2 changes: 1 addition & 1 deletion core/test/integration/api/api_db_spec.js
Expand Up @@ -9,7 +9,7 @@ describe('DB API', function () {
// Keep the DB clean
before(testUtils.teardown);
afterEach(testUtils.teardown);
beforeEach(testUtils.setup('users:roles', 'settings', 'posts', 'perms:db', 'perms:init'));
beforeEach(testUtils.setup('users:roles', 'settings', 'posts', 'subscriber', 'perms:db', 'perms:init'));

should.exist(dbAPI);

Expand Down
2 changes: 1 addition & 1 deletion core/test/integration/api/api_subscription_spec.js
Expand Up @@ -15,7 +15,7 @@ describe('Subscribers API', function () {
// Keep the DB clean
before(testUtils.teardown);
afterEach(testUtils.teardown);
beforeEach(testUtils.setup('users:roles', 'perms:subscriber', 'perms:init', 'subscriber'));
beforeEach(testUtils.setup('users:roles', 'perms:subscriber', 'perms:init', 'posts', 'subscriber'));

should.exist(SubscribersAPI);

Expand Down
2 changes: 2 additions & 0 deletions core/test/utils/fixtures/data-generator.js
Expand Up @@ -314,6 +314,8 @@ DataGenerator.Content = {
]
};

DataGenerator.Content.subscribers[0].post_id = DataGenerator.Content.posts[0].id;

DataGenerator.forKnex = (function () {
var posts,
tags,
Expand Down

0 comments on commit 72e9f0a

Please sign in to comment.