|
@@ -572,7 +572,7 @@ module.exports = function(crowi, app) {
|
|
|
*
|
|
*
|
|
|
* In the case of the page exists:
|
|
* In the case of the page exists:
|
|
|
* - If revision_id is specified => update the page,
|
|
* - 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){
|
|
api.update = function(req, res){
|
|
|
var pageBody = req.body.body || null;
|
|
var pageBody = req.body.body || null;
|
|
@@ -581,12 +581,12 @@ module.exports = function(crowi, app) {
|
|
|
var grant = req.body.grant || null;
|
|
var grant = req.body.grant || null;
|
|
|
|
|
|
|
|
if (pageId === null || pageBody === 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)
|
|
Page.findPageByIdAndGrantedUser(pageId, req.user)
|
|
|
.then(function(pageData) {
|
|
.then(function(pageData) {
|
|
|
- if (pageData && !pageData.isUpdatable(revisionId)) {
|
|
|
|
|
|
|
+ if (pageData && revisionId !== null && !pageData.isUpdatable(revisionId)) {
|
|
|
throw new Error('Revision error.');
|
|
throw new Error('Revision error.');
|
|
|
};
|
|
};
|
|
|
|
|
|