Quellcode durchsuchen

GC-610 remove route.page.pageEdit

Yuki Takei vor 7 Jahren
Ursprung
Commit
b58d424203
1 geänderte Dateien mit 0 neuen und 99 gelöschten Zeilen
  1. 0 99
      lib/routes/page.js

+ 0 - 99
lib/routes/page.js

@@ -681,105 +681,6 @@ module.exports = function(crowi, app) {
     });
     });
   };
   };
 
 
-  /*
-   * WIP: removing pageEdit action
-   * see https://weseek.myjetbrains.com/youtrack/issue/GC-610
-   *
-  actions.pageEdit = function(req, res) {
-
-    if (!req.form.isValid) {
-      req.flash('dangerMessage', 'Request is invalid.');
-      return res.redirect(req.headers.referer);
-    }
-
-    const pageForm = req.form.pageForm;
-    const path = pageForm.path;
-    const body = pageForm.body;
-    const currentRevision = pageForm.currentRevision;
-    const grant = pageForm.grant;
-    const grantUserGroupId = pageForm.grantUserGroupId;
-
-    // TODO: make it pluggable
-    const notify = pageForm.notify || {};
-
-    debug('notify: ', notify);
-
-    const redirectPath = pagePathUtil.encodePagePath(path);
-    let pageData = {};
-    let previousRevision = false;
-    let updateOrCreate;
-
-    // set to render
-    res.locals.pageForm = pageForm;
-
-    // 削除済みページはここで編集不可判定される
-    if (!Page.isCreatableName(path)) {
-      res.redirect(redirectPath);
-      return ;
-    }
-
-    const ignoreNotFound = true;
-    Page.findPage(path, req.user, null, ignoreNotFound)
-    .then(function(data) {
-      pageData = data;
-
-      if (data && !data.isUpdatable(currentRevision)) {
-        debug('Conflict occured');
-        req.flash('dangerMessage', 'Conflict occured');
-        return res.redirect(req.headers.referer);
-      }
-
-      if (data) {
-        previousRevision = data.revision;
-        return Page.updatePage(data, body, req.user, { grant, grantUserGroupId })
-          .then((page) => {
-            // global notification
-            globalNotificationService.notifyPageEdit(page);
-            return page;
-          });
-      }
-      else {
-        // new page
-        updateOrCreate = 'create';
-        return Page.create(path, body, req.user, { grant, grantUserGroupId })
-          .then((page) => {
-            // global notification
-            globalNotificationService.notifyPageCreate(page);
-            return page;
-          });
-      }
-    }).then(function(data) {
-      // data is a saved page data with revision.
-      pageData = data;
-      if (!data) {
-        throw new Error('Data not found');
-      }
-      // TODO: move to events
-      if (notify.slack) {
-        if (notify.slack.on && notify.slack.channel) {
-          data.updateSlackChannel(notify.slack.channel)
-          .catch(err => {
-            logger.error('Error occured in updating slack channels: ', err);
-          });
-
-          if (crowi.slack) {
-            const promises = notify.slack.channel.split(',').map(function(chan) {
-              return crowi.slack.postPage(pageData, req.user, chan, updateOrCreate, previousRevision);
-            });
-
-            Promise.all(promises)
-            .catch(err => {
-              logger.error('Error occured in sending slack notification: ', err);
-            });
-          }
-        }
-      }
-
-      return res.redirect(redirectPath);
-    });
-  };
-  */
-
 
 
   const api = actions.api = {};
   const api = actions.api = {};