mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
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:
parent
cd2d530175
commit
e55b5495a1
2 changed files with 33 additions and 2 deletions
|
|
@ -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");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue