Make edit summaries mandatory

This commit is contained in:
Antonin Delpeuch 2018-04-20 15:34:21 +02:00
parent 2d549b79f1
commit 5fda43a5c7
3 changed files with 25 additions and 15 deletions

View File

@ -35,19 +35,23 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
} else {
elmts.performEditsButton.click(function() {
Refine.postProcess(
"wikidata",
"perform-wikibase-edits",
{},
{
summary: elmts.editSummary.val(),
},
{ includeEngine: true, cellsChanged: true, columnStatsChanged: true },
{ onDone:
function() {
dismiss();
}
});
if(elmts.editSummary.val().length == 0) {
elmts.editSummary.focus();
} else {
Refine.postProcess(
"wikidata",
"perform-wikibase-edits",
{},
{
summary: elmts.editSummary.val(),
},
{ includeEngine: true, cellsChanged: true, columnStatsChanged: true },
{ onDone:
function() {
dismiss();
}
});
}
});
}
};

View File

@ -30,6 +30,7 @@ import java.util.List;
import java.util.Properties;
import java.util.Random;
import org.apache.commons.lang.Validate;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONWriter;
@ -66,9 +67,9 @@ public class PerformWikibaseEditsOperation extends EngineDependentOperation {
public PerformWikibaseEditsOperation(JSONObject engineConfig, String summary) {
super(engineConfig);
Validate.notNull(summary, "An edit summary must be provided.");
Validate.notEmpty(summary, "An edit summary must be provided.");
this.summary = summary;
// getEngine(request, project);
}
static public AbstractOperation reconstruct(Project project, JSONObject obj)

View File

@ -55,6 +55,11 @@ public class PerformWikibaseEditsOperationTest extends OperationTest {
throws Exception {
return TestingData.jsonFromFile("data/operations/perform-edits.json");
}
@Test(expectedExceptions=IllegalArgumentException.class)
public void testConstructor() {
new PerformWikibaseEditsOperation(new JSONObject("{}"), "");
}
@Test
public void testLoadChange()