nextcloud / nextcloud/text

Redirect to files app when opening direct editing from desktop client

Open
#585 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement good first issue php
Dominant language
JavaScript
Stars
659
Forks
133
Avg merge
1d 20h
Merged PRs (30d)
110

Description

This is a challenging https://github.com/nextcloud/text/labels/good%20first%20issue if you...

  • want to learn how the desktop client integrates with the text app
  • have some basic knowledge of php

If you would like some guidance ping @max-nextcloud or join the public text channel.

Problem

Direct editing is a mechanism we use so that from clients (mobile and desktop) you can open a file with a context menu click in your browser so you can collaborate using apps that support it instead of opening the file locally.

This works fine however in cases where the user is already logged in to an instance and has access to the file we want to redirect them to the files app directly. Direct editing has some technical limitations as it is stripped down to also work with only a one time token, so in case possible the forward will result in a better user experience and more functionality.

Here would be a few pointers, to make testing easier one can use the following curl statement to generate a link that the desktop client would open in the browser:

curl --request POST \
  --url 'https://admin:admin@nextcloud.local/ocs/v2.php/apps/files/api/v1/directEditing/open?editorId=text&creatorId=textdocument&format=json' \
  --header 'Content-Type: multipart/form-data' \
  --header 'OCS-APIRequest: true' \
  --form path=/test.md

The goal would be to check if the user is logged in and has access to the requested file. In this case it may not open the existing "direct editing" UI, but instead just redirect using the internal file link (e.g. /index.php/f/12345 for the file id 12345)

Note the implementation of this is likely better suited in the server repository.

Code pointers

https://github.com/nextcloud/server/blob/master/apps/files/lib/Controller/DirectEditingViewController.php#L42-L48 is the entrypoint of the URL that is opened in the browser then, which triggers https://github.com/nextcloud/text/blob/8cdb2d22fc42c60e03f480b1ddecfe328dbaaf42/lib/DirectEditing/TextDirectEditor.php#L151 for the text app.

Additional Context

This would go well together with #3819 if you also want to work with the client side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with server/apps/files/lib/Controller/DirectEditingViewController.php at lines 42-48 and the text app's lib/DirectEditing/TextDirectEditor.php around line 151. Use the provided curl request to test direct-editing links for a logged-in user with access to the file. Done means eligible users are redirected to the internal file link, while other cases retain the existing direct-editing flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.