89a5eafa48
Commented out a couple lines of debug code. Fixed a data race where the Online Users widget would sometimes show more users than it should. Added a new phrase.
27 lines
659 B
Go
27 lines
659 B
Go
package common
|
|
|
|
import "github.com/Azareal/Gosora/common/phrases"
|
|
|
|
func wolContextRender(widget *Widget, hvars interface{}) (string, error) {
|
|
header := hvars.(*Header)
|
|
if header.Zone != "view_topic" {
|
|
return "", nil
|
|
}
|
|
var ucount int
|
|
var users []*User
|
|
topicMutex.RLock()
|
|
topic, ok := topicWatchers[header.ZoneID]
|
|
if ok {
|
|
ucount = len(topic)
|
|
if ucount < 30 {
|
|
for wsUser, _ := range topic {
|
|
users = append(users, wsUser.User)
|
|
}
|
|
}
|
|
}
|
|
topicMutex.RUnlock()
|
|
wol := &wolUsers{header, phrases.GetTmplPhrase("widget.online_view_topic_name"), users, ucount}
|
|
err := header.Theme.RunTmpl("widget_online", wol, header.Writer)
|
|
return "", err
|
|
}
|