flarum / flarum/framework

Primiry sub tag != secondary tags

Open
#4,065 3 comments 0 reactions 0 assignees View on GitHub
breaking-changes type/feature
Dominant language
PHP
Stars
6.7k
Forks
883
Avg merge
15h 16m
Merged PRs (30d)
73

Description

### 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.