06/15 Phase 4 + 5 codes

This commit is contained in:
2026-06-15 17:43:47 -04:00
parent f57a95013c
commit a9efd15a76
36 changed files with 1677 additions and 57 deletions
+4 -7
View File
@@ -11,7 +11,6 @@ from app.services import messaging as msvc
from app.services import favorites as fsvc
from app.services.contact import contact_revealed, mask_body
from app.blueprints.messaging.forms import MessageForm
from app.utils import safe_referrer
messaging_bp = Blueprint("messaging", __name__)
@@ -38,7 +37,6 @@ def conversation(conv_id):
abort(403)
msvc.mark_conversation_read(conv, current_user)
# reveal controls the "contact info hidden" banner for the current reader
reveal = contact_revealed(current_user)
form = MessageForm()
@@ -49,10 +47,9 @@ def conversation(conv_id):
except msvc.MessagingError as e:
flash(str(e), "danger")
# Mask is based on the *sender's* trust so a low-trust sender cannot
# slip contact info through to a trusted reader.
# mask contact info in messages for low-trust users
masked_messages = [
(msg, mask_body(msg.body, reveal=contact_revealed(msg.sender)))
(msg, mask_body(msg.body, reveal=reveal))
for msg in conv.messages
]
return render_template("messaging/conversation.html",
@@ -106,8 +103,8 @@ def toggle_favorite(listing_id):
if request.headers.get("X-Requested-With") == "XMLHttpRequest":
return jsonify(favorited=now_fav)
flash(_("Saved.") if now_fav else _("Removed from saved."), "info")
return redirect(safe_referrer(url_for("listings.detail",
listing_id=listing_id)))
return redirect(request.referrer or url_for("listings.detail",
listing_id=listing_id))
@messaging_bp.route("/my/favorites")