Skip to content

Commit

Permalink
Editor: Remove warning about publish date change (#24662)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansadowski authored May 7, 2018
1 parent 5d36527 commit b0d91d2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
7 changes: 0 additions & 7 deletions client/post-editor/editor-notice/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ export class EditorNotice extends Component {
const typeLabel = get( typeObject, 'labels.singular_name', type );

switch ( key ) {
case 'warnPublishDateChange':
// This message can only appear for type === 'post'. See
// PostEditor#checkForDateChange().
return translate(
'Are you sure about that? If you change the date, existing links to your post will stop working.'
);

case 'publishFailure':
return translate( 'Publishing of %(typeLabel)s failed.', {
args: { typeLabel: typeLabel.toLowerCase() },
Expand Down
42 changes: 0 additions & 42 deletions client/post-editor/post-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -941,48 +941,6 @@ export class PostEditor extends React.Component {
analytics.tracks.recordEvent( 'calypso_editor_publish_date_change', {
context: 'open' === this.state.confirmationSidebar ? 'confirmation-sidebar' : 'post-settings',
} );

this.checkForDateChange( dateValue );
};

checkForDateChange = date => {
const { savedPost } = this.state;

if ( ! savedPost ) {
return;
}

const currentDate = this.props.moment( date );
const modifiedDate = this.props.moment( savedPost.date );
const dateChange = ! (
currentDate.get( 'date' ) === modifiedDate.get( 'date' ) &&
currentDate.get( 'month' ) === modifiedDate.get( 'month' ) &&
currentDate.get( 'year' ) === modifiedDate.get( 'year' )
);
const diff = !! currentDate.diff( modifiedDate ) && !! dateChange;

if ( savedPost.type === 'post' && utils.isPublished( savedPost ) && diff ) {
this.warnPublishDateChange();
} else {
this.warnPublishDateChange( { clearWarning: true } );
}
};

// when a post that is published, modifies its date, this updates the post url
// we should warn users of this case
warnPublishDateChange = ( { clearWarning = false } = {} ) => {
if ( clearWarning ) {
if ( get( this.state, 'notice.message' ) === 'warnPublishDateChange' ) {
this.hideNotice();
}
return;
}
this.setState( {
notice: {
status: 'is-warning',
message: 'warnPublishDateChange',
},
} );
};

onSaveSuccess = message => {
Expand Down

0 comments on commit b0d91d2

Please sign in to comment.