Steven Fukase 4 лет назад
Родитель
Сommit
841162fde0

+ 20 - 0
packages/app/src/components/PageStatusAlert.jsx

@@ -49,6 +49,22 @@ class PageStatusAlert extends React.Component {
     ];
   }
 
+  getContentsForRevisionOutdated() {
+    const { t } = this.props;
+    return [
+      ['bg-success', 'd-hackmd-none'],
+      <>
+        <i className="icon-fw icon-pencil"></i>
+        {/* {t('hackmd.this_page_has_draft')} */}
+        Merge Conflict
+      </>,
+      <a href="#hackmd" className="btn btn-outline-white">
+        <i className="fa fa-fw fa-file-text-o mr-1"></i>
+        Resolve conflict
+      </a>,
+    ];
+  }
+
   getContentsForDraftExistsAlert(isRealtime) {
     const { t } = this.props;
     return [
@@ -96,6 +112,10 @@ class PageStatusAlert extends React.Component {
     if (isHackmdDocumentOutdated && isRevisionOutdated) {
       getContentsFunc = this.getContentsForUpdatedAlert;
     }
+    // when remote revision is newer
+    else if (isRevisionOutdated) {
+      getContentsFunc = this.getContentsForRevisionOutdated;
+    }
     // when someone editing with HackMD
     else if (isHackmdDraftUpdatingInRealtime) {
       getContentsFunc = this.getContentsForSomeoneEditingAlert;

+ 2 - 1
packages/app/src/components/SavePageControls.jsx

@@ -49,9 +49,10 @@ class SavePageControls extends React.Component {
     catch (error) {
       // TODO: display resolve conflict button when operation to update page is conflicted
       // ref: https://estoc.weseek.co.jp/redmine/issues/78784
-      console.log(error.data);
+      console.log(error);
       logger.error('failed to save', error);
       pageContainer.showErrorToastr(error);
+      pageContainer.setState({})
     }
   }