Fixed size issues on main detail view and disappearing of share recipients#26603
Conversation
|
@mjobst-necls, thanks for your PR! By analyzing the history of the files in this pull request, we identified @PVince81, @DeepDiver1975 and @rullzer to be potential reviewers. |
PVince81
left a comment
There was a problem hiding this comment.
Code looks good otherwise.
I haven't tested yet (will need to retest all affected components).
See me comments and let me know what you think.
| PROPERTY_OBJECTID: '{' + OC.Files.Client.NS_OWNCLOUD + '}objectId', | ||
| PROPERTY_OBJECTTYPE: '{' + OC.Files.Client.NS_OWNCLOUD + '}objectType', | ||
| PROPERTY_ACTORDISPLAYNAME: '{' + OC.Files.Client.NS_OWNCLOUD + '}actorDisplayName', | ||
| PROPERTY_CREATEIONDATETIME: '{' + OC.Files.Client.NS_OWNCLOUD + '}creationDateTime' |
There was a problem hiding this comment.
creation, not create-ion ? 😉
| 'creationDateTime': OC.Files.Client.PROPERTY_CREATEIONDATETIME, | ||
| 'objectType': OC.Files.Client.PROPERTY_OBJECTTYPE, | ||
| 'objectId': OC.Files.Client.PROPERTY_OBJECTID, | ||
| 'isUnread': OC.Files.Client.PROPERTY_ISUNREAD |
There was a problem hiding this comment.
weird alignment here, I suggest to not tab or indent after the ":" and let it flow 😄
There was a problem hiding this comment.
Ok, in the editor it looks better with an tab size of 4. I'll change this and take it in future works into account.
| return $displayName; | ||
| }); | ||
| $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { | ||
| return $node->getSize(); |
There was a problem hiding this comment.
The "oc:size" property is only used for folders. For files we use "DAV:getcontentlength" instead.
Did you add it for convenience ?
There was a problem hiding this comment.
No, I just thought the oc:size is the correct property to retrieve the size of an object.
I added the oc:size property to the webdav request payload to retrieve the size and nothing was returned. It must be dependent of another property.
oc:size is also in the request payload of the webdav API:
<?xml version="1.0"?> <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"> <d:prop> <d:getlastmodified /> <d:getetag /> <d:getcontenttype /> <d:resourcetype /> <oc:fileid /> <oc:permissions /> <oc:size /> <d:getcontentlength /> <oc:tags /> <oc:favorite /> <oc:comments-unread /> <oc:owner-display-name /> <oc:share-types /> </d:prop> </d:propfind>
What exactly does the oc:size property express, then? What is the difference of oc:size and d:getcontentlength?
Can I use d:getcontentlength for reloading the size property of shared files and folders?
There was a problem hiding this comment.
Yes, you can add "d:getcontentlength" to the requested properties and then check later which one of "oc:size" or "d:getcontentlength" was set in the response and use that.
The reason why we needed to invent "oc:size" is because the Webdav spec's "d:getcontentlength" isn't suitable for folders/collections and also because we needed something that represents the size of the complete contents (basically the same as the size shown in the properties of a folder in a file manager, the size of ALL included files). This is not exactly the same as checking the "quota-used-bytes" as received shared folders do not use any quota for the current user.
| properties: properties | ||
| }) | ||
| .then(function(status, data) { | ||
| // the following lines should be extracted to a mapper |
There was a problem hiding this comment.
yeah, or use the backbone model's ".fetch()" method instead of getFileInfo, but that's WIP here: #25909. In that PR fetching the properties of the model would automatically make the list's entry refresh.
There was a problem hiding this comment.
Ok, cool. I'll try it.
There was a problem hiding this comment.
Don't try it on your PR, it won't work...
Here you can see it in action in the other PR: https://github.com/owncloud/core/pull/25909/files#diff-dafefd9519924bec4efa9f5af4af8e68L2262
| deferred.resolve(status, data); | ||
| }) | ||
| .fail(function(status) { | ||
| OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name})); |
There was a problem hiding this comment.
"could not load info for file" ?
There was a problem hiding this comment.
Yeah. For sure =/
| // the following lines should be extracted to a mapper | ||
| if( properties.indexOf(OC.Files.Client.PROPERTY_SIZE) !== -1){ | ||
| fileInfo.set('size', data.size); | ||
| } |
There was a problem hiding this comment.
See discussion above about oc:size vs DAV:getcontentlength. You'd need to also check the content length property here I think.
| } | ||
|
|
||
| if( properties.length > 0){ | ||
| this._fileList.reloadProperties(fileInfo, properties); |
There was a problem hiding this comment.
yeah, if we could at some point just call "this.model.fetch()" like I'd like to have in this PR #25909 then we could remove the dependency with the file list completely.
|
@mjobst-necls do we actually still need that reload call ? |
|
@PVince81 Yes, the property reload is still needed because of the file size, which is not contained in the share API response. In big data applications only the information needed for immediate display should be retrieved, minimizing the response data size. This is the point here, because the file size is not shown in the file list. Otherwise, if we want to show e.g. the file/content size summary at the bottom or in a column, the file size should be retrieved by the share api immediately. Of course, we can add the size/contentlength to the share api, but this adds additional overhead for not necessarily needed information until now. The size/contentlength property is only reloaded once per file on demand for the following position on details view: Well, you are the boss and I want the file size to be displayed correctly on the main details view. Which method do you prefer? |
|
|
||
| /** | ||
| * Reloads missing properties from server and set them in the model. | ||
| * @param {OCA.Files.FileInfo} fileInfo file info |
There was a problem hiding this comment.
should be FileInfoModel ?
There was a problem hiding this comment.
Yes, you're right... I'm gonna change this.
There was a problem hiding this comment.
Uh, the FileInfoModel doesn't have a client in this version, yet.
Anyway. I added the client to the FileInfoModel so that we are closer to what we wanna have by PR #25909.
I tested the result and it works =)
|
Ah, damn... I forgot that the sharing file list didn't have the size. Well, if the PROPFIND only happens for the sidebar, then this is fine. Too bad we can't have "reloadCallback" directly on the model. |
|
I had to add the Client to the FileInfoModel, but this should be ok, because we are closer to what we want to have by Issue #25909, now. |
|
Conclusion of changes:
|
|
Great, so I guess ready to review again ? |
|
@PVince81 Yes, this PR should be complete, now. |
|
Tested, works 👍 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

This is a clean PR refering to #26552