Skip to content

Commit

Permalink
Merge branch 'main' into dialog-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-raoul authored Dec 10, 2024
2 parents 1bf0e54 + 7331197 commit df86131
Show file tree
Hide file tree
Showing 28 changed files with 474 additions and 615 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class LoginClient(
.subscribe({ response: MwQueryResponse? ->
loginResult.userId = response?.query()?.userInfo()?.id() ?: 0
loginResult.groups =
response?.query()?.getUserResponse(userName)?.groups ?: emptySet()
response?.query()?.getUserResponse(userName)?.getGroups() ?: emptySet()
cb.success(loginResult)
}, { caught: Throwable ->
Timber.e(caught, "Login succeeded but getting group information failed. ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C

Observable.defer {
thanksClient.thank(
firstRevision.revisionId
firstRevision.revisionId()
)
}
.subscribeOn(Schedulers.io())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class ReviewActivity : BaseActivity() {
val caption = getString(
R.string.review_is_uploaded_by,
fileName,
revision.user
revision.user()
)
binding.tvImageCaption.text = caption
binding.pbReviewImage.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException
import fr.free.nrw.commons.wikidata.mwapi.MwQueryPage

import java.util.ArrayList
import java.util.concurrent.Callable

import javax.inject.Inject
import javax.inject.Named
Expand All @@ -27,7 +26,6 @@ import fr.free.nrw.commons.delete.DeleteHelper
import fr.free.nrw.commons.di.ApplicationlessInjection
import fr.free.nrw.commons.utils.ViewUtil
import io.reactivex.Observable
import io.reactivex.ObservableSource
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
Expand Down Expand Up @@ -175,7 +173,7 @@ class ReviewController @Inject constructor(
if (firstRevision == null) return

Observable.defer {
thanksClient.thank(firstRevision!!.revisionId)
thanksClient.thank(firstRevision!!.revisionId())
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ReviewHelper
reviewInterface
.getRecentChanges()
.map { it.query()?.pages() }
.map(MutableList<MwQueryPage>::shuffled)
.map { it.shuffled() }
.flatMapIterable { changes: List<MwQueryPage>? -> changes }
.filter { isChangeReviewable(it) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ package fr.free.nrw.commons.review
import android.graphics.Color
import android.os.Bundle
import android.text.Html
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import fr.free.nrw.commons.CommonsApplication
import fr.free.nrw.commons.Media
import fr.free.nrw.commons.R
import fr.free.nrw.commons.auth.SessionManager
import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException
import fr.free.nrw.commons.databinding.FragmentReviewImageBinding
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment
import java.util.ArrayList
import javax.inject.Inject


Expand Down Expand Up @@ -126,7 +123,7 @@ class ReviewImageFragment : CommonsDaggerSupportFragment() {
enableButtons()
question = getString(R.string.review_thanks)

user = reviewActivity.reviewController.firstRevision?.user
user = reviewActivity.reviewController.firstRevision?.user()
?: savedInstanceState?.getString(SAVED_USER)

//if the user is null because of whatsoever reason, review will not be sent anyways
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class UploadClient
if (uploadResult.upload == null) {
val exception = gson.fromJson(uploadResponse, MwException::class.java)
Timber.e(exception, "Error in uploading file from stash")
throw Exception(exception.getErrorCode())
throw Exception(exception.errorCode)
}
uploadResult.upload
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package fr.free.nrw.commons.wikidata.mwapi

class ImageDetails {
val name: String? = null
val title: String? = null
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package fr.free.nrw.commons.wikidata.mwapi

class ListUserResponse {
private val name: String? = null
private val userid: Long = 0
private val groups: List<String>? = null

fun name(): String? = name

fun getGroups(): Set<String> =
groups?.toSet() ?: emptySet()
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package fr.free.nrw.commons.wikidata.mwapi

class MwException(
val error: MwServiceError?,
private val errors: List<MwServiceError>?
) : RuntimeException() {
val errorCode: String?
get() = error?.code ?: errors?.get(0)?.code

val title: String?
get() = error?.title ?: errors?.get(0)?.title

override val message: String?
get() = error?.details ?: errors?.get(0)?.details
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package fr.free.nrw.commons.wikidata.mwapi

open class MwPostResponse : MwResponse() {
val successVal: Int = 0

fun success(result: String?): Boolean =
"success" == result
}

Loading

0 comments on commit df86131

Please sign in to comment.