Skip to content
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

[SD-747] feature flag to remove content rating #1457

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
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: 13 additions & 0 deletions examples/nuxt-app/test/features/site/feature-flags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,16 @@ Feature: Site feature flags
| Level 1 - Item 1 | /level-1-item-1 |
| Level 2 - Item 1 | /level-2-item-1 |
| Level 3 - Item 2 | /level-3-item-2 |

@mockserver
Scenario: Feature flags can remove the content rating form
Given I load the site fixture with "/site/shared-elements"
And the feature flag "disableContentRating" is set to "true"
And the site endpoint returns the loaded fixture

Then I load the page fixture with "/landingpage/home"
And the content rating form is enabled
And the page endpoint for path "/" returns the loaded fixture

When I visit the page "/"
Then the content rating form should not be displayed
8 changes: 6 additions & 2 deletions packages/nuxt-ripple/components/TideContentRating.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { computed, inject, onMounted, ref } from 'vue'
import type { IRplFeatureFlags } from '@dpc-sdp/ripple-tide-api/types'

interface Props {
siteSectionName: string
Expand All @@ -17,14 +18,17 @@ const contentRatingFormId = 'tide_webform_content_rating'
const isMounted = ref(false)
const pageUrl = ref('')

const featureFlags: IRplFeatureFlags = inject('featureFlags')
const showContentRating = computed(() => !featureFlags?.disableContentRating)

onMounted(() => {
isMounted.value = true
pageUrl.value = window.location.href
})
</script>

<template>
<div class="tide-content-rating rpl-u-screen-only">
<div v-if="showContentRating" class="tide-content-rating rpl-u-screen-only">
<div class="rpl-container">
<div class="rpl-grid">
<div class="rpl-col-12 rpl-col-7-m">
Expand Down
4 changes: 4 additions & 0 deletions packages/ripple-tide-api/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ export interface IRplFeatureFlags {
* @description Collapse inner links in breadcrumbs
*/
breadcrumbsCollapseInnerLinks?: boolean
/**
* @description Remove the content rating form
*/
disableContentRating?: boolean
/**
* @description Custom flags
*/
Expand Down
Loading