Source:
private Observable<Boolean> delete(Media media, String reason) { Timber.d("thread is delete %s", Thread.currentThread().getName()); String summary = "Nominating " + media.getFilename() + " for deletion."; Calendar calendar = Calendar.getInstance(); String fileDeleteString = "{{delete|reason=" + reason + "|subpage=" + media.getFilename() + "|day=" + calendar.get(Calendar.DAY_OF_MONTH) + "|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "|year=" + calendar.get(Calendar.YEAR) + "}}"; String subpageString = "=== [[:" + media.getFilename() + "]] ===\n" + reason + " ~~~~"; String logPageString = "\n{{Commons:Deletion requests/" + media.getFilename() + "}}\n"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String date = sdf.format(calendar.getTime()); String userPageString = "\n{{subst:idw|" + media.getFilename() + "}} ~~~~"; String creator = media.getCreator(); if (creator == null || creator.isEmpty()) throw new RuntimeException("Failed to nominate for deletion"); String creatorName = creator.replace(" (page does not exist)", ""); return pageEditClient.prependEdit(media.filename, fileDeleteString + "\n", summary) .flatMap(result -> { if (result) { return pageEditClient.edit("Commons:Deletion_requests/" + media.getFilename(), subpageString + "\n", summary); } throw new RuntimeException("Failed to nominate for deletion"); }).flatMap(result -> { if (result) { return pageEditClient.appendEdit("Commons:Deletion_requests/" + date, logPageString + "\n", summary); } throw new RuntimeException("Failed to nominate for deletion"); }).flatMap(result -> { if (result) { return pageEditClient.appendEdit("User_Talk:" + creatorName, userPageString + "\n", summary); } throw new RuntimeException("Failed to nominate for deletion"); }); }

Target:
private Observable<Boolean> delete(Media media, String reason) { Timber.d("thread is delete %s", Thread.currentThread().getName()); String summary = "Nominating " + media.getFilename() + " for deletion."; Calendar calendar = Calendar.getInstance(); String fileDeleteString = "{{delete|reason=" + reason + "|subpage=" + media.getFilename() + "|day=" + calendar.get(Calendar.DAY_OF_MONTH) + "|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "|year=" + calendar.get(Calendar.YEAR) + "}}"; String subpageString = "=== [[:" + media.getFilename() + "]] ===\n" + reason + " ~~~~"; String logPageString = "\n{{Commons:Deletion requests/" + media.getFilename() + "}}\n"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String date = sdf.format(calendar.getTime()); String userPageString = "\n{{subst:idw|" + media.getFilename() + "}} ~~~~"; String creator = media.getCreator(); if (creator == null || creator.isEmpty()) { throw new RuntimeException("Failed to nominate for deletion"); } String creatorName = creator.replace(" (page does not exist)", ""); return pageEditClient.prependEdit(media.filename, fileDeleteString + "\n", summary) .flatMap(result -> { if (result) { return pageEditClient.edit("Commons:Deletion_requests/" + media.getFilename(), subpageString + "\n", summary); } throw new RuntimeException("Failed to nominate for deletion"); }).flatMap(result -> { if (result) { return pageEditClient.appendEdit("Commons:Deletion_requests/" + date, logPageString + "\n", summary); } throw new RuntimeException("Failed to nominate for deletion"); }).flatMap(result -> { if (result) { return pageEditClient.appendEdit("User_Talk:" + creatorName, userPageString + "\n", summary); } throw new RuntimeException("Failed to nominate for deletion"); }); }