-
-
Notifications
You must be signed in to change notification settings - Fork 150
Sharing fixes #2974
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
base: main
Are you sure you want to change the base?
Sharing fixes #2974
Conversation
c2673c5 to
2a5a5d5
Compare
| fun getShareFromNote( | ||
| @Query("path") path: String, | ||
| @Query("shared_with_me") sharedWithMe: Boolean = true | ||
| @Query("shared_with_me") sharedWithMe: Boolean = false |
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.
The web calls
format=json
path=%2FNotes%2FSamples%2FFormatting.md
shared_with_me=true
So I am not sure if this is correct to be changed
|
|
||
| if (share.getSharedWithDisplayName() != null) { | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getSharedWithDisplayName()); | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getShareWith()); |
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.
Than the if-clause needs to be updated as well
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.
| note.title + | ||
| notesSuffix | ||
| } | ||
| return StringConstants.PATH + notesPath + StringConstants.PATH + note.category + StringConstants.PATH + note.title + notesSuffix |
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.
this will fail for notes not in a category I guess because it woudl add a StringConstants.PATH + StringConstants.PATH no?
|
What issue or bug does this PR fix? What should we test, and how should we test it? Could you share steps to reproduce the issue? |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
2a5a5d5 to
c6ebd51
Compare
| fun getShareFromNote( | ||
| @Query("path") path: String, | ||
| @Query("shared_with_me") sharedWithMe: Boolean = true | ||
| @Query("shared_with_me") sharedWithMe: Boolean = false |
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.
By default is true in current master but expected value is false then? And in where exactly this didn't set to actual value.
|
|
||
| if (share.getSharedWithDisplayName() != null) { | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getSharedWithDisplayName()); | ||
| AvatarLoader.INSTANCE.load(context, binding.icon, account, share.getShareWith()); |
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.
| } | ||
|
|
||
| fun getShareFromNote(note: Note): List<OCShare>? { | ||
| fun getShareFromNote(note: Note): List<OCShare> { |
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.
No need mutable list conversion and we can clearify variable names. Could you please change with following code?
fun getShareFromNote(note: Note): List<OCShare> {
val sharesWithMe = fetchShares(note, sharedWithMe = true)
val sharesWithOthers = fetchShares(note, sharedWithMe = false)
return sharesWithOthers + sharesWithMe
}
private fun fetchShares(note: Note, sharedWithMe: Boolean): List<OCShare> {
val api = apiProvider.getShareAPI(applicationContext, account)
val path = getNotePath(note) ?: return emptyList()
val call = api.getShareFromNote(path, sharedWithMe)
val response = call.execute()
return try {
if (response.isSuccessful) {
val body = response.body()
Log_OC.d(tag, "Response successful: $body")
body?.ocs?.data?.toOCShareList() ?: emptyList()
} else {
val errorBody = response.errorBody()?.string()
Log_OC.d(tag, "Response failed: $errorBody")
emptyList()
}
} catch (e: Exception) {
Log_OC.d(tag, "Exception while getting share from note: ", e)
emptyList()
}
}|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/2974.apk |


No description provided.