Skip to content
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

All: Resolves #1266: Add support for onedrive for Business #3433

Merged
merged 12 commits into from
Aug 7, 2020
Merged

All: Resolves #1266: Add support for onedrive for Business #3433

merged 12 commits into from
Aug 7, 2020

Conversation

jonath92
Copy link
Contributor

The code works already but I still need to make some minor improvements (error handling, testing). I also need to check it on mobile (although I am pretty sure it will work). So it is still work in progress .

@tessus tessus added enhancement Feature requests and code enhancements sync sync related issue WIP labels Jun 30, 2020
@jonath92
Copy link
Contributor Author

jonath92 commented Jul 1, 2020

I have tested the code now on Android and Linux with an OneDrive for Business and Personal account and it is working. I haven't added any automated tests as there are currently only rough tests for syncing and therefore the current tests are sufficient as far as I can see.
The test failed but the reason therefore is that I have merged the master into the branch and the master branch is failing.

I don't understand the purpose of the "OneDrive Dev" sync target which is only visible when you build joplin from source. No other sync target has an extra Dev target. I had to add an extra line to make it also work with "OneDrive Dev" which I almost forgot.

So @laurent22 I think the code is finish but I am happy to improve the code when you see anything.

ReactNativeClient/lib/file-api-driver-onedrive.js Outdated Show resolved Hide resolved
ReactNativeClient/lib/SyncTargetOneDrive.js Outdated Show resolved Hide resolved
ReactNativeClient/lib/models/Setting.js Outdated Show resolved Hide resolved
return `${r.parentReference.path}/${r.name}`;
}

authCodeUrl(redirectUri) {
const query = {
client_id: this.clientId_,
scope: 'files.readwrite offline_access',
scope: 'files.readwrite offline_access sites.readwrite.all',
Copy link
Owner

Choose a reason for hiding this comment

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

How will that work with existing apps that have already authorised, but with a different scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is no problem because all requests to the OneDrive API also work without the "sites.readwrite.all" permission for OneDrive Personal accounts. The "sites.readwrite.all" permission is only important for Business accounts. To make sure I also have tested the PR with an OneDrive Personal Account and without the "sites.readwrite.all" permission without problems. This might only be problematic if a user has logged in with an OneDrive Business account in a previous version. In this case the user might think that he only has to upgrade Joplin in order to use his account but this is no true as he also has to log out and log in again before he can use his OneDrive Business account.

ReactNativeClient/lib/onedrive-api.js Outdated Show resolved Hide resolved
@jonath92
Copy link
Contributor Author

Thanks for your review @laurent22. I have now solved all your comments. In particular the potential error is now shown in the sidebar. Let me know if other changes are required.

@jonath92 jonath92 requested a review from laurent22 July 10, 2020 12:08
@laurent22 laurent22 changed the base branch from master to dev August 7, 2020 23:34
@laurent22 laurent22 merged commit 799a9e8 into laurent22:dev Aug 7, 2020
@laurent22
Copy link
Owner

Looks good, thanks for the update @jonath92!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and code enhancements sync sync related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants