-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collection list refresh: Don't update fetched homesets #1222
base: main-ose
Are you sure you want to change the base?
Collection list refresh: Don't update fetched homesets #1222
Conversation
app/src/main/kotlin/at/bitfire/davdroid/servicedetection/CollectionListRefresher.kt
Outdated
Show resolved
Hide resolved
I'm still not sure that I understand the difference between "queried" and "saved". However maybe this example illustrates it:
Is that correct? But shouldn't the "saved" then apply to everything we find/save? There are other calls to I understand that the change fixes our current issue. But I wonder if one would still understand the code / what it does without knowing about the current issue. However this should be the aim. Another thing: we get the val homeSetClass: Class<out HrefListProperty>
val properties: Array<Property.Name>
when (service.type) {
Service.TYPE_CARDDAV -> {
homeSetClass = AddressbookHomeSet::class.java
// … block out of the |
That's exactly right. I renamed
I don't think so. I think by that argument already"Queried" would then have to apply to (remember) everything we query too - which we don't, since it does not really make sense to do that. I can see however that both Furthermore I will rename See the changes in 1f45c60
I guess we could, but by aforemented reasoning I would leave it in the See the changes in 7247691 |
7247691
to
205ca22
Compare
5c06481
to
7c4538d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! It's more more clear to me especially because alreadyQueriedPrincipals
and alreadySavedHomeSets
have speaking names and are defined in method context (not in the class context).
Didn't have a look at the tests but as they're green I hope they're fine.
Also extracted homeSetClass
and homeSetPropertyNames
from the method to the class. While doing so I found that the home-set properties are not used in refreshHomesetsAndTheirCollections
:
davx5-ose/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/CollectionListRefresher.kt
Line 204 in 7c4538d
DavResource(httpClient, homeSetUrl).propfind(1, *RefreshCollectionsWorker.DAV_COLLECTION_PROPERTIES) { response, relation -> |
Shouldn't we use homeSetPropertyNames
here, too, instead of *RefreshCollectionsWorker.DAV_COLLECTION_PROPERTIES
?
However a bit later we also check whether the response is a usable collection. So we should actually query all properties (homeSetPropertyNames
+ DAV_COLLECTION_PROPERTIES
), right?
Or maybe it's wise to put all relevant properties into DAV_COLLECTION_PROPERTIES
and always query everything?
Also both DAV_COLLECTION_PROPERTIES
and DAV_PRINCIPAL_PROPERTIES
are defined in RefreshCollectionsWorker
, but only used in CollectionListRefresher
. Should probably moved.
What do you think?
Since we query for collections we will have to use the collection properties in the propfind. We don't need to combine them. I don't see where that would be beneficial to us besides having a single property list. It's an interesting idea to query all properties at once, however it is of little advantage for us and may put unecessary additional strain on some servers? I would be surprised if there was no RFC standard defining whether we are allowed to do that in our propfinds. Seems like
True. I did that now, renamed them both with camelcase and made all properties private. |
Purpose
At collection list refresh DAVx5 updates homesets when detected a second time. This leads to homesets detected as personal at first encounter (directly within the user principal), wrongly being overwritten as non-personal homesets (when found in a group principal afterwards).
This PR alters
CollectionListRefresher.discCoverHomesets()
to remember homesets already saved to database during the same refresh and won't overwrite/update them. They might only be updated at a second refresh if changed on server.Short description
alreadyFetched
property toCollectionListRefresher
alreadyFetched
setChecklist