Monorepo for Tangled tangled.org

appview/notify: notify users mentioned in issues #738

merged opened by boltless.me targeting master from feat/mentions
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3m4jbido5pi22
+24
Interdiff #12 โ†’ #13
appview/indexer/notifier.go

This file has not been changed.

appview/issues/issues.go

This file has not been changed.

appview/notify/db/db.go

This file has not been changed.

appview/notify/merged_notifier.go

This file has not been changed.

appview/notify/notifier.go

This file has not been changed.

appview/notify/posthog/notifier.go

This file has not been changed.

+24
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 {

History

14 rounds 2 comments
sign up or login to add to the discussion
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
pull request successfully merged
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments
1 commit
expand
appview/notify: notify users mentioned in issues
expand 2 comments

the way i'd want to see this implemented is like so:

  • the handle mentions are rewritten by the appview to point to a DID (this way mentions continue to work across handle changes). this can happen when creating a new issue or a new comment. note that when editing a text field, this needs to be retranslated from DID back to handle. we do something similar in labels that accept DIDs for example
  • next, we can introduce models.IssueComment.Mentions to get a list of DIDs mentioned in the text of a comment, and notify them accordingly, upon creation.

I've considered it, but decided to go without did transitions for now. We can merge this as a temporary solution and introduce did-hardening later.

Also not sure, how would that look like in markdown. you mean like this: @did:plc:someone?

1 commit
expand
appview/notify: notify users mentioned in issues
expand 0 comments