Adventure: stop signing my own posts
The source tag credits an outlet Pete is relaying (`ars technica`). On his own reporting it rendered as a trailing `pete` under a message he already sent - him signing his own name. Drop Source on adventure posts and omit the tag line entirely when there's nothing to credit; RSS posts keep theirs.
This commit is contained in:
@@ -37,7 +37,9 @@ func formatPost(s *PostableStory) (plain, htmlBody string) {
|
|||||||
if s.Lede != "" {
|
if s.Lede != "" {
|
||||||
plainParts = append(plainParts, s.Lede)
|
plainParts = append(plainParts, s.Lede)
|
||||||
}
|
}
|
||||||
plainParts = append(plainParts, formatSourceTag(s.Source, s.Platforms, false))
|
if tag := formatSourceTag(s.Source, s.Platforms, false); tag != "" {
|
||||||
|
plainParts = append(plainParts, tag)
|
||||||
|
}
|
||||||
plain = strings.Join(plainParts, "\n")
|
plain = strings.Join(plainParts, "\n")
|
||||||
|
|
||||||
// HTML body
|
// HTML body
|
||||||
@@ -55,25 +57,32 @@ func formatPost(s *PostableStory) (plain, htmlBody string) {
|
|||||||
if s.Lede != "" {
|
if s.Lede != "" {
|
||||||
htmlParts = append(htmlParts, html.EscapeString(s.Lede))
|
htmlParts = append(htmlParts, html.EscapeString(s.Lede))
|
||||||
}
|
}
|
||||||
htmlParts = append(htmlParts, formatSourceTag(s.Source, s.Platforms, true))
|
if tag := formatSourceTag(s.Source, s.Platforms, true); tag != "" {
|
||||||
|
htmlParts = append(htmlParts, tag)
|
||||||
|
}
|
||||||
htmlBody = strings.Join(htmlParts, "<br/>")
|
htmlBody = strings.Join(htmlParts, "<br/>")
|
||||||
|
|
||||||
return plain, htmlBody
|
return plain, htmlBody
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatSourceTag builds the source + platform tags line.
|
// formatSourceTag builds the source + platform tags line. An empty source is
|
||||||
|
// omitted rather than tagged: Pete's own reporting has no outlet to credit, and
|
||||||
|
// an empty tag would read as him signing his own name.
|
||||||
func formatSourceTag(source string, platforms []string, isHTML bool) string {
|
func formatSourceTag(source string, platforms []string, isHTML bool) string {
|
||||||
|
var parts []string
|
||||||
|
if source != "" {
|
||||||
|
parts = append(parts, strings.ToLower(source))
|
||||||
|
}
|
||||||
|
parts = append(parts, platforms...)
|
||||||
|
if len(parts) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
for i, p := range parts {
|
||||||
if isHTML {
|
if isHTML {
|
||||||
parts := []string{fmt.Sprintf("<code>%s</code>", html.EscapeString(strings.ToLower(source)))}
|
parts[i] = fmt.Sprintf("<code>%s</code>", html.EscapeString(p))
|
||||||
for _, p := range platforms {
|
} else {
|
||||||
parts = append(parts, fmt.Sprintf("<code>%s</code>", html.EscapeString(p)))
|
parts[i] = fmt.Sprintf("`%s`", p)
|
||||||
}
|
}
|
||||||
return strings.Join(parts, " \u00b7 ")
|
|
||||||
}
|
|
||||||
|
|
||||||
parts := []string{fmt.Sprintf("`%s`", strings.ToLower(source))}
|
|
||||||
for _, p := range platforms {
|
|
||||||
parts = append(parts, fmt.Sprintf("`%s`", p))
|
|
||||||
}
|
}
|
||||||
return strings.Join(parts, " \u00b7 ")
|
return strings.Join(parts, " \u00b7 ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,12 +151,14 @@ func (s *Server) handleAdventureIngest(w http.ResponseWriter, r *http.Request) {
|
|||||||
if f.Tier == "priority" && s.advPost != nil && s.adv.Channel != "" {
|
if f.Tier == "priority" && s.advPost != nil && s.adv.Channel != "" {
|
||||||
// No ImageURL: the emblem is an SVG (Matrix clients often block SVG
|
// No ImageURL: the emblem is an SVG (Matrix clients often block SVG
|
||||||
// media), and the link's og:image carries the preview instead.
|
// media), and the link's og:image carries the preview instead.
|
||||||
|
// No Source: the source tag exists to credit an outlet Pete is relaying
|
||||||
|
// (`ars technica`). On his own reporting it renders as him signing his
|
||||||
|
// own name under his own message.
|
||||||
s.advPost(AdvPost{
|
s.advPost(AdvPost{
|
||||||
GUID: f.GUID,
|
GUID: f.GUID,
|
||||||
Headline: headline,
|
Headline: headline,
|
||||||
Lede: lede,
|
Lede: lede,
|
||||||
ArticleURL: articleURL,
|
ArticleURL: articleURL,
|
||||||
Source: advSource,
|
|
||||||
Channel: s.adv.Channel,
|
Channel: s.adv.Channel,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ func (s *Server) postDailyDigest(now time.Time) {
|
|||||||
Headline: headline,
|
Headline: headline,
|
||||||
Lede: lede,
|
Lede: lede,
|
||||||
ArticleURL: s.digestURL(date),
|
ArticleURL: s.digestURL(date),
|
||||||
Source: advSource,
|
|
||||||
Channel: s.adv.Channel,
|
Channel: s.adv.Channel,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user