Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Handle the fb_email_missing error #1139

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/scripts/controllers/facebook-reward-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ sc.controller('FacebookRewardCtrl', function ($rootScope, $scope, $http, $q, $an
title: "Your Facebook was updated too recently.",
subtitle: "Please try again in a couple of days"
};
case 'fb_email_missing':
return {
title: "Your Facebook account does not have an email address.",
subtitle: "Please add an email address to your Facebook account."
};
case 'fake':
// TODO: their account is fake
case 'incomplete':
Expand Down Expand Up @@ -88,6 +93,12 @@ sc.controller('FacebookRewardCtrl', function ($rootScope, $scope, $http, $q, $an
$scope.reward.error.panel = "Sorry, your Facebook account was updated too recently";
$scope.reward.error.action = null;
break;
case 'fb_email_missing':
$scope.reward.error = {};
$scope.reward.error.info = "Your Facebook account does not have an email address.";
$scope.reward.error.panel = "Please add an email address to your Facebook account.";
$scope.reward.error.action = null;
break;
case 'invalid_fb_email_token':
$scope.reward.error = {};
$scope.reward.error.info = "The email verification token is invalid";
Expand Down
1 change: 1 addition & 0 deletions app/scripts/controllers/reward-pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ sc.controller('RewardPaneCtrl', function ($http, $scope, $rootScope, $q, session
'updated_too_recently': 'icon icon-clock',
'ineligible': 'icon icon-lock', // TODO: Use yield sign icon.
'fb_email_unverified': 'icon icon-clock',
'fb_email_missing': 'icon icon-clock',
};

/**
Expand Down
2 changes: 1 addition & 1 deletion app/templates/reward-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<div ng-hide="reward.error">
<div class="content" ng-class="{active: reward.status == 'incomplete' || reward.status == 'pending' || reward.status == 'unverified' || reward.status == 'ineligible' || reward.status == 'updated_too_recently'}">
<div class="content" ng-class="{active: reward.status == 'incomplete' || reward.status == 'pending' || reward.status == 'unverified' || reward.status == 'ineligible' || reward.status == 'updated_too_recently' || reward.status == 'fb_email_missing'}">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the length of this, it seems like using {active: reward.error} would be preferable. Is there some reason not to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely need to open an issue to look into this. This portion of the code base is way too complex. @bartekn is redesigning the rewards API and I expect most of this rewards code to get scrapped in the modular client, so it may not be worth the effort.

<div ng-include="reward.template"></div>
</div>

Expand Down