You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While thread flagging manages top-level posts, comment flagging addresses user replies within a thread. Comments often form nested discussions, so it’s crucial for moderators and admins to flag problematic replies without hiding the entire thread.
Acceptance Criteria
Struct Updates
Extend the Comment struct (or Post where ParentID != 0) to include a Flags field of type []Flag and a Hidden boolean.
Example
typeCommentstruct {
CommentIDstringParentThreadstringAuthorAddressContentstringTimestamp time.TimeFlags []FlagHiddenbool// ... other fields
}
Flag Comment Function
A FlagComment(caller Address, commentID string, reason string) function:
Checks if the caller has "flag:comment" permission.
Fetches the comment by ID.
Appends a Flag to comment.Flags.
If len(comment.Flags) >= CommentFlagThreshold, set comment.Hidden = true.
Returns an error if already hidden or if caller lacks permission.
Example
func (br*BoardsRealm) FlagComment(callerAddress, commentIDstring, reasonstring) error {
if!br.HasPermission(caller, "flag:comment", []interface{}{commentID}) {
returnerrors.New("caller does not have permission to flag comments")
}
comment:=br.GetCommentByID(commentID)
ifcomment==nil {
returnerrors.New("comment not found")
}
ifcomment.Hidden {
returnerrors.New("comment is already hidden")
}
newFlag:=Flag{
User: caller,
Reason: reason,
Date: time.Now(),
}
comment.Flags=append(comment.Flags, newFlag)
iflen(comment.Flags) >=br.Config.CommentFlagThreshold {
comment.Hidden=true
}
br.UpdateComment(comment)
returnnil
}
Permissions
Must verify "flag:comment".
Restricted to moderators, admins, or owners by default.
Hidden Comment Behavior
A hidden comment should either not appear or appear as [Hidden Comment].
The child replies might still be visible, or the entire sub-thread might hide—implementation detail for MVP.
Configuration
CommentFlagThreshold in BoardsRealmConfig, defaulting to 1 or a small integer for MVP.
Ability to be overridden at board level or via AdminDAO in future.
Tests
Successfully flagging a comment by an authorized user.
Failing to flag with no permissions.
Hiding comments upon threshold.
Edge cases: repeated flags, invalid comment IDs, etc.
Notes
This system parallels thread flagging but focuses on deeper discussion layers.
Future expansions include:
Distinct reason codes, feedback loops for moderators.
“Soft hides” that let the author see their own comment but hide it from others.
Appeals or multi-step moderation for flagged comments.
The text was updated successfully, but these errors were encountered:
Context
While thread flagging manages top-level posts, comment flagging addresses user replies within a thread. Comments often form nested discussions, so it’s crucial for moderators and admins to flag problematic replies without hiding the entire thread.
Acceptance Criteria
Struct Updates
Comment
struct (orPost
whereParentID != 0
) to include aFlags
field of type[]Flag
and aHidden
boolean.Example
Flag Comment Function
FlagComment(caller Address, commentID string, reason string)
function:"flag:comment"
permission.Flag
tocomment.Flags
.len(comment.Flags) >= CommentFlagThreshold
, setcomment.Hidden = true
.Example
Permissions
"flag:comment"
.Hidden Comment Behavior
[Hidden Comment]
.Configuration
CommentFlagThreshold
inBoardsRealmConfig
, defaulting to 1 or a small integer for MVP.Tests
Notes
The text was updated successfully, but these errors were encountered: