Documentation
¶
Index ¶
- Constants
- Variables
- func GetConversationIDForUserRockByOrdinal(userID int, ordinal int) (int, error)
- func GetConversationIDsForUserRocks(userID int) ([]int, error)
- func GetPublicConversationIDByOrdinal(adID int, ordinal int) (int, error)
- func GetPublicConversationsForAd(adID int) ([]int, error)
- func GetRockCountForConversation(conversationID int) (int, error)
- func GetRockCountForUser(userID int) (int, error)
- func GetUserRockCount(userID int) (int, error)
- func HasUserThrownRock(userID, conversationID int) (bool, error)
- func ReasonLabel(code string) string
- func ReasonLabelForTarget(code string, atAd bool) string
- func SyncAdRockCount(adID int) error
- func ThrowRock(userID, conversationID int, reason string) error
- func UnthrowActiveForAd(adID int) error
- func UnthrowActiveForUser(userID int) error
- func UnthrowRock(userID, conversationID int) error
- func ValidReason(code string) bool
- type ReasonInfo
Constants ¶
const ( ReasonPolicy = "policy" ReasonConduct = "conduct" ReasonDeal = "deal" )
Variables ¶
var ErrInvalidReason = errors.New("invalid flag reason")
var ErrMaxRocksReached = errors.New("user has reached maximum outstanding flags")
var ErrRockAlreadyThrown = errors.New("a flag has already been raised on this conversation")
var ErrRockNotFound = errors.New("flag not found")
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 GetConversationIDForUserRockByOrdinal ¶
GetConversationIDForUserRockByOrdinal returns the conversation ID at the given ordinal position (0-based) for rocks bound to a user (where flag_raiser_id = owner_id AND inquirer_id = userID), ordered by flag_raised_at DESC
func GetConversationIDsForUserRocks ¶
GetConversationIDsForUserRocks returns conversation IDs for rocks bound to a user (where flag_raiser_id = owner_id, meaning owner threw rock at inquirer)
func GetPublicConversationIDByOrdinal ¶
GetPublicConversationIDByOrdinal returns the conversation ID at the given ordinal position (0-based) for public conversations with rocks 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 rocks bound to the ad (flag_raiser_id = inquirer_id)
func GetRockCountForConversation ¶
GetRockCountForConversation returns whether a rock exists for a conversation
func GetRockCountForUser ¶
GetRockCountForUser returns the count of rocks bound to a user (rocks where owner threw at this user)
func GetUserRockCount ¶
GetUserRockCount returns the count of outstanding rocks thrown by a user
func HasUserThrownRock ¶
HasUserThrownRock checks if a user has thrown a rock at a conversation
func ReasonLabel ¶
func ReasonLabelForTarget ¶
func SyncAdRockCount ¶
SyncAdRockCount sets ads.flag_count from ad-bound rocks on conversations.
func ThrowRock ¶
ThrowRock throws a rock at a conversation, making it public If inquirer throws: flag_raiser_id = inquirer_id (bound to ad) If owner throws: flag_raiser_id = owner_id (bound to inquirer)
func UnthrowActiveForAd ¶
UnthrowActiveForAd clears active rocks on all conversations for an ad.
func UnthrowActiveForUser ¶
UnthrowActiveForUser clears rocks thrown by or bound to the user.
func UnthrowRock ¶
UnthrowRock removes a rock from a conversation
func ValidReason ¶
Types ¶
type ReasonInfo ¶
func ReasonsForTarget ¶
func ReasonsForTarget(atAd bool) []ReasonInfo