From f2f9e74a3917beefea7a61f534fa61a826f31ecf Mon Sep 17 00:00:00 2001
From: Andy O'Neill <andy@scratch.mit.edu>
Date: Mon, 5 Jun 2023 09:00:19 -0400
Subject: [PATCH] feat: update cookies page with scratchtheme info

---
 src/views/cookies/cookies.jsx         | 13 ++++++++++++-
 src/views/cookies/l10n.json           |  5 +++--
 test/integration/footer-links.test.js | 12 ++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/views/cookies/cookies.jsx b/src/views/cookies/cookies.jsx
index d498725f1..8a8fc11df 100644
--- a/src/views/cookies/cookies.jsx
+++ b/src/views/cookies/cookies.jsx
@@ -12,6 +12,8 @@ const privacyPolicyLink = chunks => <a href="/privacy_policy">{chunks}</a>;
 const manageLink = chunks => <a href="http://www.allaboutcookies.org/manage-cookies">{chunks}</a>;
 const googlePoliciesLink = chunks => <a href="https://www.google.com/policies/privacy/partners">{chunks}</a>;
 const optOutLink = chunks => <a href="https://tools.google.com/dlpage/gaoptout">{chunks}</a>;
+// When this page was last updated. See 'click Cookies link' in footer-links.test.js if you update this value.
+const updated = new Date('2023-06-28T12:00:00.000-04:00');
 
 require('./cookies.scss');
 
@@ -25,7 +27,10 @@ const Cookies = injectIntl(() => (
             <section>
                 <p className="lastupdate">
                     <i>
-                        <FormattedMessage id="cookies.lastUpdated" />
+                        <FormattedMessage
+                            id="cookies.lastUpdatedFormat"
+                            values={{updated}}
+                        />
                     </i>
                 </p>
                 <p className="intro">
@@ -121,6 +126,12 @@ const Cookies = injectIntl(() => (
                                     <td><FormattedMessage id="cookies.functional.scratchPolicySeen" /></td>
                                     <td><FormattedMessage id="cookies.table.weeks.3" /></td>
                                 </tr>
+                                <tr>
+                                    <td>scratchtheme</td>
+                                    <td><a href="/privacy_policy">Scratch</a></td>
+                                    <td><FormattedMessage id="cookies.functional.scratchTheme" /></td>
+                                    <td><FormattedMessage id="cookies.table.years.1" /></td>
+                                </tr>
                                 <tr>
                                     <td>wistia-video-progress-#</td>
                                     <td><a href="https://wistia.com/privacy">Wistia</a></td>
diff --git a/src/views/cookies/l10n.json b/src/views/cookies/l10n.json
index 815793005..e8c3905ba 100644
--- a/src/views/cookies/l10n.json
+++ b/src/views/cookies/l10n.json
@@ -3,7 +3,7 @@
     "cookies.nav.types": "Types of Cookies",
     "cookies.nav.manage": "Manage Cookies",
     "cookies.nav.contact": "Contact Us",
-    "cookies.lastUpdated": "The Scratch Cookie Policy was last updated May 25, 2023",
+    "cookies.lastUpdatedFormat": "The Scratch Cookie Policy was last updated {updated, date, long}",
     "cookies.intro1": "This Cookie Policy (the <b>“Cookie Policy”</b>) is provided by Scratch Foundation (<b>“Scratch”</b>, <b>“we”</b> or <b>“us”</b>). It supplements the information and disclosures included in our <privacy>Privacy Policy</privacy>, and explains how Scratch uses Cookies on its website scratch.mit.edu (the <b>“Scratch Website”</b>) to its visitors (<b>“you”</b>, <b>“user”</b>). For the purpose of this Cookie Policy, <b>“Personal Information”</b> means any information relating to an identified or identifiable individual.",
     "cookies.intro2": "When you use the Scratch Website, we use cookies, beacons, invisible tags, unique IDs and similar technologies (collectively <b>“Cookies”</b>) to automatically record certain Personal Information from your browser or device.",
     "cookies.table.name": "Name",
@@ -29,6 +29,7 @@
     "cookies.functional.permissions": "Used to track which features of the service a logged in user is able to access.",
     "cookies.functional.exploreBy": "Used to save the user’s current search preference.",
     "cookies.functional.scratchLanguage": "Used to save information about the user’s preferred language.",
+    "cookies.functional.scratchTheme": "Used to save information about the user’s preferred color mode.",
     "cookies.functional.scratchPolicySeen": "Used to track if the user has seen a privacy policy update notification",
     "cookies.functional.wistia": "Contains a timestamp for the Scratch Website’s video-content. This allows the user to resume watching without having to start over, if the user leaves the video or Scratch Website.",
     "cookies.functional.minilogSettings": "Unclassified",
@@ -63,4 +64,4 @@
     "cookies.manageBody": "If you do not want your Personal Information to be collected through the use of Cookies, most browsers allow you to manage your Cookie preferences. You can set your browser to automatically decline Cookies or to request you to accept or decline Cookies for each site.  You can find more information about Cookies at <a>http://www.allaboutcookies.org/manage-cookies</a>.",
     "cookies.contactTitle": "Contact Us",
     "cookies.contactIntro": "If you have any questions about this Cookie Policy please contact us at privacy@scratch.mit.edu or via mail at:"
-}
\ No newline at end of file
+}
diff --git a/test/integration/footer-links.test.js b/test/integration/footer-links.test.js
index cf9076976..fc6f2c01d 100644
--- a/test/integration/footer-links.test.js
+++ b/test/integration/footer-links.test.js
@@ -125,6 +125,18 @@ describe('www-integration footer links', () => {
         expect(pathname).toMatch(/^\/privacy_policy\/?$/);
     });
 
+    test('click Cookies link', async () => {
+        await clickText('Cookies');
+        let url = await driver.getCurrentUrl();
+        let pathname = (new URL(url)).pathname;
+        expect(pathname).toMatch(/^\/cookies\/?$/);
+
+        // Verify localization of last updated message
+        let lastUpdated = await findText('The Scratch Cookie Policy was last updated June 28, 2023');
+        let lastUpdatedVisible = await lastUpdated.isDisplayed();
+        await expect(lastUpdatedVisible).toBe(true);
+    });
+
     test('click DMCA link', async () => {
         await clickText('DMCA');
         let url = await driver.getCurrentUrl();