Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r/boards] initialize board-specific flagging #3146

Closed
8 tasks done
salmad3 opened this issue Nov 18, 2024 · 2 comments · Fixed by #3451
Closed
8 tasks done

[r/boards] initialize board-specific flagging #3146

salmad3 opened this issue Nov 18, 2024 · 2 comments · Fixed by #3451
Assignees

Comments

@salmad3
Copy link
Member

salmad3 commented Nov 18, 2024

Context:

To maintain content quality and enforce community standards within the r/boards realm, a reliable flagging system is necessary. This system should allow designated users to flag posts for review and potential deletion. Initially, only permission-ed users (Owner, Admins, Moderators) will be able to flag. The system should support a configurable threshold for automatic deletion when the flag count is met.

Acceptance Criteria:

  • Implements a Flag struct to store flagging details:

    Example
    type Flag struct {
        User  Address // Address of the user who flagged
        Reason string
    }
  • Extends the Post struct to include a Flags field to track flags:

    Example
    type Post struct {
        // ... existing fields
        Flags []Flag
    }
  • Includes a public FlagPost function that:

    • Checks if the caller has the "flag:post" permission using bp.HasPermission()
    • Adds a Flag entry to the post's Flags field
    • Checks if the flag count reaches the threshold and hides the post if necessary
  • Implements a configurable FlagThreshold (initially hardcoded to 1 flag) to determine when a post should be hidden

  • Applies the flagging system to both posts (threads) and comments

  • Includes error handling for cases where:

    • The user does not have permission to flag
    • The post is unavailable or already hidden
  • Accounts for permission checks using bp.HasPermission() instead of bp.WithPermission()

  • Includes tests to:

    • Confirm successful flagging by users with appropriate permissions
    • Validate that unauthorized users cannot flag posts
    • Ensure posts are hidden when the flag count meets FlagThreshold
    • Check edge cases, such as duplicate flagging

Notes

Future updates may include:

  • A moderation tree view to display the history of moderation actions
  • Configuration of the FlagThreshold on a per-board basis
  • A system for users to appeal hidden posts
@salmad3
Copy link
Member Author

salmad3 commented Nov 26, 2024

@x1unix will initiate.

@salmad3 salmad3 changed the title [r/boards] initialize flagging [r/boards] initialize board-specific flagging Dec 11, 2024
jeronimoalbi pushed a commit that referenced this issue Jan 7, 2025
Add flagging support for boards2 realm.

Closes #3146
@x1unix
Copy link
Contributor

x1unix commented Jan 7, 2025

@salmad3 implemented in: #3451

@salmad3 salmad3 linked a pull request Jan 7, 2025 that will close this issue
@salmad3 salmad3 closed this as completed Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants