-
Notifications
You must be signed in to change notification settings - Fork 9
Group page unauth #5832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Group page unauth #5832
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
48ff92b
Unauthenticated users can now view public group information in the
maverbiest c617803
Allow for contactEmail being `null` in GroupForm
maverbiest 2556fd6
Fix formatting and eslint errors
maverbiest fa3ad45
Minor CSS formatting
maverbiest bbda0c2
Check accessToken to decide if email is shown. Added tests for GroupPage
maverbiest ad8ce7e
Formatting
maverbiest 5a2f911
Added additional test for GroupPage, some other Claude suggestions
maverbiest 398f02c
Formatting
maverbiest 3294fda
Moved log-in cta to table with group info
maverbiest 9aecba5
Updated GroupPage tests and ran formatting
maverbiest 544f7a2
typo
maverbiest bc4701a
Fixed typo in test
maverbiest e5e0aa0
Update website/src/components/User/GroupPage.tsx
maverbiest ae13410
Fixed test to look for updated log-in message
maverbiest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,75 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { describe, expect, test } from 'vitest'; | ||
|
|
||
| import { GroupPage } from './GroupPage'; | ||
| import { testAccessToken, testConfig, testDatabaseName, testGroups, testUser } from '../../../vitest.setup'; | ||
|
|
||
| const DUMMY_GROUP_DETAILS = { | ||
| group: testGroups[0], | ||
| users: [testUser], | ||
| }; | ||
|
|
||
| describe('GroupPage', () => { | ||
| test('test authenticated can edit view', () => { | ||
| render( | ||
| <GroupPage | ||
| prefetchedGroupDetails={DUMMY_GROUP_DETAILS} | ||
| clientConfig={testConfig.public} | ||
| accessToken={testAccessToken} | ||
| username={testUser.name} | ||
| userGroups={testGroups} | ||
| organisms={[]} | ||
| databaseName={testDatabaseName} | ||
| loginUrl='' | ||
| />, | ||
| ); | ||
|
|
||
| const targetString = `to ${testDatabaseName} see full group details`; | ||
| expect(screen.queryByText(targetString)).toBeNull(); | ||
| expect(screen.getByText(testGroups[0].contactEmail!)).toBeVisible(); | ||
| expect(screen.getByRole('heading', { name: `Sequences available in ${testDatabaseName}` })).toBeVisible(); | ||
| expect(screen.getByRole('heading', { name: 'Users' })).toBeVisible(); | ||
| }); | ||
|
|
||
| test('test authenticated cannot edit view', () => { | ||
| render( | ||
| <GroupPage | ||
| prefetchedGroupDetails={DUMMY_GROUP_DETAILS} | ||
| clientConfig={testConfig.public} | ||
| accessToken={testAccessToken} | ||
| username={testUser.name} | ||
| userGroups={[]} | ||
| organisms={[]} | ||
| databaseName={testDatabaseName} | ||
| loginUrl='' | ||
| />, | ||
| ); | ||
|
|
||
| const targetString = `to ${testDatabaseName} see full group details`; | ||
| expect(screen.queryByText(targetString)).toBeNull(); | ||
| expect(screen.getByText(testGroups[0].contactEmail!)).toBeVisible(); | ||
| expect(screen.getByRole('heading', { name: `Sequences available in ${testDatabaseName}` })).toBeVisible(); | ||
| expect(screen.queryByRole('heading', { name: /users/i })).toBeNull(); | ||
| }); | ||
|
|
||
| test('test unauthenticated view', () => { | ||
| render( | ||
| <GroupPage | ||
| prefetchedGroupDetails={DUMMY_GROUP_DETAILS} | ||
| clientConfig={testConfig.public} | ||
| accessToken='' | ||
| username='' | ||
| userGroups={[]} | ||
| organisms={[]} | ||
| databaseName={testDatabaseName} | ||
| loginUrl='' | ||
| />, | ||
| ); | ||
|
|
||
| const targetString = `to ${testDatabaseName} to see contact details for the group.`; | ||
| expect(screen.queryByText(targetString)).toBeVisible(); | ||
| expect(screen.queryByText(testGroups[0].contactEmail!)).toBeNull(); | ||
| expect(screen.getByRole('heading', { name: `Sequences available in ${testDatabaseName}` })).toBeVisible(); | ||
| expect(screen.queryByRole('heading', { name: /users/i })).toBeNull(); | ||
| }); | ||
maverbiest marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export function createAuthorizationHeader(token: string) { | ||
| return { Authorization: `Bearer ${token}` }; // eslint-disable-line @typescript-eslint/naming-convention | ||
| export function createAuthorizationHeader(token?: string) { | ||
| return token ? { Authorization: `Bearer ${token}` } : undefined; // eslint-disable-line @typescript-eslint/naming-convention | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.