Skip to content

Commit

Permalink
Hide posts with "devhub-test" tag from feed (#486)
Browse files Browse the repository at this point in the history
* Remove devhub-test posts from feed

* add tests

* Fix formatting
  • Loading branch information
itexpert120 authored Nov 17, 2023
1 parent 4324a9c commit f194864
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
23 changes: 23 additions & 0 deletions playwright-tests/tests/feed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@ test("should show post history for posts in the feed", async ({ page }) => {
await page.waitForSelector(desiredChildSelector, { state: "visible" });
});

test("should hide posts with devhub-test tag", async ({ page }) => {
// go to feeds page
await page.goto("/devhub.near/widget/app?page=feed");

// look for tag input
const tagInputSelector = 'input[placeholder="Search by tag"]';
await page.waitForSelector(tagInputSelector, {
state: "visible",
});
await page.click(tagInputSelector);

// select devhub-test
const testingTagSelector = 'a.dropdown-item[aria-label="devhub-test"]';
await page.click(testingTagSelector);

// check if no posts are found
const noPostFoundSelector =
'p.text-secondary:has-text("No posts matches search")';
await page.waitForSelector(noPostFoundSelector, {
state: "visible",
});
});

test.describe("Wallet is connected", () => {
// sign in to wallet
test.use({
Expand Down
21 changes: 15 additions & 6 deletions src/devhub/entity/post/List.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,22 @@ function getPostIds() {
where = { parent_id: { _is_null: true }, ...where };
}

// Don't show blog
// Don't show blog and devhub-test posts
where = {
_not: {
labels: { _contains: "blog" },
parent_id: { _is_null: true },
post_type: { _eq: "Comment" },
},
_and: [
{
_not: {
labels: { _contains: "blog" },
parent_id: { _is_null: true },
post_type: { _eq: "Comment" },
},
},
{
_not: {
labels: { _contains: "devhub-test" },
},
},
],
...where,
};

Expand Down

0 comments on commit f194864

Please sign in to comment.