Skip to content

Commit

Permalink
Merge pull request #4611 from coralproject/fix/CORL-3167-recache-stor…
Browse files Browse the repository at this point in the history
…y-hidden-if-no-data-cache

[CORL-3167]: Only show story caching actions if data cache enabled
  • Loading branch information
tessalt committed May 6, 2024
2 parents 2aa6d42 + f88c704 commit fafa513
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { graphql } from "relay-runtime";

import RecacheStoryAction from "coral-admin/components/StoryInfoDrawer/RecacheStoryAction";
import { withFragmentContainer } from "coral-framework/lib/relay";
import { GQLSTORY_STATUS } from "coral-framework/schema";
import { GQLFEATURE_FLAG, GQLSTORY_STATUS } from "coral-framework/schema";
import { Flex, HorizontalGutter, TextLink } from "coral-ui/components/v2";
import ArchivedMarker from "coral-ui/components/v3/ArchivedMarker/ArchivedMarker";

Expand Down Expand Up @@ -32,6 +32,9 @@ const StoryInfoDrawerContainer: FunctionComponent<Props> = ({
viewer,
settings,
}) => {
const dataCacheEnabled = settings.featureFlags.includes(
GQLFEATURE_FLAG.DATA_CACHE
);
return (
<HorizontalGutter spacing={4} className={styles.root}>
<Flex justifyContent="flex-start">
Expand Down Expand Up @@ -84,13 +87,17 @@ const StoryInfoDrawerContainer: FunctionComponent<Props> = ({
<div className={styles.storyDrawerAction}>
<RescrapeStory storyID={story.id} />
</div>
<div className={styles.storyDrawerAction}>
<RecacheStoryAction storyID={story.id} />
</div>
{story.cached && (
<div className={styles.storyDrawerAction}>
<InvalidateCachedStoryAction storyID={story.id} />
</div>
{dataCacheEnabled && (
<>
<div className={styles.storyDrawerAction}>
<RecacheStoryAction storyID={story.id} />
</div>
{story.cached && (
<div className={styles.storyDrawerAction}>
<InvalidateCachedStoryAction storyID={story.id} />
</div>
)}
</>
)}
{viewer && (
<div className={styles.flexSizeToContentWidth}>
Expand Down Expand Up @@ -139,6 +146,7 @@ const enhanced = withFragmentContainer<Props>({
`,
settings: graphql`
fragment StoryInfoDrawerContainer_settings on Settings {
featureFlags
...ModerateStoryButton_settings
}
`,
Expand Down

0 comments on commit fafa513

Please sign in to comment.