Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions social/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func surfaceBreakingFromNews() {
// Surface the first one (use URL as dedup key)
if !surfaced[a.url] {
surfaced[a.url] = true
SurfaceBreaking(a.title, a.url)
SurfaceBreaking(a.category, a.title, a.url)
app.Log("social", "Breaking: %q matched across %s and %s", a.title, a.category, b.category)
}
}
Expand Down Expand Up @@ -219,8 +219,9 @@ func extractKeywords(title string) map[string]bool {
return words
}

// SurfaceBreaking creates a system thread from external sources (e.g., breaking news)
func SurfaceBreaking(title, link string) {
// SurfaceBreaking creates a system thread from external sources (e.g., breaking news).
// The category is used as the author name (e.g. "Politics", "Finance").
func SurfaceBreaking(category, title, link string) {
if title == "" {
return
}
Expand All @@ -236,7 +237,7 @@ func SurfaceBreaking(title, link string) {

addMessage(&Message{
ID: id,
Author: "Breaking",
Author: category,
AuthorID: "_system",
Content: content,
PostedAt: time.Now(),
Expand Down
Loading