Skip to content

Implement favorites#2454

Open
aduffeck wants to merge 9 commits intoopencloud-eu:mainfrom
aduffeck:search-based-favorites
Open

Implement favorites#2454
aduffeck wants to merge 9 commits intoopencloud-eu:mainfrom
aduffeck:search-based-favorites

Conversation

@aduffeck
Copy link
Member

Favorites are set/unset using the graph API, and the list of favorites is managed using the search service. To filter for favorites a new is:favorite flag has been added (only works on the API level currently, the UI hasn't been adapted yet.

Note: depends on opencloud-eu/reva#554

Example httpyac for testing:

###
// @title initiate first upload
// @name upload1
{{
  $global.filename=new Buffer($random.alphabetic(50)+'.txt', 'utf-8').toString('base64')
  console.log("Generating new filename: " + $global.filename);
}}

### get personal drive
# @name personaldrive
GET {{host}}/graph/v1.0/me/drive?$select=id
Authorization: Basic {{username}}:{{password}}

### Upload file
PUT {{host}}/remote.php/dav/spaces/{{personaldrive.id}}/{{$global.filename}}
Authorization: Basic {{username}}:{{password}}
X-OC-Mtime: 1565233093
Content-Type: text/plain

uploaded content

?? status == 201

### Get file id
PROPFIND {{host}}/remote.php/dav/spaces/{{personaldrive.id}}/{{$global.filename}}
Authorization: Basic {{username}}:{{password}}
?? status == 207
{{

    const {select} = require("xpath");
    try{
        $global.fileid = select("//*[local-name(.)='id']/text()", response.parsedBody)[0].nodeValue;
    }catch(err){
        console.error(err);
    }
    console.log("id:", $global.fileid)    ;
}}

## Mark file as favorite using the graph api
POST {{host}}/graph/v1.0/me/drive/items/{{$global.fileid}}/follow
Authorization: Basic {{username}}:{{password}}
?? status == 201


## Unmark file as favorite using the graph api
DELETE {{host}}/graph/v1.0/me/drive/following/{{$global.fileid}}
Authorization: Basic {{username}}:{{password}}
?? status == 204

### Search favorites
@xpath_ns d = DAV:
REPORT {{host}}/remote.php/dav/spaces
Authorization: Basic {{username}}:{{password}}
Content-Type: application/xml
<?xml version="1.0" encoding="utf-8" ?>
<oc:search-files xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" >
    <d:prop>*</d:prop>
    <oc:search>
        <oc:pattern>is:favorite</oc:pattern>
    </oc:search>
</oc:search-files>

@aduffeck aduffeck requested a review from rhafer March 11, 2026 10:02
@aduffeck aduffeck marked this pull request as ready for review March 12, 2026 07:06
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
13.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Member

@rhafer rhafer left a comment

Choose a reason for hiding this comment

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

Needs rebase. Otherwise 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants