Fixes #3464, App posts deletion request notifications ({{subst:idw}}) on the wrong user's talk page (#3495)

* Fixed #3464: App posts deletion request notifications ({{subst:idw}}) on the wrong user's talk page

* Fixed DeleteHelperTest.kt

* Fixed DeleteHelper tests and null-pointer exception

* Modified DeleteHelper makeDeletion() test

* Reverted unintentionally modified Project.xml

* Raising exception when nominating for deletion with empty creator name

* Fixed code style

* Fixed code style
This commit is contained in:
Vitaly V. Pinchuk 2020-03-17 14:39:28 +03:00 committed by GitHub
parent cd2d530175
commit e55b5495a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -98,6 +98,12 @@ public class DeleteHelper {
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) {
@ -111,7 +117,7 @@ public class DeleteHelper {
throw new RuntimeException("Failed to nominate for deletion");
}).flatMap(result -> {
if (result) {
return pageEditClient.appendEdit("User_Talk:" + username, userPageString + "\n", summary);
return pageEditClient.appendEdit("User_Talk:" + creatorName, userPageString + "\n", summary);
}
throw new RuntimeException("Failed to nominate for deletion");
});