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

[stable26] SystemTags endpoint to return tags used by a user with meta data #38307

Merged
merged 6 commits into from
May 17, 2023

Commits on May 16, 2023

  1. PoC: SystemTags endpoint to return tags used by a user with meta data

    Target case is photos app: when visiting the tags category, all systemtags
    of the whole cloud are retrieved. In subequent steps the next tag is
    requested until the browser view is filled with tag tiles (i.e. previews
    are requested just as well).
    
    With this approach, we incorpoate the dav search and look for user related
    tags that are used by them, and already returns the statistics (number of
    files tagged with the respective tag) as well as a file id for the purpose
    to load the preview. This defaults to the file with the highest id.
    
    Call:
    curl -s -u 'user:password' \
      'https://my.nc.srv/remote.php/dav/systemtags-current' \
      -X PROPFIND -H 'Accept: text/plain' \
      -H 'Accept-Language: en-US,en;q=0.5'  -H 'Depth: 1' \
      -H 'Content-Type: text/plain;charset=UTF-8' \
      --data @/home/doe/request-systemtag-props.xml
    
    With request-systemtag-props.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <d:propfind xmlns:d="DAV:">
            <d:prop xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
                    <oc:id/>
                    <oc:display-name/>
                    <oc:user-visible/>
                    <oc:user-assignable/>
                    <oc:can-assign/>
                    <nc:files-assigned/>
                    <nc:reference-fileid/>
            </d:prop>
    </d:propfind>
    
    Example output:
      …
      <d:response>
        <d:href>/master/remote.php/dav/systemtags/84</d:href>
        <d:propstat>
          <d:prop>
            <oc:id>84</oc:id>
            <oc:display-name>Computer</oc:display-name>
            <oc:user-visible>true</oc:user-visible>
            <oc:user-assignable>true</oc:user-assignable>
            <oc:can-assign>true</oc:can-assign>
            <nc:files-assigned>42</nc:files-assigned>
            <nc:reference-fileid>924022</nc:reference-fileid>
          </d:prop>
          <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
      </d:response>
      <d:response>
        <d:href>/remote.php/dav/systemtags/97</d:href>
        <d:propstat>
          <d:prop>
            <oc:id>97</oc:id>
            <oc:display-name>Bear</oc:display-name>
            <oc:user-visible>true</oc:user-visible>
            <oc:user-assignable>true</oc:user-assignable>
            <oc:can-assign>true</oc:can-assign>
            <nc:files-assigned>1</nc:files-assigned>
            <nc:reference-fileid>923422</nc:reference-fileid>
          </d:prop>
          <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
      </d:response>
      …
    
    Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
    blizzz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    2ea872d View commit details
    Browse the repository at this point in the history
  2. feat: specify media type via url path: systemtags-current/$mediaType

    - only the media part of the mime type can be search, but not the full
      mime type. It can be added, should it become necessary.
    - thus fixes previously hardcoded selector for image/ types
    - also fixes a return type hint
    - adds a return type hint
    
    Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
    blizzz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    c0dbde5 View commit details
    Browse the repository at this point in the history
  3. fix: improve naming of new systemtags endpoint to systemtags-assigned

    Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
    blizzz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    b1c8fc3 View commit details
    Browse the repository at this point in the history
  4. chore: polish SystemTagsInUseCollection

    - DI SystemTagManager
    - add some comments and doc
    - catch NoUserException
    - add return type hints
    
    Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
    blizzz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    f50ce8b View commit details
    Browse the repository at this point in the history
  5. refactor: remove SystemTag logic from Folder into QuerySearchHelper

    - adds OC\SystemTag\SystemTagsInFilesDetector where the search logic is
      moved to
    
    Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
    blizzz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    f2b5a07 View commit details
    Browse the repository at this point in the history
  6. refactor: remove where specification from SELECT getter

    - search constraints are now fully in control of
      SystemTagsInFilesDetector::detectAssignedSystemTagsIn(), avoids
      duplication of a WHERE statement
    
    Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
    blizzz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    298af3c View commit details
    Browse the repository at this point in the history