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

share api expanded by tags #26583

Conversation

mjobst-necls
Copy link
Contributor

@mjobst-necls mjobst-necls commented Nov 8, 2016

Description

Modification of the share api. The share api adds the file tags to the response if "show_tags" is existing and has a positive value in the request.

Attention: This Issue is not solved yet by this first commits. Additional information is needed. I'm also not yet confident with the naming conventions at all.

  1. Is the request parameter name "show_tags" ok?

  2. Check the modified populateTags() function. That function was only used in the /apps/files/ajax/list.php
    2a) Is that list.php still needed?
    2b) How can this file be tested?
    2c) The populateTags() function returned the same value as passed by as parameter. Did this function really do its job correct?

  3. Should it be/Is it possible to mark remote shares as favorite?

  4. The favorite indicator should be shown in the share views. The tags can now be retrieved by the share api. Do you think my approach regarding adding the entries to the allowedList (see Cannot set a file as favorite from the star icon in the sidebar in tags menu #26437) would be ok by now

  5. Is 'file_source' the correct field to identify the object in shares?

Additional Tests have to be added. I will do this when all questions have been answered.

Related Issue

#19753

#19753 should be done before #26437

Motivation and Context

The share views should be enhanced by the favorite indicator and actions.

How Has This Been Tested?

By simple api calls.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mention-bot
Copy link

@mjobst-necls, thanks for your PR! By analyzing the history of the files in this pull request, we identified @PVince81, @rullzer and @LukasReschke to be potential reviewers.

@mjobst-necls
Copy link
Contributor Author

mjobst-necls commented Nov 8, 2016

The Tags::getTagsForObjects() function is not very performant, because a query will be executed for each object id. We could modify this function in that way, that just one select with objid in (1,2,4,....) is done and do a mapping afterwards.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

Great initiative !

Looks good so far apart from the name.

@@ -183,7 +184,8 @@
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',
/* jshint camelcase: false */
data: {
format: 'json'
format: 'json',
show_tags: true
Copy link
Contributor

Choose a reason for hiding this comment

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

call it include_tags because the API doesn't really show anything but just returns a result. What the API consumer does with it is up to them. Also adjust the variable names everywhere accordingly 😄

@PVince81
Copy link
Contributor

PVince81 commented Nov 8, 2016

2a) Is that list.php still needed?

I think it's only used by the file picker dialog now (try for example to select an avatar with it), it doesn't require any tags for that.

2b) How can this file be tested?

file picker

2c) The populateTags() function returned the same value as passed by as parameter. Did this function really do its job correct?

It used to, yes. There was a time where the whole files app was using ajax/*.php calls including that list.php. We changed it to use the Webdav API since OC 9.0 because why have duplicate endpoints.

Should it be/Is it possible to mark remote shares as favorite?

It is already possible by marking the mount point of the remote share as favorite, which itself also has a fileid.

The favorite indicator should be shown in the share views. The tags can now be retrieved by the share api. Do you think my approach regarding adding the entries to the allowedList (see #26437) would be ok by now

Yes, sounds good.

Is 'file_source' the correct field to identify the object in shares?

Yes, file_source points to the fileid from the oc_filecache.

Tags::getTagsForObjects()

Hmm I thought that one was already optimized. If you have ideas to make it better, let's do it in a separate PR then.

Thanks a lot, I really appreciate the effort 😄

@PVince81 PVince81 added this to the 9.2 milestone Nov 8, 2016
@mjobst-necls
Copy link
Contributor Author

Ok. This should work now. There still exist a few little bugs (Expiration date/Shared With disappear, Size is not shown correctly on details view), but they will be fixed by #26552 after some modifications.

mjobst-necls and others added 4 commits November 9, 2016 01:31
Added missing function description
Added missing function description
implicit boolean conversion to !empty()
@mjobst-necls
Copy link
Contributor Author

mjobst-necls commented Nov 9, 2016

Ok, it seems that jenkins error is not caused by this PR.

@mjobst-necls
Copy link
Contributor Author

Result:

screencast 2016-11-09 13-08-48

@PVince81
Copy link
Contributor

PVince81 commented Nov 9, 2016

Fantastic work ! Code looks great and also works. 👍

Let me kick Jenkins again... somehow that random failure always appear from times to times (#25830)

@DeepDiver1975
Copy link
Member

Really nice! 👍

@DeepDiver1975 DeepDiver1975 merged commit 0c1b764 into owncloud:master Nov 10, 2016
elie195 pushed a commit to elie195/core that referenced this pull request Mar 23, 2017
* share api expanded by tags

* Modified files_sharing JS Unit tests

* modified tests. renamed request parameter. refactoring

* Update Share20OCS.php

Added missing function description

* Update Helper.php

Added missing function description

* Update Helper.php

implicit boolean conversion to !empty()

* Update Share20OCSTest.php
@lock
Copy link

lock bot commented Aug 4, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants