-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #569 from ensdomains/fix/extend-warning-logic
fix: extend warning not showing when user is owner but not manager
- Loading branch information
Showing
6 changed files
with
36 additions
and
8 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
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
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
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
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,17 @@ | ||
import { shouldShowExtendWarning } from "./shouldShowExtendWarning" | ||
|
||
it('should return true when can edit', () => { | ||
expect(shouldShowExtendWarning({ canEdit: true } as any)).toBe(true) | ||
}) | ||
|
||
it('should return true when can send', () => { | ||
expect(shouldShowExtendWarning({ canSend: true } as any)).toBe(true) | ||
}) | ||
|
||
it('should return false when no abilities', () => { | ||
expect(shouldShowExtendWarning(undefined)).toBe(false) | ||
}) | ||
|
||
it('should return false when no edit or send abilities', () => { | ||
expect(shouldShowExtendWarning({ canEdit: false, canSend: false } as any)).toBe(false) | ||
}) |
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,6 @@ | ||
import { Abilities } from '@app/hooks/abilities/useAbilities' | ||
|
||
export const shouldShowExtendWarning = (abilities: Abilities | undefined) => { | ||
if (!abilities) return false | ||
return abilities?.canEdit || abilities.canSend | ||
} |