Documentation
¶
Index ¶
- func CheckForMentions(text string, objectType string, objectID string, objectName string) map[string]Mention
- func CheckForNewMentions(oldText string, newText string, objectType string, objectID string, ...) []string
- func ExtractMentionedUserIDs(mentions map[string]Mention) []string
- func GetNewMentions(oldText string, newText string, objectType string, objectID string, ...) map[string]Mention
- func IsValidSlateText(text string) bool
- type Mention
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForMentions ¶
func CheckForMentions(text string, objectType string, objectID string, objectName string) map[string]Mention
CheckForMentions parses the Slate formatted text and extracts all user mentions Returns a map where the key is the data-slate-id and the value is the Mention struct
func CheckForNewMentions ¶
func CheckForNewMentions(oldText string, newText string, objectType string, objectID string, objectName string) []string
CheckForNewMentions compares old and new text to identify newly added mentions Takes old text, new text, and returns only the slate IDs that are new
func ExtractMentionedUserIDs ¶
ExtractMentionedUserIDs extracts just the user IDs from a mention map. It validates that each UserID is a valid ULID and skips invalid ones.
func GetNewMentions ¶
func GetNewMentions(oldText string, newText string, objectType string, objectID string, objectName string) map[string]Mention
GetNewMentions is a helper that returns the full Mention objects for new mentions. It parses both texts once and returns only mentions that exist in newText but not in oldText.
func IsValidSlateText ¶
IsValidSlateText checks if the text contains valid Slate formatted content by verifying data-slate-* attributes exist within HTML tags
Types ¶
type Mention ¶
type Mention struct {
// UserID is the unique identifier of the mentioned user
UserID string
// UserDisplayName is the display name shown for the mentioned user
UserDisplayName string
// ObjectType is the type of object where the mention was found (e.g., "comment", "task")
ObjectType string
// ObjectID is the unique identifier of the object containing the mention
ObjectID string
// ObjectName is the human-readable name of the object containing the mention
ObjectName string
}
Mention represents a user mention extracted from Slate formatted text