@@ -4,8 +4,6 @@ import fr.free.nrw.commons.CommonsApplication
4
4
import fr.free.nrw.commons.di.NetworkingModule.NAMED_COMMONS_CSRF
5
5
import io.reactivex.Observable
6
6
import org.wikipedia.csrf.CsrfTokenClient
7
- import org.wikipedia.dataclient.Service
8
- import org.wikipedia.dataclient.mwapi.MwPostResponse
9
7
import javax.inject.Inject
10
8
import javax.inject.Named
11
9
import javax.inject.Singleton
@@ -17,7 +15,7 @@ import javax.inject.Singleton
17
15
@Singleton
18
16
class ThanksClient @Inject constructor(
19
17
@param:Named(NAMED_COMMONS_CSRF ) private val csrfTokenClient : CsrfTokenClient ,
20
- @param:Named("commons-service") private val service : Service
18
+ private val service : ThanksInterface
21
19
) {
22
20
/* *
23
21
* Thanks a user for a particular revision
@@ -26,11 +24,16 @@ class ThanksClient @Inject constructor(
26
24
*/
27
25
fun thank (revisionId : Long ): Observable <Boolean > {
28
26
return try {
29
- service.thank(revisionId.toString(), null , csrfTokenClient.tokenBlocking, CommonsApplication .getInstance().userAgent)
30
- .map { mwThankPostResponse -> mwThankPostResponse.result.success== 1 }
27
+ service.thank(
28
+ revisionId.toString(), // Rev
29
+ null , // Log
30
+ csrfTokenClient.tokenBlocking, // Token
31
+ CommonsApplication .getInstance().userAgent // Source
32
+ ).map {
33
+ mwThankPostResponse -> mwThankPostResponse.result?.success == 1
34
+ }
31
35
} catch (throwable: Throwable ) {
32
36
Observable .just(false )
33
37
}
34
38
}
35
-
36
39
}
0 commit comments