Skip to content

Commit 717b177

Browse files
Revert "Merge branch 'develop' into gsheet-contentful"
This reverts commit 4857f16, reversing changes made to cf02e74.
1 parent 4857f16 commit 717b177

File tree

14 files changed

+146
-314
lines changed

14 files changed

+146
-314
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ workflows:
282282
filters:
283283
branches:
284284
only:
285-
- free
285+
- gsheet-contentful
286286
# This is alternate dev env for parallel testing
287287
- "build-qa":
288288
context : org-global

__tests__/shared/components/Settings/Preferences/Email/__snapshots__/index.jsx.snap

Lines changed: 62 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,69 @@ exports[`renders email preferences setting page correctly 1`] = `
1010
E-Mail Preferences
1111
</h1>
1212
<div
13-
className="src-shared-components-Settings-Preferences-Email-___styles__unsubscribed-msg___3yh6s"
13+
className="src-shared-components-Settings-Preferences-Email-___styles__sub-title___2Fh1W"
1414
>
15-
<h3>
16-
You are not subscribed to receive Topcoder emails
17-
</h3>
18-
<p>
19-
If this was a mistake or if you would like to resubscribe, please click the button below.
20-
</p>
21-
<ThemedButton
22-
active={false}
23-
composeAdhocTheme="deeply"
24-
composeContextTheme="softly"
25-
disabled={false}
26-
enforceA={false}
27-
mapThemrProps={[Function]}
28-
onClick={[Function]}
29-
onMouseDown={null}
30-
openNewTab={false}
31-
replace={false}
32-
size={null}
33-
themePriority="adhoc-context-default"
34-
to={null}
35-
type="button"
36-
>
37-
Resubscribe
38-
</ThemedButton>
15+
Your preferences
16+
</div>
17+
<div
18+
className="src-shared-components-Settings-Preferences-Email-___styles__preferences-container___38AVF"
19+
>
20+
<ToggleableItem
21+
checked={false}
22+
id="Pipeline"
23+
onToggle={[Function]}
24+
primaryText="Challenge Pipeline"
25+
secondaryText="Subscribe to this newsletter if you want to get updates on the types of challenges coming up in the future. To view these challenges at your leisure you can always visit the <a href=\\"https://www.topcoder.com/community/pipeline\\" style=\\"color:#0d61bf;text-decoration:underline\\">Challenge Pipeline</a> page."
26+
value="Pipeline"
27+
/>
28+
<ToggleableItem
29+
checked={false}
30+
id="Gig Work"
31+
onToggle={[Function]}
32+
primaryText="Gig Work"
33+
secondaryText="This newsletter gets sent out at various times, specifically when we have an opportunity of mass appeal. For more information you can visit the <a href=\\"https://www.topcoder.com/community/taas\\" style=\\"color:#0d61bf;text-decoration:underline\\">Gig Work</a> page."
34+
value="Gig Work"
35+
/>
36+
<ToggleableItem
37+
checked={false}
38+
id="Monthly Newsletter"
39+
onToggle={[Function]}
40+
primaryText="Monthly Newsletter"
41+
secondaryText="This newsletter gets sent out at the end of every month and contains a variety of important information across all of our tracks."
42+
value="Monthly Newsletter"
43+
/>
44+
<ToggleableItem
45+
checked={false}
46+
id="Marathon Match Reminders"
47+
onToggle={[Function]}
48+
primaryText="Marathon Match Reminders"
49+
secondaryText="Receive updates whenever a new marathon match is scheduled."
50+
value="Marathon Match Reminders"
51+
/>
52+
<ToggleableItem
53+
checked={false}
54+
id="Single Round Match Reminders"
55+
onToggle={[Function]}
56+
primaryText="Single Round Match (SRM) Reminders"
57+
secondaryText="Attention Competitive Programmers! If there is any newsletter you are subscribing too, it better be this one. Receive updates when a new SRM event is scheduled."
58+
value="Single Round Match Reminders"
59+
/>
60+
<ToggleableItem
61+
checked={false}
62+
id="TCO Tuesdays"
63+
onToggle={[Function]}
64+
primaryText="TCO Newsletter"
65+
secondaryText="For all the latest updates surrounding the <a href=\\"https://www.topcoder.com/community/member-programs/topcoder-open\\" style=\\"color:#0d61bf;text-decoration:underline\\">Topcoder Open</a> you should definitely be subscribing to this one. Expect an update in your mailbox every Tuesday!"
66+
value="TCO Tuesdays"
67+
/>
68+
<ToggleableItem
69+
checked={false}
70+
id="RDM"
71+
onToggle={[Function]}
72+
primaryText="Rapid Development Match (RDM) Reminders"
73+
secondaryText="Receive notifications of our brand new RDMs! These rated, development matches will be a fun new way to engage with us!"
74+
value="RDM"
75+
/>
3976
</div>
4077
</div>
4178
`;

package-lock.json

Lines changed: 0 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server/routes/mailchimp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ routes.post('/:listId/members', (req, res, next) => new MailchimpService().doReg
2020

2121
routes.get('/:listId/members/:emailHash', (req, res) => new MailchimpService().checkSubscription(req).then(res.send.bind(res)));
2222

23-
routes.put('/:listId/members/:emailHash', (req, res) => new MailchimpService().updateMember(req).then(res.send.bind(res)));
23+
routes.put('/:listId/members/:emailHash', (req, res) => new MailchimpService().subscribeInterests(req).then(res.send.bind(res)));
2424

2525
routes.post('/:listId/members/:emailHash/tags', (req, res) => new MailchimpService().subscribeTags(req).then(res.send.bind(res)));
2626

src/server/services/mailchimp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class MailchimpService {
5151
return res.json();
5252
}
5353

54-
async updateMember(req) {
54+
async subscribeInterests(req) {
5555
const formData = JSON.stringify(req.body);
5656
const res = await fetch(`${this.mailchimpBaseUrl}/lists/${req.params.listId}/members/${req.params.emailHash}`, {
5757
method: 'PUT',

src/shared/actions/newsletterPreferences.js

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ async function fetchDataDone(emailHash, listId = config.NEWSLETTER_SIGNUP.DEFAUL
3535

3636
return {
3737
email: emailHash,
38-
preferences: subs.interests,
39-
status: subs.status,
38+
preferences: subs.tags,
4039
error,
4140
};
4241
} catch (error) {
@@ -49,24 +48,26 @@ async function fetchDataDone(emailHash, listId = config.NEWSLETTER_SIGNUP.DEFAUL
4948

5049
// Updates member newsletter subscription
5150
async function updateSubscriptionsDone(
52-
emailHash, groupId, status, listId = config.NEWSLETTER_SIGNUP.DEFAUL_LIST_ID,
51+
emailHash, tagId, status, listId = config.NEWSLETTER_SIGNUP.DEFAUL_LIST_ID,
5352
) {
5453
/* NOTE: In the real life in most cases you don't want to use fetch() directly
5554
* in an action. You want to create a service for your calls and use it here.
5655
* However, in this example, to keep it a bit more compact, we use fetch()
5756
* directly here. */
5857
try {
5958
let error = false;
60-
const fetchUrl = `${PROXY_ENDPOINT}/${listId}/members/${emailHash}`;
59+
const fetchUrl = `${PROXY_ENDPOINT}/${listId}/members/${emailHash}/tags`;
6160

6261
const data = {
63-
interests: { [groupId]: !!status },
62+
tags: [
63+
{ name: tagId, status: status ? 'active' : 'inactive' },
64+
],
6465
};
6566

6667
const formData = JSON.stringify(data);
6768
// use proxy for avoid 'Access-Control-Allow-Origin' bug
6869
await fetch(fetchUrl, {
69-
method: 'PUT',
70+
method: 'POST',
7071
headers: {
7172
'Content-Type': 'application/json',
7273
},
@@ -78,68 +79,26 @@ async function updateSubscriptionsDone(
7879
});
7980

8081
return {
81-
id: groupId,
82+
id: tagId,
8283
checked: status,
8384
email: emailHash,
8485
error,
8586
};
8687
} catch (error) {
8788
return {
88-
id: groupId,
89+
id: tagId,
8990
checked: status,
9091
email: emailHash,
9192
error,
9293
};
9394
}
9495
}
9596

96-
/**
97-
* Resubscribe member for TC emails/list
98-
* @param {string} emailHash the email
99-
*/
100-
async function resubscribeDone(emailHash, listId = config.NEWSLETTER_SIGNUP.DEFAUL_LIST_ID) {
101-
try {
102-
let error = false;
103-
const fetchUrl = `${PROXY_ENDPOINT}/${listId}/members/${emailHash}`;
104-
105-
const data = {
106-
status: 'subscribed',
107-
};
108-
109-
const formData = JSON.stringify(data);
110-
// use proxy for avoid 'Access-Control-Allow-Origin' bug
111-
await fetch(fetchUrl, {
112-
method: 'PUT',
113-
headers: {
114-
'Content-Type': 'application/json',
115-
},
116-
body: formData,
117-
})
118-
.then((result) => {
119-
if (!result.ok) error = true;
120-
return result.json();
121-
});
122-
123-
return {
124-
email: emailHash,
125-
resubscribe: true,
126-
error,
127-
};
128-
} catch (error) {
129-
return {
130-
email: emailHash,
131-
error,
132-
};
133-
}
134-
}
135-
13697
export default createActions({
13798
NEWSLETTER_PREFERENCES: {
13899
FETCH_DATA_INIT: fetchDataInit,
139100
FETCH_DATA_DONE: fetchDataDone,
140101
UPDATE_TAG_INIT: _.identity,
141102
UPDATE_TAG_DONE: updateSubscriptionsDone,
142-
RESUBSCRIBE_INIT: _.identity,
143-
RESUBSCRIBE_DONE: resubscribeDone,
144103
},
145104
});

src/shared/components/NewsletterSignupForMembers/ConfirmModal/style.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,5 @@
3333

3434
button {
3535
margin: 24px 12px 0;
36-
37-
&:first-child {
38-
margin-right: 12px !important;
39-
}
4036
}
4137
}

0 commit comments

Comments
 (0)