back interdiff of round #13 and #12

appview/notify: notify users mentioned in issues #738

merged
opened by boltless.me targeting master from feat/mentions
files
appview
indexer
issues
notify
pages
markup
ERROR
appview/indexer/notifier.go

Failed to calculate interdiff for this file.

ERROR
appview/issues/issues.go

Failed to calculate interdiff for this file.

ERROR
appview/notify/db/db.go

Failed to calculate interdiff for this file.

ERROR
appview/notify/merged_notifier.go

Failed to calculate interdiff for this file.

ERROR
appview/notify/notifier.go

Failed to calculate interdiff for this file.

ERROR
appview/notify/posthog/notifier.go

Failed to calculate interdiff for this file.

NEW
appview/pages/markup/markdown.go
··· 302 302 return path.Join(rctx.CurrentDir, dst) 303 303 } 304 304 305 + // FindUserMentions returns Set of user handles from given markup soruce. 306 + // It doesn't guarntee unique DIDs 307 + func FindUserMentions(source string) []string { 308 + var ( 309 + mentions []string 310 + mentionsSet = make(map[string]struct{}) 311 + md = NewMarkdown() 312 + sourceBytes = []byte(source) 313 + root = md.Parser().Parse(text.NewReader(sourceBytes)) 314 + ) 315 + ast.Walk(root, func(n ast.Node, entering bool) (ast.WalkStatus, error) { 316 + if entering && n.Kind() == textension.KindAt { 317 + handle := n.(*textension.AtNode).Handle 318 + mentionsSet[handle] = struct{}{} 319 + return ast.WalkSkipChildren, nil 320 + } 321 + return ast.WalkContinue, nil 322 + }) 323 + for handle := range mentionsSet { 324 + mentions = append(mentions, handle) 325 + } 326 + return mentions 327 + } 328 + 305 329 func isAbsoluteUrl(link string) bool { 306 330 parsed, err := url.Parse(link) 307 331 if err != nil {