diff --git a/app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt b/app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt index 2450dd8502e..f34e09f4ab2 100644 --- a/app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt +++ b/app/src/main/java/fr/free/nrw/commons/review/ReviewController.kt @@ -165,10 +165,12 @@ class ReviewController @Inject constructor( .commonsApplicationComponent .inject(this) - ViewUtil.showShortToast( - context, - context.getString(R.string.send_thank_toast, media?.displayTitle) - ) + val message = firstRevision?.user()?.let { + context.getString(R.string.send_thank_toast, media?.displayTitle, it) + } ?: run { + context.getString(R.string.send_thank_toast_no_author, media?.displayTitle) + } + ViewUtil.showShortToast(context, message) if (firstRevision == null) return @@ -198,10 +200,18 @@ class ReviewController @Inject constructor( private fun displayThanksToast(context: Context, result: Boolean) { val (title, message) = if (result) { context.getString(R.string.send_thank_success_title) to - context.getString(R.string.send_thank_success_message, media?.displayTitle) + (firstRevision?.user()?.let { + context.getString(R.string.send_thank_success_message, media?.displayTitle, it) + } ?: run { + context.getString(R.string.send_thank_success_message_no_author, media?.displayTitle) + }) } else { context.getString(R.string.send_thank_failure_title) to - context.getString(R.string.send_thank_failure_message, media?.displayTitle) + (firstRevision?.user()?.let { + context.getString(R.string.send_thank_failure_message, media?.displayTitle, it) + } ?: run { + context.getString(R.string.send_thank_failure_message_no_author, media?.displayTitle) + }) } ViewUtil.showShortToast(context, message) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 37b7f8628ea..e1570c9068e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -498,11 +498,14 @@ Upload your first media by tapping on the add button. Requesting category check for %1$s Done Sending thanks: Success - Sent thanks to %1$s - Failed to send thanks to %1$s + Successfully sent thanks for %1$s to %2$s + Failed to send thanks for %1$s to %2$s Sending thanks: Failure - Sending thanks for %1$s + Sending thanks for %1$s to %2$s + Sending thanks for %1$s + Successfully sent thanks for %1$s + Failed to send thanks for %1$s Does this follow the rules of copyright? Is this correctly categorized? Is this in-scope? diff --git a/app/src/test/kotlin/fr/free/nrw/commons/review/ReviewControllerTest.kt b/app/src/test/kotlin/fr/free/nrw/commons/review/ReviewControllerTest.kt index 08237c5d924..799836605e3 100644 --- a/app/src/test/kotlin/fr/free/nrw/commons/review/ReviewControllerTest.kt +++ b/app/src/test/kotlin/fr/free/nrw/commons/review/ReviewControllerTest.kt @@ -140,6 +140,7 @@ class ReviewControllerTest { fun testSendThanks() { shadowOf(Looper.getMainLooper()).idle() whenever(firstRevision.revisionId()).thenReturn(1) + whenever(firstRevision.user()).thenReturn("test_user") Whitebox.setInternalState(controller, "firstRevision", firstRevision) controller.sendThanks(activity) assertEquals( @@ -147,6 +148,7 @@ class ReviewControllerTest { context.getString( R.string.send_thank_toast, media.displayTitle, + "test_user" ), ) @@ -165,6 +167,7 @@ class ReviewControllerTest { context.getString( R.string.send_thank_success_message, media.displayTitle, + "test_user" ), ) } @@ -176,7 +179,7 @@ class ReviewControllerTest { assertEquals( ShadowToast.getTextOfLatestToast().toString(), context.getString( - R.string.send_thank_toast, + R.string.send_thank_toast_no_author, media.displayTitle, ), )