Files sidebar: tag creation error ignores the "restrict to admins" setting

Open Beginner friendly
#67,606 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
frontend

Research direction

Read apps/systemtags/src/components/SystemTags.vue around the error handling at lines 163–171 and compare it with SystemTagPicker.vue, which the issue names as using the correct state lookup. Update the restriction check and ensure loading is reset in both error branches. Add a test for the error message and loading state, then run the relevant systemtags component tests.

Written by the indexing model from the issue text.

Description

1. to develop bug feature: tags good first issue
Bug description

When creating a tag in the Files sidebar fails, SystemTags.vue decides on the error message by reading the creation restriction from the initial state of the settings app:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/apps/systemtags/src/components/SystemTags.vue#L163-L171

In Files this state is provided by the systemtags app (LoadAdditionalScriptsListener / BeforeTemplateRenderedListener), the settings one only exists on the admin server settings page. So the value is always false here and users always get the generic "Failed to create tag" instead of "System admin disabled tag creation. You can only use existing ones." In addition, the early return in that branch skips loading.value = false, so once the app id is fixed the component would stay in the loading state after this error.

Steps to reproduce

Found by code reading.

  1. As admin, restrict tag creation to admins.
  2. As a regular user, try to create a new tag from the Files sidebar.
  3. "Failed to create tag" is shown.
Expected behavior

The state is read via loadState('systemtags', 'restrictSystemTagsCreationToAdmin', false) (as SystemTagPicker.vue does), the loading state is reset in both branches, and this is covered by a test.

Nextcloud version

master

Dominant language
PHP
Stars
37.7k
Forks
5.4k
Avg merge
1d 23h
Merged PRs (30d)
585

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from nextcloud/server

All issues in nextcloud/server

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.