mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Add edit summaries to category edits
This commit is contained in:
parent
30e85f3c8e
commit
e936add26c
4 changed files with 17 additions and 0 deletions
|
|
@ -46,4 +46,9 @@ public class CategoryModifier extends PageModifier {
|
|||
}
|
||||
return pageContents + categoriesString.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEditSumary() {
|
||||
return String.format("Added " + params.optJSONArray(PARAM_CATEGORIES).length() + " categories.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
.param("title", contrib.getFilename())
|
||||
.param("token", editToken)
|
||||
.param("text", processedPageContent)
|
||||
.param("summary", sequence.getEditSummary())
|
||||
.post();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,15 @@ public class ModifierSequence {
|
|||
return pageContents;
|
||||
}
|
||||
|
||||
public String getEditSummary() {
|
||||
StringBuffer editSummary = new StringBuffer();
|
||||
for(PageModifier modifier: modifiers) {
|
||||
editSummary.append(modifier.getEditSumary()).append(" ");
|
||||
}
|
||||
editSummary.append("Via Commons Mobile App");
|
||||
return editSummary.toString();
|
||||
}
|
||||
|
||||
public JSONObject toJSON() {
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public abstract class PageModifier {
|
|||
|
||||
public abstract String doModification(String pageName, String pageContents);
|
||||
|
||||
public abstract String getEditSumary();
|
||||
|
||||
public JSONObject toJSON() {
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue