mirror of
https://github.com/lone-cloud/prism
synced 2026-06-04 04:04:44 -07:00
shorten email actions to include just the first @ part
This commit is contained in:
parent
3f8fc957c5
commit
960b5c2874
1 changed files with 6 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ package delivery
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var phoneRegex = regexp.MustCompile(`(?:\+?1[\s.-]?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}`)
|
var phoneRegex = regexp.MustCompile(`(?:\+?1[\s.-]?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}`)
|
||||||
|
|
@ -32,9 +33,13 @@ func enrichActions(notif Notification) Notification {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
seen[addr] = true
|
seen[addr] = true
|
||||||
|
local := addr
|
||||||
|
if i := strings.Index(addr, "@"); i != -1 {
|
||||||
|
local = addr[:i]
|
||||||
|
}
|
||||||
notif.Actions = append(notif.Actions, Action{
|
notif.Actions = append(notif.Actions, Action{
|
||||||
ID: fmt.Sprintf("email-%s", addr),
|
ID: fmt.Sprintf("email-%s", addr),
|
||||||
Label: fmt.Sprintf("Email %s", addr),
|
Label: fmt.Sprintf("Email %s", local),
|
||||||
Endpoint: fmt.Sprintf("mailto:%s", addr),
|
Endpoint: fmt.Sprintf("mailto:%s", addr),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue