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

未关闭 适合新手
#67,606 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
frontend

调研方向

阅读 apps/systemtags/src/components/SystemTags.vue 第 163–171 行附近的错误处理,并与 SystemTagPicker.vue 进行比较;issue 指出后者使用了正确的状态查询。更新限制检查,并确保两个错误分支都会重置加载状态。为错误消息和加载状态添加测试,然后运行相关的 systemtags 组件测试。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
PHP
星标
37.7k
派生
5.4k
平均合并
1 天 23 小时
30 天内合并 PR
585

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud/server 的其他 Issue

查看 nextcloud/server 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。