From 02cf7d0bcbc90d2c148b5e46348b7bba50de6a7a Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sat, 24 Oct 2015 16:06:00 -0400 Subject: [PATCH] Fix GH-162: Show "user deletion canceled" modal The look of the modals is all messed up. Will fix that separately. --- src/components/navigation/navigation.jsx | 39 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/components/navigation/navigation.jsx b/src/components/navigation/navigation.jsx index b0e187ea0..c1e33087f 100644 --- a/src/components/navigation/navigation.jsx +++ b/src/components/navigation/navigation.jsx @@ -12,11 +12,14 @@ var Dropdown = require('./dropdown.jsx'); var Input = require('../forms/input.jsx'); var log = require('../../lib/log.js'); var Login = require('../login/login.jsx'); +var Modal = require('../modal/modal.jsx'); var Registration = require('../registration/registration.jsx'); var Session = require('../../mixins/session.jsx'); require('./navigation.scss'); +Modal.setAppElement(document.getElementById('view')); + var defaultMessages = defineMessages({ messages: { id: 'general.messages', @@ -36,12 +39,13 @@ var Navigation = React.createClass({ ], getInitialState: function () { return { - 'accountNavOpen': false, - 'loginOpen': false, - 'loginError': null, - 'registrationOpen': false, - 'unreadMessageCount': 0, - 'messageCountIntervalId': -1 + accountNavOpen: false, + canceledDeletionOpen: false, + loginOpen: false, + loginError: null, + registrationOpen: false, + unreadMessageCount: 0, + messageCountIntervalId: -1 }; }, componentDidMount: function () { @@ -103,6 +107,7 @@ var Navigation = React.createClass({ }, handleLogIn: function (formData) { this.setState({'loginError': null}); + formData['useMessages'] = true; this.api({ method: 'post', host: '', @@ -119,6 +124,11 @@ var Navigation = React.createClass({ this.setState({'loginError': body.msg}); } else { this.closeLogin(); + body.messages.map(function (message) { + if (message.message == 'canceled-deletion') { + this.showCanceledDeletion(); + } + }.bind(this)); window.refreshSession(); } } @@ -145,6 +155,12 @@ var Navigation = React.createClass({ closeAccountNav: function () { this.setState({'accountNavOpen': false}); }, + showCanceledDeletion: function () { + this.setState({'canceledDeletionOpen': true}); + }, + closeCanceledDeletion: function () { + this.setState({'canceledDeletionOpen': false}); + }, closeRegistration: function () { this.setState({'registrationOpen': false}); }, @@ -299,6 +315,17 @@ var Navigation = React.createClass({ ]} + +

Your Account Will Not Be Deleted

+

+ Your account was scheduled for deletion but you logged in. Your account has been reactivated. + If you didn’t request for your account to be deleted, you should + {' '}change your password{' '} + to make sure your account is secure. +

+
); }