Bugfixes with user status

ipad-testing
Noah 2023-03-28 18:34:50 -07:00
parent 2e9c02f84e
commit dd9f4b4dd4
2 changed files with 23 additions and 1 deletions

View File

@ -238,6 +238,28 @@ func (s *Server) OnMe(sub *Subscriber, msg Message) {
log.Debug("User %s turns on their video feed", sub.Username)
}
// Hidden status: for operators only, + fake a join/exit chat message.
if sub.JWTClaims != nil && sub.JWTClaims.IsAdmin {
if sub.ChatStatus != "hidden" && msg.ChatStatus == "hidden" {
// Going hidden - fake leave message
s.Broadcast(Message{
Action: ActionPresence,
Username: sub.Username,
Message: "has exited the room!",
})
} else if sub.ChatStatus == "hidden" && msg.ChatStatus != "hidden" {
// Leaving hidden - fake join message
s.Broadcast(Message{
Action: ActionPresence,
Username: sub.Username,
Message: "has joined the room!",
})
}
} else if msg.ChatStatus == "hidden" {
// normal users can not set this status
msg.ChatStatus = "away"
}
sub.VideoActive = msg.VideoActive
sub.VideoNSFW = msg.NSFW
sub.ChatStatus = msg.ChatStatus

View File

@ -697,7 +697,7 @@
<option value="online">☀️ Active</option>
<option value="away">🕒 Away</option>
<option value="idle" v-show="status==='idle'">🕒 Idle</option>
<option value="hidden" v-show="jwt.claims != undefined && jwt.claims.op">🕵️ Hidden</option>
<option value="hidden" v-if="jwt.claims != undefined && jwt.claims.op">🕵️ Hidden</option>
</select>
</div>
</div>