X Tutup
Skip to content

Support hidden version in status.php taking version from capabilities…#1936

Merged
davivel merged 1 commit intomasterfrom
support_hidden_version_in_status_php
Apr 17, 2017
Merged

Support hidden version in status.php taking version from capabilities…#1936
davivel merged 1 commit intomasterfrom
support_hidden_version_in_status_php

Conversation

@davivel
Copy link
Contributor

@davivel davivel commented Apr 7, 2017

… API as preferred.

Fixes #1931

Requires owncloud/android-library#156

if (serverVersionStr != null) {
serverVersion = new OwnCloudVersion(serverVersionStr);
// capabilities are now the preferred source for version info
FileDataStorageManager fds = new FileDataStorageManager(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename fds variable name to a more specific one like fileDataStorageManager. In this part of the code, you know exactly what it is, but if you use it in other part below, you won't know it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
}
}
return serverVersion;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This serverVersion could be returned as null, I guess this will be take into account in the method which calls it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added @nullable to method to make it clearer to callers; they had it into account before, also.

* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important, but these <p> characters could be deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

* @author David A. Velasco
* @author masensio
* Copyright (C) 2017 ownCloud GmbH.
* <p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

RemoteOperationResult result = getCapabilities.execute(getStorageManager(), mContext);
if (!result.isSuccess()){
Log_OC.w(TAG, "Update Capabilities unsuccessfully");
private OwnCloudVersion updateCapabilities() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if updateCapabilities would be a good name for this method since you are getting something, not setting it. Besides, this method could be also useful in other parts of the code, have you thinked about moving it to a generic capabilities class with several methods related to it?

Edition: I've just seen that SyncCapabilitiesOperation is getting and saving the capabilities. Method name LGTM but consider if moving it to a capabilities util class would worth it.

Copy link
Contributor Author

@davivel davivel Apr 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the method to 'syncCapabilities()', that is more accurate.

Reading the code of the method I really hope we never need to reuse this in any other place. First, it returns an OwnCloudVersion instance as a 'side effect' of syncing capabilities, instead of returning capabilities instance, so the name of the method is confusing. Second, it checks the AccountManager for the version as a fallback for servers that do not respond capabilities (or don't support them), code that I would prefer to get rid of because users just should update to servers with capabilities API instead of staying with elder ones - but I don't trust enough that if we forget that possibility it will not bite us back.

Besides, util classes, the lesser, the better. Static methods are perfect to trigger career conditions in multithreaded environments. Or to dump all kind of stuff in without thinking twice.

EDIT: renamed again so that returned value is not so confusing.

@davivel davivel force-pushed the support_hidden_version_in_status_php branch 3 times, most recently from a41088b to d653999 Compare April 10, 2017 11:25
@davivel
Copy link
Contributor Author

davivel commented Apr 10, 2017

@davigonz , updated.

@davivel davivel force-pushed the support_hidden_version_in_status_php branch from d653999 to 2d98698 Compare April 11, 2017 08:09
@jesmrec
Copy link
Collaborator

jesmrec commented Apr 12, 2017

Pending on the server PR: owncloud/core#27473

@davivel
Copy link
Contributor Author

davivel commented Apr 17, 2017

@jesmrec , @davigonz , server PR was merged.

@davivel davivel force-pushed the support_hidden_version_in_status_php branch 2 times, most recently from b9d8694 to 7447cd1 Compare April 17, 2017 10:54
@davivel davivel added this to the 2.4.0 milestone Apr 17, 2017
@davivel
Copy link
Contributor Author

davivel commented Apr 17, 2017

Trying to work around the weird block of repeated license/cla check. Will close the PR and create a new one.

@davivel davivel closed this Apr 17, 2017
@davivel davivel reopened this Apr 17, 2017
@davivel
Copy link
Contributor Author

davivel commented Apr 17, 2017

This is stupid.

@DeepDiver1975 , please, take a look to repo configuration. We can't merge recent PRs. Same problem in the iOS repo.

@jesmrec
Copy link
Collaborator

jesmrec commented Apr 17, 2017

QA Approved.

@davivel
Copy link
Contributor Author

davivel commented Apr 17, 2017

By the way: the wrong check says "licence/cla" while the correct one say "license/cla" : licence Vs license . I suspect has something to do with the block.

@davivel
Copy link
Contributor Author

davivel commented Apr 17, 2017

@DeepDiver1975 , I suspect that in the repository configuration the protection of master branch is requiring a test with context licence/cla instead of license/cla. That was probably changed recently, and is blocking the PRs.

Please, take a look when possible.

@davivel davivel force-pushed the support_hidden_version_in_status_php branch from 7447cd1 to 3765244 Compare April 17, 2017 11:49
@davivel davivel merged commit d801018 into master Apr 17, 2017
@davivel davivel deleted the support_hidden_version_in_status_php branch April 17, 2017 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup