Skip to content

Commit 4adae49

Browse files
committed
deny /tips from being gated
1 parent 801369e commit 4adae49

File tree

3 files changed

+87
-17
lines changed

3 files changed

+87
-17
lines changed

dotcom-rendering/README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,44 @@ Frontend rendering framework for theguardian.com. It uses [React](https://reactj
66

77
This guide will help you get the `dotcom-rendering` application running on your development machine.
88

9+
To download the repository
10+
11+
```
12+
$ git clone [email protected]:guardian/dotcom-rendering.git
13+
$ cd dotcom-rendering
14+
```
15+
916
### Install Node.js
1017

11-
The only thing you need to make sure you have installed before you get going is [Node.js](https://nodejs.org).
18+
Make sure you have [Node.js](https://nodejs.org) installed.
1219

13-
We recommend using [fnm](https://github.com/Schniz/fnm) to help manage multiple versions of Node.js on on machine.
20+
We recommend using [fnm](https://github.com/Schniz/fnm) to help manage multiple versions of Node.js on one machine.
1421

1522
Once Node is installed, make sure you're using the correct package manager by [enabling corepack](https://github.com/nodejs/corepack?tab=readme-ov-file#utility-commands):
1623

1724
```sh
1825
$ corepack enable
1926
```
2027

21-
> [!NOTE]
22-
>
23-
> If you're using `asdf`, you'll need to run `asdf reshim nodejs` after running `corepack enable`.
28+
If you're using `asdf`, you'll need to run `asdf reshim nodejs` after running `corepack enable`.
29+
30+
### Install Dependencies
2431

25-
### Running instructions
32+
run
33+
34+
```
35+
$ make install
36+
```
37+
38+
If it complains that you do not have the right version of node, then run (or replace with the correct version manager or the correct version):
39+
40+
```
41+
$ fnm install 22.14.0
42+
```
43+
44+
### Running on local
2645

2746
```sh
28-
$ git clone [email protected]:guardian/dotcom-rendering.git
29-
$ cd dotcom-rendering
3047
$ make dev
3148
```
3249

@@ -44,7 +61,7 @@ http://localhost:3030/ArticleJson?url=https://www.theguardian.com/sport/2019/jul
4461

4562
If you're new to TypeScript projects, if you're trying to integrate with other applications or if you prefer to take things slow, we also have a more [detailed setup guide](docs/contributing/detailed-setup-guide.md).
4663

47-
### Technologies
64+
## Technologies
4865

4966
| Technology | Description |
5067
| -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

dotcom-rendering/docs/contributing/detailed-setup-guide.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,44 @@ This high level diagram shows the difference between the data flow when DCR is u
88

99
## Developing
1010

11-
### Setup
11+
## Getting started
1212

13-
The only thing you need to make sure you have installed before you get going is Node.
13+
To download the repository
1414

15-
#### Node.js
15+
```
16+
$ git clone [email protected]:guardian/dotcom-rendering.git
17+
$ cd dotcom-rendering
18+
```
19+
20+
### Node.js
21+
22+
Make sure you have [Node.js](https://nodejs.org) installed.
1623

1724
We recommend using [fnm](https://github.com/Schniz/fnm) to help manage multiple versions of Node.js on on machine.
1825

19-
### Start
26+
### Install Dependencies
27+
28+
run
29+
30+
```
31+
$ make install
32+
```
33+
34+
If it complains that you do not have the right version of node, then run (or replace with the correct version manager or the correct version):
35+
36+
```
37+
$ fnm install 22.14.0
38+
```
2039

21-
Start the development server:
40+
### Running on local
2241

2342
```sh
24-
make dev
43+
$ make dev
2544
```
2645

2746
This will start the development server on port 3030: [http://localhost:3030](http://localhost:3030).
2847

29-
> Note: To run the development server with support for legacy browsers, use `make dev-legacy`
48+
Note: To run the development server with support for legacy browsers, use `make dev-legacy`
3049

3150
### Previewing article on local
3251

dotcom-rendering/src/components/SignInGateSelector.importable.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,43 @@ const SignInGateSelectorDefault = ({
370370
// Auxia Integration Experiment //
371371
// -------------------------------
372372

373+
/*
374+
Date: 29th April 2025
375+
376+
We have a request to prevent sign-in gate for a specific URL. This feels like an
377+
adhoc request and not a new general feature to implement.
378+
379+
We have a check in SDC: https://github.com/guardian/support-dotcom-components/pull/1345 ,
380+
to prevent the Auxia gate from showing, but we also need to prevent the legacy gate from
381+
showing. For a cleaner implementation. we are simply going to prevent any of the two
382+
gates components from rendering.
383+
384+
To keep things simple, we are going to add a check in SignInGateSelector, which seems
385+
like a good place.
386+
*/
387+
388+
export const pageIdIsAllowedForGating = (pageId: string): boolean => {
389+
// This function was introduced to handle the specific request of not showing a gate for
390+
// this url: https://www.theguardian.com/tips
391+
392+
// pageId is the path without the starting slash
393+
// example:
394+
// - full url: https://www.theguardian.com/world/2025/apr/29/canada-election-result-liberal-win-mark-carney-anti-trump
395+
// - pageId: world/2025/apr/29/canada-election-result-liberal-win-mark-carney-anti-trump
396+
397+
const denyPaths = ['tips'];
398+
399+
return !denyPaths.some((denyPath) => pageId.startsWith(denyPath));
400+
};
401+
373402
export const SignInGateSelector = ({
374403
contentType,
375404
sectionId = '',
376405
tags,
377406
isPaidContent,
378407
isPreview,
379408
host = 'https://theguardian.com/',
380-
pageId,
409+
pageId, // pageId is the path without starting slash
381410
idUrl = 'https://profile.theguardian.com',
382411
switches,
383412
contributionsServiceUrl,
@@ -389,6 +418,10 @@ export const SignInGateSelector = ({
389418
'auxia-signin-gate',
390419
);
391420

421+
if (!pageIdIsAllowedForGating(pageId)) {
422+
return <></>;
423+
}
424+
392425
if (!userIsInAuxiaExperiment) {
393426
return (
394427
<SignInGateSelectorDefault
@@ -529,6 +562,7 @@ const fetchProxyGetTreatments = async (
529562
): Promise<AuxiaProxyGetTreatmentsResponse> => {
530563
// pageId example: 'money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
531564
const articleIdentifier = `www.theguardian.com/${pageId}`;
565+
// articleIdentifier example: 'www.theguardian.com/money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
532566
const url = `${contributionsServiceUrl}/auxia/get-treatments`;
533567
const headers = {
534568
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)