From 0ea56e34e11b305155901f6cb8e0b03bea84b56d Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Tue, 11 Jan 2022 09:57:20 +0200 Subject: [PATCH 1/8] Fix #5965 --- .../components/__snapshots__/TopcoderFooter.jsx.snap | 9 --------- src/shared/components/TopcoderFooter/index.jsx | 1 - 2 files changed, 10 deletions(-) diff --git a/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap b/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap index 314898ca2b..dfc40a93d9 100644 --- a/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap +++ b/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap @@ -163,15 +163,6 @@ exports[`Matches shallow shapshot 1`] = ` Blog -
  • - - Challenge Pipeline - -
  • diff --git a/src/shared/components/TopcoderFooter/index.jsx b/src/shared/components/TopcoderFooter/index.jsx index 3d073f7b58..d886390320 100644 --- a/src/shared/components/TopcoderFooter/index.jsx +++ b/src/shared/components/TopcoderFooter/index.jsx @@ -69,7 +69,6 @@ export default function TopcoderFooter() {
      Blog - Challenge Pipeline Events Calendar Forums Programs From 6d7cad9d06a633a2d41e5fe1a5a5c7502d833912 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Tue, 11 Jan 2022 10:17:03 +0200 Subject: [PATCH 2/8] Fix #5966 --- src/shared/components/Looker/index.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/shared/components/Looker/index.jsx b/src/shared/components/Looker/index.jsx index 03e7ac6ec7..773e7f6cfb 100644 --- a/src/shared/components/Looker/index.jsx +++ b/src/shared/components/Looker/index.jsx @@ -21,6 +21,7 @@ import PT from 'prop-types'; import _ from 'lodash'; import React, { Component } from 'react'; import { fixStyle } from 'utils/contentful'; +import { getRatingColor } from 'utils/tc'; import cn from 'classnames'; import { Scrollbars } from 'react-custom-scrollbars'; import './style.scss'; @@ -46,6 +47,7 @@ export default class Looker extends Component { tableHeight, tableWidth, headerIndexCol, + ratingProp, } = this.props; let { @@ -166,7 +168,11 @@ export default class Looker extends Component { } return value ? ( - {memberLinks ? ({value}) : value} + {memberLinks ? ( + + {value} + + ) : value} ) : null; }) @@ -232,6 +238,7 @@ Looker.defaultProps = { tableHeight: '100%', tableWidth: '100%', headerIndexCol: '', + ratingProp: null, }; Looker.propTypes = { @@ -253,4 +260,5 @@ Looker.propTypes = { PT.func, ]), headerIndexCol: PT.string, + ratingProp: PT.string, }; From 8af22d41167da79b97dcc26bdc7bcc23a171c599 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Tue, 11 Jan 2022 10:17:49 +0200 Subject: [PATCH 3/8] ci: on beta --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 165051d7cd..8492622fba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -363,7 +363,7 @@ workflows: filters: branches: only: - - mm-leaderboard-theme + - jan-updates-1 # This is stage env for production QA releases - "build-prod-staging": context : org-global From 0ac3e5f2ff38116e4cbb67b48883fe9ff396ab44 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Tue, 11 Jan 2022 10:46:05 +0200 Subject: [PATCH 4/8] add important for looker links --- src/shared/components/Looker/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Looker/index.jsx b/src/shared/components/Looker/index.jsx index 773e7f6cfb..ed1115e5f9 100644 --- a/src/shared/components/Looker/index.jsx +++ b/src/shared/components/Looker/index.jsx @@ -169,7 +169,7 @@ export default class Looker extends Component { return value ? ( {memberLinks ? ( - + {value} ) : value} From 0252234498746a458c450d68986ba6a4f75dd5a7 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Tue, 11 Jan 2022 11:06:31 +0200 Subject: [PATCH 5/8] important style links --- src/shared/components/Looker/index.jsx | 2 +- src/shared/components/Looker/style.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Looker/index.jsx b/src/shared/components/Looker/index.jsx index ed1115e5f9..773e7f6cfb 100644 --- a/src/shared/components/Looker/index.jsx +++ b/src/shared/components/Looker/index.jsx @@ -169,7 +169,7 @@ export default class Looker extends Component { return value ? ( {memberLinks ? ( - + {value} ) : value} diff --git a/src/shared/components/Looker/style.scss b/src/shared/components/Looker/style.scss index a320fed4e8..33b53ac099 100644 --- a/src/shared/components/Looker/style.scss +++ b/src/shared/components/Looker/style.scss @@ -106,7 +106,7 @@ $light-gray: #d4d4d4; @include roboto-medium; font-weight: 500; - color: #0d61bf !important; + color: #0d61bf; text-decoration: underline; &:hover { From b5777819305665f15ac0649c2ef1449cbc810c94 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Wed, 12 Jan 2022 11:57:51 +0200 Subject: [PATCH 6/8] fix for #5967 --- src/shared/components/Settings/Preferences/Email/index.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/components/Settings/Preferences/Email/index.jsx b/src/shared/components/Settings/Preferences/Email/index.jsx index 9b2948d851..ebdac56185 100644 --- a/src/shared/components/Settings/Preferences/Email/index.jsx +++ b/src/shared/components/Settings/Preferences/Email/index.jsx @@ -61,6 +61,11 @@ const newsletters = [ name: 'Rapid Development Match (RDM) Reminders', desc: 'Receive notifications of our brand new RDMs! These rated, development matches will be a fun new way to engage with us!', }, + { + id: 'ee26600945', + name: 'NASA Community', + desc: 'Receive email notifications for all the latest news and announcements of our NASA Member Program.', + }, ]; const programs = [ { From 41d7faa765a0889d346ad8c44298c790c42e4bfb Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Wed, 12 Jan 2022 18:29:50 +0200 Subject: [PATCH 7/8] final fixes for email pref --- .../containers/NewsletterSignupForMembers.jsx | 128 ++++++++++++------ 1 file changed, 86 insertions(+), 42 deletions(-) diff --git a/src/shared/containers/NewsletterSignupForMembers.jsx b/src/shared/containers/NewsletterSignupForMembers.jsx index d3920ce72c..c73c8925f3 100644 --- a/src/shared/containers/NewsletterSignupForMembers.jsx +++ b/src/shared/containers/NewsletterSignupForMembers.jsx @@ -31,12 +31,16 @@ class NewsletterSignupForMembersContainer extends React.Component { // Get interestIds and interest request object for mailchimp api // to use in checkSubscription and subscribe function - const { groups } = props; + const { groups, tags } = props; this.groupsIds = null; + this.tagNames = null; if (groups !== '') { this.groupsIds = groups.split(/ *, */); this.groupsIds[this.groupsIds.length - 1] = this.groupsIds[this.groupsIds.length - 1].replace(/^\s+|\s+$/g, ''); } + if (tags) { + this.tagNames = tags.split(','); + } this.isSubscribed = false; this.state = { @@ -89,13 +93,25 @@ class NewsletterSignupForMembersContainer extends React.Component { .then((dataResponse) => { if (dataResponse.status === 'subscribed') { this.isSubscribed = true; - const subscribedTags = _.keys(_.pickBy(dataResponse.interests, v => v)); - if (subscribedTags.length) { - if (_.intersection(subscribedTags, this.groupsIds).length) { - this.setState({ signupState: SIGNUP_NEWSLETTER.HIDDEN }); + if (this.groupsIds) { + const subscribedGroups = _.keys(_.pickBy(dataResponse.interests, v => v)); + if (subscribedGroups.length) { + if (_.intersection(subscribedGroups, this.groupsIds).length) { + this.setState({ signupState: SIGNUP_NEWSLETTER.HIDDEN }); + } + } else { + this.setState({ signupState: SIGNUP_NEWSLETTER.DEFAULT }); + } + } + if (!this.groupsIds && this.tagNames) { + const subscribedTags = _.map(dataResponse.tags, t => t.name); + if (subscribedTags.length) { + if (_.intersection(subscribedTags, this.tagNames).length) { + this.setState({ signupState: SIGNUP_NEWSLETTER.HIDDEN }); + } + } else { + this.setState({ signupState: SIGNUP_NEWSLETTER.DEFAULT }); } - } else { - this.setState({ signupState: SIGNUP_NEWSLETTER.DEFAULT }); } } else { this.setState({ signupState: SIGNUP_NEWSLETTER.DEFAULT }); @@ -107,49 +123,75 @@ class NewsletterSignupForMembersContainer extends React.Component { const { listId, user, } = this.props; - - const fetchUrl = `${PROXY_ENDPOINT}/${listId}/members/${this.emailHash}`; - - let data = {}; - if (!this.isSubscribed) { - data = { - email_address: user.email, - status: 'subscribed', - merge_fields: { - FNAME: user.FNAME, - LNAME: user.LNAME, - }, - }; - } + const isTagsUpdate = !!this.tagNames; + const fetchUrl = `${PROXY_ENDPOINT}/${listId}/members/${this.emailHash}${isTagsUpdate ? '/tags' : ''}`; if (this.groupsIds) { + let data = {}; + if (!this.isSubscribed) { + data = { + email_address: user.email, + status: 'subscribed', + merge_fields: { + FNAME: user.FNAME, + LNAME: user.LNAME, + }, + }; + } data.interests = {}; // eslint-disable-next-line array-callback-return this.groupsIds.map((group) => { data.interests[group] = true; }); - } - const formData = JSON.stringify(data); - // use proxy for avoid 'Access-Control-Allow-Origin' bug - await fetch(fetchUrl, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - }, - body: formData, - }).then(result => result.json()).then((dataResponse) => { - if (dataResponse.status === 'subscribed') { - // regist success - this.setState({ signupState: SIGNUP_NEWSLETTER.SIGNEDUP }); - } else { - // regist fail - this.setState({ - signupState: SIGNUP_NEWSLETTER.ERROR, - message: dataResponse.detail, - }); - } - }); + const formData = JSON.stringify(data); + // use proxy for avoid 'Access-Control-Allow-Origin' bug + await fetch(fetchUrl, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + body: formData, + }).then(result => result.json()).then((dataResponse) => { + if (dataResponse.status === 'subscribed') { + // regist success + this.setState({ signupState: SIGNUP_NEWSLETTER.SIGNEDUP }); + } else { + // regist fail + this.setState({ + signupState: SIGNUP_NEWSLETTER.ERROR, + message: dataResponse.detail, + }); + } + }); + } + if (!this.groupsIds && this.tagNames) { + const formData = JSON.stringify({ + tags: this.tagNames.map(tName => ({ + name: tName, + status: 'active', + })), + }); + // use proxy for avoid 'Access-Control-Allow-Origin' bug + await fetch(fetchUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: formData, + }).then(result => result.json()).then((dataResponse) => { + if (dataResponse.status === 204) { + // regist success + this.setState({ signupState: SIGNUP_NEWSLETTER.SIGNEDUP }); + } else { + // regist fail + this.setState({ + signupState: SIGNUP_NEWSLETTER.ERROR, + message: dataResponse.detail, + }); + } + }); + } } showSignupConfirmModal() { @@ -194,6 +236,7 @@ NewsletterSignupForMembersContainer.defaultProps = { buttonTheme: 'primary-green-md', title: 'Sign up for the Topcoder Newsletter', desc: 'Do you want to subscribe to this newsletter?', + tags: null, }; NewsletterSignupForMembersContainer.propTypes = { @@ -206,6 +249,7 @@ NewsletterSignupForMembersContainer.propTypes = { buttonTheme: PT.string, title: PT.string, desc: PT.string, + tags: PT.string, }; function mapStateToProps(state, ownProps) { From d42e7d2888bca2514bd65441ac89a865eb1798a4 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Wed, 12 Jan 2022 19:20:19 +0200 Subject: [PATCH 8/8] remove challenge pipeline --- src/shared/components/Settings/Preferences/Email/index.jsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/shared/components/Settings/Preferences/Email/index.jsx b/src/shared/components/Settings/Preferences/Email/index.jsx index ebdac56185..036779034b 100644 --- a/src/shared/components/Settings/Preferences/Email/index.jsx +++ b/src/shared/components/Settings/Preferences/Email/index.jsx @@ -26,11 +26,6 @@ function toastrError(title, message) { const SAVE_DELAY = 1000; const newsletters = [ - { - id: '9f950b43a1', - name: 'Challenge Pipeline', - desc: '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 Challenge Pipeline page.', - }, { id: 'd0c48e9da3', name: 'Gig Work',