Inline chat moderation UI (#1331)

* - mock detect when user turns into moderator
- add moderator indicator to display on messages and username changer

* also mock moderator flag in message payload about user to display indicator

* add some menu looking icons and a menu of actions

* WIP chat moderators

* Add support for admin promoting a user to moderator

* WIP-
open a more info panel of user+message info; add some a11y to buttons

* style the details panel

* adjust positioning of menus

* Merge fixes. ChatClient->Client ChatServer->Server

* Remove moderator bool placeholders to use real state

* Support inline hiding of messages by moderators

* Support inline banning of chat users

* Cleanup linter warnings

* Puppeteer tests fail after typing take place

* Manually resolve conflicts in chat between moderator feature and develop

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
gingervitis
2021-11-02 19:27:41 -07:00
committed by GitHub
parent 4a52ba9f35
commit 9a91324456
23 changed files with 902 additions and 116 deletions

View File

@ -251,7 +251,7 @@ func VerifyFFMpegPath(path string) error {
}
mode := stat.Mode()
//source: https://stackoverflow.com/a/60128480
// source: https://stackoverflow.com/a/60128480
if mode&0111 == 0 {
return errors.New("ffmpeg path is not executable")
}
@ -270,7 +270,7 @@ func CleanupDirectory(path string) {
}
}
// FindInSlice will return the index if a string is located in a slice of strings.
// FindInSlice will return if a string is in a slice, and the index of that string.
func FindInSlice(slice []string, val string) (int, bool) {
for i, item := range slice {
if item == val {
@ -280,6 +280,27 @@ func FindInSlice(slice []string, val string) (int, bool) {
return -1, false
}
// StringSliceToMap is a convinience function to convert a slice of strings into
// a map using the string as the key.
func StringSliceToMap(stringSlice []string) map[string]interface{} {
stringMap := map[string]interface{}{}
for _, str := range stringSlice {
stringMap[str] = true
}
return stringMap
}
// StringMapKeys returns a slice of string keys from a map.
func StringMapKeys(stringMap map[string]interface{}) []string {
stringSlice := []string{}
for k := range stringMap {
stringSlice = append(stringSlice, k)
}
return stringSlice
}
// GenerateRandomDisplayColor will return a random _hue_ to be used when displaying a user.
// The UI should determine the right saturation and lightness in order to make it look right.
func GenerateRandomDisplayColor() int {