Primiry sub tag != secondary tags

未关闭
#4,065 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
php

调研方向

从 tag 扩展中检查 tag 是否为 secondary 的部分开始,重点关注 issue 中描述的 position 和 parent_id 条件。复现列出的设置和创建 discussion 的步骤,然后验证带有 primary subtag 的 primary tag 可以在没有权限错误的情况下被接受,并且选定的 parent 关系得到了正确处理。

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

描述

breaking-changes type/feature
Current Behavior

If I want people to create discussions using at minimum one primary tag and at minimum one primary subtag, it doesn't work properly because the primary subtag doesn't equal the secondary tag.

It gives an error about lack of permission.

Steps to Reproduce
  1. Create a primary tag and put a primary subtag in it
  2. In the settings specify minimum primary tags 1 and minimum secondary tags 1
  3. Try to create a discussion by specifying one primary tag and a primary subtag
  4. It will give a permissions error
Expected Behavior

When you create a discussion using at minimum one primary tag and one primary sub tag the discussion should create and not give permission errors

Screenshots

No response

Environment
  • Flarum version: 1.8.7
  • Webserver: nginx/1.18
  • Hosting environment: vps
  • PHP version: 8.3.8
  • Browser: Firefox 131
Output of php flarum info

No response

Possible Solution

After reviewing the open-source code of the tag extension, I concluded that the check for whether a tag is secondary is done through "tags.position == null".
However, primary subtags have a position, and to fix this, we need to use the following check: "tags.position == null || tags.parent_id != null".
This way, primary subtags will also be considered as secondary tags, as they currently should be.
I also believe we need to check if "tags.parent_id != null" and if the parent of this tag is included in the selected tags.

Additional Context

No response

主要语言
PHP
星标
6.8k
派生
891
平均合并
1 天 10 小时
30 天内合并 PR
209

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

flarum/framework 的其他 Issue

查看 flarum/framework 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

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