Skip to content

Commit

Permalink
Merge pull request #1457 from dpc-sdp/feature/content-rating-flag
Browse files Browse the repository at this point in the history
[SD-747] feature flag to remove content rating
  • Loading branch information
lambry authored Feb 18, 2025
2 parents 25ae812 + 0b2ee1f commit f4e2660
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
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

0 comments on commit f4e2660

Please sign in to comment.