Documentation
¶
Index ¶
- Constants
- Variables
- func GetConversationIDForUserFlagByOrdinal(userID int, ordinal int) (int, error)
- func GetConversationIDsForUserFlags(userID int) ([]int, error)
- func GetFlagCountForConversation(conversationID int) (int, error)
- func GetFlagCountForUser(userID int) (int, error)
- func GetPublicConversationIDByOrdinal(adID int, ordinal int) (int, error)
- func GetPublicConversationsForAd(adID int) ([]int, error)
- func GetUserFlagCount(userID int) (int, error)
- func HasUserRaisedFlag(userID, conversationID int) (bool, error)
- func LowerActiveForAd(adID int) error
- func LowerActiveForUser(userID int) error
- func LowerFlag(userID, conversationID int) error
- func RaiseFlag(userID, conversationID int, reason string) error
- func ReasonLabel(code string) string
- func ReasonLabelForTarget(code string, atAd bool) string
- func SyncAdFlagCount(adID int) error
- func ValidReason(code string) bool
- type ReasonInfo
Constants ¶
const ( ReasonPolicy = "policy" ReasonConduct = "conduct" ReasonDeal = "deal" )
Variables ¶
var ErrFlagAlreadyRaised = errors.New("a flag has already been raised on this conversation")
var ErrFlagNotFound = errors.New("flag not found")
var ErrInvalidReason = errors.New("invalid flag reason")
var ErrMaxFlagsReached = errors.New("user has reached maximum outstanding flags")
var Reasons = ReasonsAtAd
Reasons is the union used for code validation.
var ReasonsAtAd = []ReasonInfo{ { Code: ReasonPolicy, Label: "Listing or content violates policies", Examples: []string{ "Scam or fake listing", "Illegal goods", "Spam or impersonation", "Sexual or prohibited images", "Stolen photos or IP issues", }, }, { Code: ReasonConduct, Label: "Seller harassment or bad-faith conduct", Examples: []string{ "Threats or abuse in messages", "Pressure to share personal info", "Repeated hostile contact", "Bad-faith negotiation", }, }, { Code: ReasonDeal, Label: "Deal or transaction went wrong", Examples: []string{ "No-show", "Item not as described", "Payment or meetup dispute", "Bait-and-switch after chat", }, }, }
ReasonsAtAd is for inquirer throwing at a listing.
var ReasonsAtUser = []ReasonInfo{ { Code: ReasonPolicy, Label: "Scam, spam, or prohibited requests", Examples: []string{ "Advance-fee or deposit scam", "Spam or mass messaging", "Requests for illegal goods or services", "Phishing or credential harvesting", }, }, { Code: ReasonConduct, Label: "Harassment or bad-faith conduct", Examples: []string{ "Threats or abuse in messages", "Pressure to share personal info", "Repeated hostile contact", "Bad-faith negotiation", }, }, { Code: ReasonDeal, Label: "Deal or meetup went wrong", Examples: []string{ "No-show", "Changed terms after agreeing", "Payment dispute", "Unsafe or dishonest meetup behavior", }, }, }
ReasonsAtUser is for owner throwing at an inquirer.
Functions ¶
func GetConversationIDForUserFlagByOrdinal ¶
GetConversationIDForUserFlagByOrdinal returns the conversation ID at the given ordinal position (0-based) for flags bound to a user (where flag_raiser_id = owner_id AND inquirer_id = userID), ordered by flag_raised_at DESC
func GetConversationIDsForUserFlags ¶
GetConversationIDsForUserFlags returns conversation IDs for flags bound to a user (where flag_raiser_id = owner_id, meaning owner threw flag at inquirer)
func GetFlagCountForConversation ¶
GetFlagCountForConversation returns whether a flag exists for a conversation
func GetFlagCountForUser ¶
GetFlagCountForUser returns the count of flags bound to a user (flags where owner threw at this user)
func GetPublicConversationIDByOrdinal ¶
GetPublicConversationIDByOrdinal returns the conversation ID at the given ordinal position (0-based) for public conversations with flags bound to the ad (flag_raiser_id = inquirer_id), ordered by latest activity DESC
func GetPublicConversationsForAd ¶
GetPublicConversationsForAd returns public conversation IDs for an ad Only returns conversations with flags bound to the ad (flag_raiser_id = inquirer_id)
func GetUserFlagCount ¶
GetUserFlagCount returns the count of outstanding flags thrown by a user
func HasUserRaisedFlag ¶
HasUserRaisedFlag checks if a user has thrown a flag at a conversation
func LowerActiveForAd ¶
LowerActiveForAd clears active flags on all conversations for an ad.
func LowerActiveForUser ¶
LowerActiveForUser clears flags thrown by or bound to the user.
func RaiseFlag ¶
RaiseFlag raises a flag on a conversation, making it public. If the inquirer raises it, flag_raiser_id is the inquirer (bound to the ad). If the owner raises it, flag_raiser_id is the owner (bound to the inquirer).
func ReasonLabel ¶
func ReasonLabelForTarget ¶
func SyncAdFlagCount ¶
SyncAdFlagCount sets ads.flag_count from ad-bound flags on conversations.
func ValidReason ¶
Types ¶
type ReasonInfo ¶
func ReasonsForTarget ¶
func ReasonsForTarget(atAd bool) []ReasonInfo