Primiry sub tag != secondary tags

Đang mở
#4,065 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
authorization, backend

Hướng nghiên cứu

Bắt đầu từ phần kiểm tra của tiện ích mở rộng tag để xác định một tag có phải là secondary hay không, tập trung vào các điều kiện position và parent_id được mô tả trong issue. Tái hiện các thiết lập và các bước tạo discussion được liệt kê, sau đó xác minh rằng một tag primary cùng với subtag primary được chấp nhận mà không có lỗi quyền hạn và rằng mối quan hệ với parent đã chọn được xử lý chính xác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
PHP
Star
6.8k
Fork
891
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
209

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flarum/framework

Tất cả issue của flarum/framework

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.