make shadowbannedcels able to see their messages again if they refresh the chat

master
Aevann 2024-04-08 07:12:08 +02:00
parent 09cde74a38
commit 58fc68c0a4
2 changed files with 6 additions and 21 deletions

View File

@ -110,25 +110,7 @@ def speak(data, v):
text_html = sanitize(text, count_emojis=True, chat=True)
if isinstance(text_html , tuple): return ''
if v.shadowbanned or execute_blackjack(v, None, text, "chat"):
data = {
"id": secrets.token_urlsafe(5),
"quotes": data['quotes'],
"hat": v.hat_active(None)[0],
"user_id": v.id,
"username": v.username,
"namecolor": v.name_color,
"patron": v.patron,
"pride_username": bool(v.has_badge(303)),
"text": text,
"text_censored": censor_slurs_profanities(text, 'chat', True),
"text_html": text_html,
"text_html_censored": censor_slurs_profanities(text_html, 'chat'),
"created_utc": int(time.time()),
}
emit('speak', data)
return ''
execute_blackjack(v, None, text, "chat")
execute_under_siege(v, None, text, "chat")
quotes = data['quotes']
@ -195,7 +177,10 @@ def speak(data, v):
"created_utc": chat_message.created_utc,
}
emit('speak', data, room=request.referrer)
if v.shadowbanned:
emit('speak', data)
else:
emit('speak', data, room=request.referrer)
typing[request.referrer] = []

View File

@ -72,7 +72,7 @@ def chat(v, chat_id):
if v.admin_level < PERMS['VIEW_CHATS'] and not membership:
abort(403, "You're not a member of this chat!")
displayed_messages = reversed(g.db.query(ChatMessage).options(joinedload(ChatMessage.quoted_message)).filter_by(chat_id=chat.id).order_by(ChatMessage.id.desc()).limit(250).all())
displayed_messages = reversed(g.db.query(ChatMessage).join(ChatMessage.user).filter(or_(User.id == v.id, User.shadowbanned == None)).options(joinedload(ChatMessage.quoted_message)).filter(ChatMessage.chat_id == chat.id).order_by(ChatMessage.id.desc()).limit(250).all())
displayed_messages = {m.id: m for m in displayed_messages}
if chat.id == 1: