Просмотр исходного кода

Update page without revision_id.

Sotaro KARASAWA 9 лет назад
Родитель
Сommit
0cd137f292
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      lib/routes/page.js

+ 3 - 3
lib/routes/page.js

@@ -572,7 +572,7 @@ module.exports = function(crowi, app) {
    *
    * In the case of the page exists:
    * - If revision_id is specified => update the page,
-   * - If revision_id is not specified => error.
+   * - If revision_id is not specified => force update by the new contents.
    */
   api.update = function(req, res){
     var pageBody = req.body.body || null;
@@ -581,12 +581,12 @@ module.exports = function(crowi, app) {
     var grant = req.body.grant || null;
 
     if (pageId === null || pageBody === null) {
-      return res.json(ApiResponse.error('page_id, revision_id, body is required.'));
+      return res.json(ApiResponse.error('page_id and body are required.'));
     }
 
     Page.findPageByIdAndGrantedUser(pageId, req.user)
     .then(function(pageData) {
-      if (pageData && !pageData.isUpdatable(revisionId)) {
+      if (pageData && revisionId !== null && !pageData.isUpdatable(revisionId)) {
         throw new Error('Revision error.');
       };