fix: export public flag, fix button (#3098)

This commit is contained in:
Wyatt Johnson
2020-08-11 21:49:32 +00:00
committed by GitHub
parent fc6de50dde
commit 3398bd12c4
15 changed files with 26 additions and 34 deletions
@@ -34,7 +34,6 @@ exports[`renders forgot password view 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
Go back to sign in page
</a>
@@ -108,7 +108,6 @@ exports[`auth configuration renders all auth enabled 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
Forgot your password?
</a>
@@ -373,7 +372,6 @@ exports[`renders sign in view 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
Sign up
</a>
@@ -486,7 +484,6 @@ exports[`renders sign in view 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
Forgot your password?
</a>
@@ -390,7 +390,6 @@ exports[`renders sign up form 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
Sign in
</a>
@@ -130,23 +130,24 @@ export const CommentContainer: FunctionComponent<Props> = ({
from: "COMMENT_STREAM",
});
// If the feature for read more new tab is enabled, then redirect the
// user.
// If the feature flag for opening this in a new tab is enabled, then we
// don't need to do anything!
if (settings.featureFlags.includes(GQLFEATURE_FLAG.READ_MORE_NEW_TAB)) {
return;
}
// Prevent the event from acting.
e.preventDefault();
// If the feature for read more new tab is enabled, then redirect the
// user.
if (settings.featureFlags.includes(GQLFEATURE_FLAG.READ_MORE_NEW_TAB)) {
const url = getURLWithCommentID(story.url, comment.id);
// Update the current view to show the comment.
void setCommentID({ id: comment.id });
window.open(url, "_blank", "noreferrer");
} else {
void setCommentID({ id: comment.id });
}
// Return false to prevent the navigation from occuring.
return false;
},
[eventEmitter, comment.id, settings.featureFlags, story.url, setCommentID]
[eventEmitter, comment.id, settings.featureFlags, setCommentID]
);
const isLoggedIn = !!viewer;
@@ -29,7 +29,7 @@ const ShowConversationLink: FunctionComponent<ShowConversationLinkProps> = (
mouseHover: styles.mouseHover,
disabled: styles.disabled,
}),
[styles]
[]
);
return (
@@ -42,7 +42,7 @@ const ShowConversationLink: FunctionComponent<ShowConversationLinkProps> = (
classes={classesOverride}
href={props.href}
onClick={props.onClick}
target="_parent"
target="_blank"
anchor
>
Read More of this Conversation &gt;
@@ -20,7 +20,7 @@ exports[`renders correctly 1`] = `
href="http://localhost/comment"
id="id"
onClick={[Function]}
target="_parent"
target="_blank"
variant="textUnderlined"
>
Read More of this Conversation &gt;
@@ -531,7 +531,6 @@ exports[`renders comment stream 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
<i
aria-hidden="true"
@@ -672,7 +671,6 @@ exports[`renders comment stream 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
<i
aria-hidden="true"
@@ -72,7 +72,6 @@ exports[`renders permalink view 1`] = `
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
>
View full discussion
</a>
@@ -72,7 +72,6 @@ exports[`renders permalink view with unknown comment 1`] = `
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
>
View full discussion
</a>
@@ -295,8 +295,8 @@ exports[`post a reply: open reply form 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
rel="noopener noreferrer"
target="_blank"
>
Read More of this Conversation &gt;
</a>
@@ -1964,8 +1964,8 @@ exports[`renders comment stream 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
rel="noopener noreferrer"
target="_blank"
>
Read More of this Conversation &gt;
</a>
@@ -295,8 +295,8 @@ exports[`renders deepest comment with link 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
rel="noopener noreferrer"
target="_blank"
>
Read More of this Conversation &gt;
</a>
@@ -72,7 +72,6 @@ exports[`renders profile 1`] = `
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
>
<div
className="Box-root Flex-root Flex-flex Flex-justifyCenter"
@@ -154,7 +153,6 @@ exports[`renders profile 1`] = `
onMouseOver={[Function]}
onTouchEnd={[Function]}
target="_parent"
type="button"
>
<div
className="Box-root Flex-root Flex-flex Flex-justifyCenter"
@@ -84,7 +84,7 @@ const BaseButton: FunctionComponent<Props> = ({
console.warn(
"BaseButton used as anchor does not support the `type` property"
);
} else if (type === undefined) {
} else if (!anchor && type === undefined) {
// Default to button
type = "button";
}
@@ -8,7 +8,6 @@ exports[`renders as anchor 1`] = `
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="button"
>
Push Me
</a>
+4 -1
View File
@@ -22,7 +22,10 @@ const FEATURE_FLAGS = Object.values(GQLFEATURE_FLAG);
* PUBLIC_FEATURE_FLAGS are flags that are allowed to be returned when accessed
* by a user with non-staff permissions.
*/
const PUBLIC_FEATURE_FLAGS = [GQLFEATURE_FLAG.DISCUSSIONS];
const PUBLIC_FEATURE_FLAGS = [
GQLFEATURE_FLAG.DISCUSSIONS,
GQLFEATURE_FLAG.READ_MORE_NEW_TAB,
];
type FlagFilter = (flag: GQLFEATURE_FLAG | string) => boolean;