nextcloud / nextcloud/server

Allow prioritizing default file actions for a mime type (per user)

Open
#5,065 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement feature: files
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Steps to reproduce
  1. Enable richdocuments to have rich editing for odt files
  2. Enable files_texteditor because you want txt files to be simple
  3. Open an txt file: richdocuments starts

I think it would be nice to have something like a priority of the actions. Currently the last one wins, and since richdocuments is after files_texteditor in the alphabet, files_texteditor has no way to ever win this.

Proposal is to add something like priority to: https://github.com/nextcloud/server/blob/2b794902014264a3793daf42a2ecfa95a1a07342/apps/files/js/fileactions.js#L144-L144

and then:

			if (!!this.actions[mime][name] && this.actions[mime][name].priority < actionSpec.priority) {
				return;
			}

This would allow the files_texteditor to register for text files, while richdocuments can also, so in case files_texteditor is not there, you can still edit them.

Alternate approach would be hacking into richdocuments to only register, when files_texteditor is not there.

cc @MorrisJobke @LukasReschke

cc @RealKelsar for reporting it in IRC

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 at apps/files/js/fileactions.js around line 144 and inspect how richdocuments and files_texteditor register actions for text and ODT MIME types. Trace the current last-registration-wins behavior, then verify that an explicitly prioritized action wins while the lower-priority action remains available when the higher-priority app is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.