photoprism/pkg/react/find.go
Michael Mayer f5a8c5a45d Auth: Session and ACL enhancements #98 #1746
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-09-28 09:01:17 +02:00

21 lines
430 B
Go

package react
// Find finds a reaction by name and emoji.
func Find(reaction string) Emoji {
if reaction == "" {
return Unknown
}
if found := Reactions[reaction]; found != "" {
return found
} else if found = Emoji(reaction); found.Unknown() {
return Unknown
} else {
return found
}
}
// Known checks if the emoji represents a known reaction.
func Known(reaction string) bool {
return !Find(reaction).Unknown()
}