mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-24 16:57:15 -04:00
[db] don't allow initial repos from fixtures to provide weight
The client was already auto-incrementing their weight anyway. But it leaked our internal weight handling into the library consumer which can cause issues like when me are making changes to how we handles repo weights as we are doing now.
This commit is contained in:
@@ -393,7 +393,8 @@ public data class InitialRepository @JvmOverloads constructor(
|
||||
val certificate: String,
|
||||
val version: Long,
|
||||
val enabled: Boolean,
|
||||
val weight: Int,
|
||||
@Deprecated("This is automatically assigned now and can be safely removed.")
|
||||
val weight: Int = 0, // still used for testing, could be made internal or tests migrate away
|
||||
) {
|
||||
init {
|
||||
validateCertificate(certificate)
|
||||
|
||||
@@ -127,9 +127,10 @@ internal interface RepositoryDaoInt : RepositoryDao {
|
||||
certificate = initialRepo.certificate,
|
||||
)
|
||||
val repoId = insertOrReplace(repo)
|
||||
val currentMinWeight = getMinRepositoryWeight()
|
||||
val repositoryPreferences = RepositoryPreferences(
|
||||
repoId = repoId,
|
||||
weight = initialRepo.weight,
|
||||
weight = currentMinWeight - 2,
|
||||
lastUpdated = null,
|
||||
enabled = initialRepo.enabled,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user