Skip to content

Commit

Permalink
fix: show add review/request button to community members
Browse files Browse the repository at this point in the history
This change returns community information for a user's default persona, which allows the button to be displayed. Without it, the user appears as not being a member of any community, so the app would never show the button.

I'm not sure if there's any other logic that depends on this information, so there's a chance it might fix/create bugs in untested code.

Fixes #429
  • Loading branch information
thewilkybarkid committed Dec 13, 2021
1 parent 9e8a635 commit 572d696
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions integration/src/browser/add-a-request-to-a-community.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import { screenshot } from './utils';

test.asACommunityMember(
'can add a request to a community',
async ({ community, page, preprint }, { fixme }) => {
async ({ community, page, preprint }) => {
await page.goto(`/communities/${community.slug}`);

const addRequestButton = page.locator('button:has-text("Add Request")');
const preprints = page.locator(
'.MuiPaper-root:has-text("Preprints with PREreviews or requests for PREreviews")',
);

fixme(true, '"Add Request" button is not shown for members');

await expect(addRequestButton).toBeVisible();
expect(await screenshot(preprints)).toMatchSnapshot(
'empty-with-button.png',
Expand Down
4 changes: 1 addition & 3 deletions integration/src/browser/add-a-review-to-a-community.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import { screenshot } from './utils';

test.asACommunityMember(
'can add a review to a community',
async ({ community, page, preprint }, { fixme }) => {
async ({ community, page, preprint }) => {
await page.goto(`/communities/${community.slug}`);

const addReviewButton = page.locator('button:has-text("Add PREreview")');
const preprints = page.locator(
'.MuiPaper-root:has-text("Preprints with PREreviews")',
);

fixme(true, '"Add PREreview" button is not shown for members');

await expect(addReviewButton).toBeVisible();
expect(await screenshot(preprints)).toMatchSnapshot(
'empty-with-button.png',
Expand Down
1 change: 1 addition & 0 deletions src/backend/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default function controller(users, contacts, keys, thisUser) {
'contacts',
'keys',
'defaultPersona.badges',
'defaultPersona.communities',
]);
} catch (err) {
log.debug(err);
Expand Down

0 comments on commit 572d696

Please sign in to comment.