mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
adjusted copy
This commit is contained in:
@@ -27,7 +27,7 @@ class AccountDeletionRequestedSign extends React.Component {
|
||||
'MMM Do YYYY, h:mm:ss a'
|
||||
);
|
||||
const deletionScheduledOn = moment(scheduledDeletionDate)
|
||||
.subtract(12, 'hours')
|
||||
.subtract(24, 'hours')
|
||||
.format('MMM Do YYYY, h:mm:ss a');
|
||||
|
||||
return (
|
||||
|
||||
@@ -55,6 +55,7 @@ class DeleteMyAccount extends React.Component {
|
||||
requestAccountDeletion={this.requestAccountDeletion}
|
||||
showDialog={this.state.showDialog}
|
||||
closeDialog={this.closeDialog}
|
||||
scheduledDeletionDate={scheduledDeletionDate}
|
||||
/>
|
||||
<h3
|
||||
className={cn(
|
||||
|
||||
@@ -42,6 +42,8 @@ class DeleteMyAccountDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
const { step } = this.state;
|
||||
const { scheduledDeletionDate } = this.props;
|
||||
|
||||
return (
|
||||
<Dialog open={this.props.showDialog} className={styles.dialog}>
|
||||
<span className={styles.close} onClick={this.cancel}>
|
||||
@@ -76,7 +78,12 @@ class DeleteMyAccountDialog extends React.Component {
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
)}
|
||||
{step === 4 && <DeleteMyAccountFinalStep finish={this.cancel} />}
|
||||
{step === 4 && (
|
||||
<DeleteMyAccountFinalStep
|
||||
scheduledDeletionDate={scheduledDeletionDate}
|
||||
finish={this.cancel}
|
||||
/>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -86,6 +93,7 @@ DeleteMyAccountDialog.propTypes = {
|
||||
showDialog: PropTypes.bool.isRequired,
|
||||
closeDialog: PropTypes.func.isRequired,
|
||||
requestAccountDeletion: PropTypes.func.isRequired,
|
||||
scheduledDeletionDate: PropTypes.string,
|
||||
};
|
||||
|
||||
export default DeleteMyAccountDialog;
|
||||
|
||||
@@ -3,6 +3,7 @@ import cn from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Icon } from 'plugin-api/beta/client/components/ui';
|
||||
import styles from './DeleteMyAccountStep.css';
|
||||
import moment from 'moment';
|
||||
|
||||
const DeleteMyAccountFinalStep = props => (
|
||||
<div className={styles.step}>
|
||||
@@ -17,7 +18,9 @@ const DeleteMyAccountFinalStep = props => (
|
||||
</strong>
|
||||
<strong className={styles.block}>
|
||||
<Icon name="access_time" className={styles.timeIcon} />
|
||||
<span>Account Deletion Date and Time</span>
|
||||
<span>
|
||||
{moment(props.scheduledDeletionDate).format('MMM Do YYYY, h:mm:ss a')}
|
||||
</span>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
@@ -45,6 +48,7 @@ const DeleteMyAccountFinalStep = props => (
|
||||
|
||||
DeleteMyAccountFinalStep.propTypes = {
|
||||
finish: PropTypes.func.isRequired,
|
||||
scheduledDeletionDate: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default DeleteMyAccountFinalStep;
|
||||
|
||||
@@ -32,6 +32,7 @@ export const withRequestAccountDeletion = withMutation(
|
||||
return mutate({
|
||||
variables: {},
|
||||
update: proxy => {
|
||||
debugger;
|
||||
const RequestAccountDeletionQuery = gql`
|
||||
query Talk_CancelAccountDeletion {
|
||||
me {
|
||||
@@ -46,7 +47,7 @@ export const withRequestAccountDeletion = withMutation(
|
||||
});
|
||||
|
||||
const scheduledDeletionDate = moment()
|
||||
.add(12, 'hours')
|
||||
.add(24, 'hours')
|
||||
.toDate();
|
||||
|
||||
const data = update(prev, {
|
||||
|
||||
@@ -93,16 +93,16 @@ async function sendDownloadLink(ctx) {
|
||||
}
|
||||
|
||||
// requestDeletion will schedule the current user to have their account deleted
|
||||
// by setting the `scheduledDeletionDate` on the user 12 hours from now.
|
||||
// by setting the `scheduledDeletionDate` on the user 24 hours from now.
|
||||
async function requestDeletion({ user, connectors: { models: { User } } }) {
|
||||
// Ensure the user doesn't already have a deletion scheduled.
|
||||
if (get(user, 'metadata.scheduledDeletionDate')) {
|
||||
throw new ErrDeletionAlreadyScheduled();
|
||||
}
|
||||
|
||||
// Get the date in the future 12 hours from now.
|
||||
// Get the date in the future 24 hours from now.
|
||||
const scheduledDeletionDate = moment()
|
||||
.add(12, 'hours')
|
||||
.add(24, 'hours')
|
||||
.toDate();
|
||||
|
||||
// Amend the scheduledDeletionDate on the user.
|
||||
|
||||
Reference in New Issue
Block a user