Apply tags directly through the Wikibase API, fixes #2196

This commit is contained in:
Antonin Delpeuch 2020-02-03 11:21:03 +01:00
parent 429f26c2ae
commit 9ff138c65d

View File

@ -158,15 +158,13 @@ public class PerformWikibaseEditsOperation extends EngineDependentOperation {
this._engine = engine; this._engine = engine;
this._schema = (WikibaseSchema) project.overlayModels.get("wikibaseSchema"); this._schema = (WikibaseSchema) project.overlayModels.get("wikibaseSchema");
this._summary = summary; this._summary = summary;
// TODO this is one of the attributes that should be configured on a per-wiki basis
// TODO enable this tag once 3.3 final is released and create 3.4 tag without AbuseFilter
String tag = "openrefine"; String tag = "openrefine";
Pattern pattern = Pattern.compile("^(\\d+\\.\\d+).*$"); Pattern pattern = Pattern.compile("^(\\d+\\.\\d+).*$");
Matcher matcher = pattern.matcher(RefineServlet.VERSION); Matcher matcher = pattern.matcher(RefineServlet.VERSION);
if (matcher.matches()) { if (matcher.matches()) {
tag += "-"+matcher.group(1); tag += "-"+matcher.group(1);
} }
this._tags = Collections.emptyList(); // TODO Arrays.asList(tag); this._tags = Arrays.asList(tag);
this._historyEntryID = HistoryEntry.allocateID(); this._historyEntryID = HistoryEntry.allocateID();
} }
@ -191,7 +189,7 @@ public class PerformWikibaseEditsOperation extends EngineDependentOperation {
// make sure they can be told apart. // make sure they can be told apart.
String summaryWithoutCommas = _summary.replaceAll(", "," ").replaceAll(": ","։ "); String summaryWithoutCommas = _summary.replaceAll(", "," ").replaceAll(": ","։ ");
String summary = summaryWithoutCommas + String.format(" ([[:toollabs:editgroups/b/OR/%s|details]])", String summary = summaryWithoutCommas + String.format(" ([[:toollabs:editgroups/b/OR/%s|details]])",
(Long.toHexString(token).substring(0, 10))); (Long.toHexString(token).substring(0, 11)));
// Evaluate the schema // Evaluate the schema
List<ItemUpdate> itemDocuments = _schema.evaluate(_project, _engine); List<ItemUpdate> itemDocuments = _schema.evaluate(_project, _engine);