-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove post from queue when not indexable
This change fixes updates that trigger multiple filters for the same post. Currently, when any of the filters adds the post to the update queue the post is indexed, even when other filters determine that the post should not be indexed. This change makes the last filter have the final word about this.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/cypress/integration/features/protected-content-removal.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
describe('Set password on post', () => { | ||
it('Removes Post from Index when Password is Set', () => { | ||
cy.login(); | ||
cy.maybeDisableFeature('protected_content'); | ||
|
||
// Delete previous posts, so we can be sure we just expect 1 post. | ||
cy.wpCli('post list --format=ids').then((wpCliResponse) => { | ||
if (wpCliResponse.stdout !== '') { | ||
cy.wpCli(`post delete ${wpCliResponse.stdout}`); | ||
} | ||
}); | ||
|
||
cy.publishPost({ | ||
title: 'Protected Post Removal Test', | ||
}); | ||
|
||
/** | ||
* Give Elasticsearch some time to process the new post. | ||
* | ||
* @todo instead of waiting for an arbitrary time, we should ensure the post is stored. | ||
*/ | ||
// eslint-disable-next-line cypress/no-unnecessary-waiting | ||
cy.wait(2000); | ||
|
||
// Post is indexed | ||
cy.visit('/?s=Protected+Post+Removal+Test'); | ||
cy.contains('.site-content article h2', 'Protected Post Removal Test').should('exist'); | ||
|
||
cy.wpCli('post list --format=ids').then((wpCliResponse) => { | ||
if (wpCliResponse.stdout !== '') { | ||
cy.postSetPassword(wpCliResponse.stdout, 'enter'); | ||
} | ||
}); | ||
|
||
/** | ||
* Give Elasticsearch some time to process the update. | ||
* | ||
* @todo instead of waiting for an arbitrary time, we should ensure the post is stored. | ||
*/ | ||
// eslint-disable-next-line cypress/no-unnecessary-waiting | ||
cy.wait(2000); | ||
|
||
// Post is removed from index | ||
cy.visit('/?s=Protected+Post+Removal+Test'); | ||
cy.contains('.site-content article h2', 'Protected Post Removal Test').should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters