Chat status updates
This commit is contained in:
parent
3560e63096
commit
e69449124e
|
@ -36,7 +36,7 @@ func (s *Server) Statistics() http.HandlerFunc {
|
||||||
// Count all users + collect unique usernames.
|
// Count all users + collect unique usernames.
|
||||||
var unique = map[string]struct{}{}
|
var unique = map[string]struct{}{}
|
||||||
for _, sub := range s.IterSubscribers() {
|
for _, sub := range s.IterSubscribers() {
|
||||||
if sub.authenticated {
|
if sub.authenticated && sub.ChatStatus != "hidden" {
|
||||||
result.UserCount++
|
result.UserCount++
|
||||||
if _, ok := unique[sub.Username]; ok {
|
if _, ok := unique[sub.Username]; ok {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -145,7 +145,7 @@ func (s *Server) OnMessage(sub *Subscriber, msg Message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the sender already mutes the recipient, reply back with the error.
|
// If the sender already mutes the recipient, reply back with the error.
|
||||||
if sub.Mutes(rcpt.Username) {
|
if err == nil && sub.Mutes(rcpt.Username) {
|
||||||
sub.ChatServer("You have muted %s and so your message has not been sent.", rcpt.Username)
|
sub.ChatServer("You have muted %s and so your message has not been sent.", rcpt.Username)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@ func (sub *Subscriber) ReadLoop(s *Server) {
|
||||||
log.Error("ReadLoop error(%d=%s): %+v", sub.ID, sub.Username, err)
|
log.Error("ReadLoop error(%d=%s): %+v", sub.ID, sub.Username, err)
|
||||||
s.DeleteSubscriber(sub)
|
s.DeleteSubscriber(sub)
|
||||||
|
|
||||||
// Notify if this user was auth'd
|
// Notify if this user was auth'd and not hidden
|
||||||
if sub.authenticated {
|
if sub.authenticated && sub.ChatStatus != "hidden" {
|
||||||
s.Broadcast(Message{
|
s.Broadcast(Message{
|
||||||
Action: ActionPresence,
|
Action: ActionPresence,
|
||||||
Username: sub.Username,
|
Username: sub.Username,
|
||||||
|
@ -317,6 +317,10 @@ func (s *Server) SendWhoList() {
|
||||||
|
|
||||||
var users = []WhoList{}
|
var users = []WhoList{}
|
||||||
for _, user := range subscribers {
|
for _, user := range subscribers {
|
||||||
|
if user.ChatStatus == "hidden" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
who := WhoList{
|
who := WhoList{
|
||||||
Username: user.Username,
|
Username: user.Username,
|
||||||
Status: user.ChatStatus,
|
Status: user.ChatStatus,
|
||||||
|
@ -330,7 +334,7 @@ func (s *Server) SendWhoList() {
|
||||||
who.NSFW = false
|
who.NSFW = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if sub.JWTClaims != nil {
|
if user.JWTClaims != nil {
|
||||||
who.Operator = user.JWTClaims.IsAdmin
|
who.Operator = user.JWTClaims.IsAdmin
|
||||||
who.Avatar = user.JWTClaims.Avatar
|
who.Avatar = user.JWTClaims.Avatar
|
||||||
who.ProfileURL = user.JWTClaims.ProfileURL
|
who.ProfileURL = user.JWTClaims.ProfileURL
|
||||||
|
|
|
@ -697,6 +697,7 @@
|
||||||
<option value="online">☀️ Active</option>
|
<option value="online">☀️ Active</option>
|
||||||
<option value="away">🕒 Away</option>
|
<option value="away">🕒 Away</option>
|
||||||
<option value="idle" v-show="status==='idle'">🕒 Idle</option>
|
<option value="idle" v-show="status==='idle'">🕒 Idle</option>
|
||||||
|
<option value="hidden" v-show="jwt.claims != undefined && jwt.claims.op">🕵️ Hidden</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user