Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ export const SubscriptionNoticeModal: React.FC<ModalProps> = ({
handleCancelRequest,
handleAcceptRequest,
}) => {
const onRequestClose = () => {
const onRequestClose = (e) => {
// If the user checked to never see this notice but subsequently cancels we will disregard their selection. We will
// only stop showing this notice if they check the box and then proceed to GitHub
if(window.localStorage.getItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY)) {
if (window.localStorage.getItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY)) {
window.localStorage.removeItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY)
}

handleCancelRequest()

// prevent the browser from handling a Cancel button click and scrolling to top
e.preventDefault()
}

const gitHubRepoName = externalLink.match(
Expand Down Expand Up @@ -86,7 +89,7 @@ export const SubscriptionNoticeModal: React.FC<ModalProps> = ({

const setDontWarnMe = (event) => {
event.stopPropagation()
if(!window.localStorage.getItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY)) {
if (!window.localStorage.getItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY)) {
window.localStorage.setItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY, "true")
} else {
window.localStorage.removeItem(DONT_SHOW_PRIVATE_GITHUB_WARNING_KEY)
Expand Down Expand Up @@ -117,7 +120,7 @@ export const SubscriptionNoticeModal: React.FC<ModalProps> = ({
<label>Don't warn me again</label>
</div>
<div className={styles.buttonsContainer}>
<a onClick={() => onRequestClose()} href="#">
<a onClick={(e) => onRequestClose(e)} href="#">
Cancel
</a>
<a id={idOfNoticeLink} href={externalLink} target="_blank">
Expand Down