Skip to content

Commit

Permalink
Facebook name and photo was not saving on first facebook sign-ins
Browse files Browse the repository at this point in the history
Made sure VoterActions.voterFacebookSaveToCurrentAccount() was being
called when appropriate.
Verify that this solves wevote/issues/42
  • Loading branch information
SailingSteve committed Sep 2, 2021
1 parent f0842fe commit c936078
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
9 changes: 7 additions & 2 deletions src/js/components/Facebook/FacebookSignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class FacebookSignIn extends Component {
}
}, 100);
} else {
const { facebook_email: fbEmail, first_name: fbFirst, last_name: fbLast } = VoterStore.getVoter();
if (fbEmail === null || fbFirst === null || fbLast === null) {
// console.log('xxxxxxxxxxx After secret key to arrives, voter needed to be updated with facebook info');
VoterActions.voterFacebookSaveToCurrentAccount();
}
signInModalGlobalState.set('facebookSignInStep', 'checkForNeedToMerge');
signInModalGlobalState.set('facebookSignInStatus', 'Retrieving sign in data...');
}
Expand Down Expand Up @@ -108,8 +113,8 @@ class FacebookSignIn extends Component {
oAuthLog('onVoterStoreChange ... facebookSignInStep === waitingForRetrieveVoterResponse');
signInModalGlobalState.set('facebookSignInStep', 'done');
this.closeSignInModalLocal();
} else if (signInModalGlobalState.get('facebookSignInStep') === 'voterRefresh') {
// The FacebookStore was not involved in this step, so need to involve it
} else if (step === 'voterRefresh' || step === 'checkForNeedToMerge') {
// The FacebookStore was not involved in these steps, so need to involve it
this.onFacebookStoreChange();
}
}
Expand Down
21 changes: 10 additions & 11 deletions src/js/pages/CampaignNewsItemPublish/CampaignNewsItemShare.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component, Suspense } from 'react';
import loadable from '@loadable/component';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import styled from 'styled-components';
import { withStyles } from '@material-ui/core/styles';
import { Button } from '@material-ui/core';
import AppStore from '../../stores/AppStore';
Expand All @@ -28,8 +27,8 @@ import { renderLog } from '../../utils/logging';
import SendFacebookDirectMessageButton from '../../components/Share/ShareByFacebookDirectMessageButton';
import ShareByCopyLink from '../../components/Share/ShareByCopyLink';
import ShareByEmailButton from '../../components/Share/ShareByEmailButton';
import ShareOnFacebookButton from '../../components/Share/ShareOnFacebookButton';
import ShareOnTwitterButton from '../../components/Share/ShareOnTwitterButton';
// import ShareOnFacebookButton from '../../components/Share/ShareOnFacebookButton';
// import ShareOnTwitterButton from '../../components/Share/ShareOnTwitterButton';

const CampaignRetrieveController = React.lazy(() => import('../../components/Campaign/CampaignRetrieveController'));
const RecommendedCampaignListRetrieveController = React.lazy(() => import('../../components/Campaign/RecommendedCampaignListRetrieveController'));
Expand Down Expand Up @@ -187,7 +186,7 @@ class CampaignNewsItemShare extends Component {

getCampaignBasePath = () => {
const { campaignSEOFriendlyPath, campaignXWeVoteId } = this.state;
let campaignBasePath = '';
let campaignBasePath;
if (campaignSEOFriendlyPath) {
campaignBasePath = `/c/${campaignSEOFriendlyPath}`;
} else {
Expand Down Expand Up @@ -421,12 +420,12 @@ const styles = () => ({
},
});

const PublicOrPrivateSectionHeader = styled.span`
font-weight: 600;
`;

const PublicOrPrivateSectionText = styled.span`
color: #999;
`;
// const PublicOrPrivateSectionHeader = styled.span`
// font-weight: 600;
// `;
//
// const PublicOrPrivateSectionText = styled.span`
// color: #999;
// `;

export default withStyles(styles)(CampaignNewsItemShare);
17 changes: 8 additions & 9 deletions src/js/pages/CampaignSupport/CampaignSupportShare.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component, Suspense } from 'react';
import loadable from '@loadable/component';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import styled from 'styled-components';
import { withStyles } from '@material-ui/core/styles';
import { Button } from '@material-ui/core';
import AppStore from '../../stores/AppStore';
Expand Down Expand Up @@ -170,7 +169,7 @@ class CampaignSupportShare extends Component {

getCampaignBasePath = () => {
const { campaignSEOFriendlyPath, campaignXWeVoteId } = this.state;
let campaignBasePath = '';
let campaignBasePath;
if (campaignSEOFriendlyPath) {
campaignBasePath = `/c/${campaignSEOFriendlyPath}`;
} else {
Expand Down Expand Up @@ -392,12 +391,12 @@ const styles = () => ({
},
});

const PublicOrPrivateSectionHeader = styled.span`
font-weight: 600;
`;

const PublicOrPrivateSectionText = styled.span`
color: #999;
`;
// const PublicOrPrivateSectionHeader = styled.span`
// font-weight: 600;
// `;
//
// const PublicOrPrivateSectionText = styled.span`
// color: #999;
// `;

export default withStyles(styles)(CampaignSupportShare);

0 comments on commit c936078

Please sign in to comment.