"""Approval handling — maps Matrix reactions to pipeline approvals.""" import logging logger = logging.getLogger(__name__) # Reaction emoji to response mapping APPROVAL_REACTIONS = { "\U0001f44d": "approve", # thumbs up "\U0001f44e": "decline", # thumbs down "\u2705": "approve", # check mark "\u274c": "decline", # cross mark } def reaction_to_response(reaction_key: str) -> str | None: """Map a reaction emoji to an approval response.""" # Strip variation selectors (U+FE0E, U+FE0F) — Element often appends these cleaned = reaction_key.replace("\ufe0f", "").replace("\ufe0e", "") return APPROVAL_REACTIONS.get(cleaned) or APPROVAL_REACTIONS.get(reaction_key)