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

Aberta Para iniciantes
#67,606 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
javascript
Domínio
frontend

Direção de pesquisa

Leia apps/systemtags/src/components/SystemTags.vue próximo ao tratamento de erros nas linhas 163–171 e compare com SystemTagPicker.vue, que a issue indica como usando a consulta de estado correta. Atualize a verificação da restrição e garanta que o estado de carregamento seja redefinido em ambos os ramos de erro. Adicione um teste para a mensagem de erro e o estado de carregamento e, em seguida, execute os testes relevantes dos componentes systemtags.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
PHP
Estrelas
37.7k
Forks
5.4k
Merge médio
1d 23h
PRs com merge (30d)
585

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de nextcloud/server

Todas as issues de nextcloud/server

Issues semelhantes

Mais issues de PHP

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.