Skip to content
Snippets Groups Projects
Commit 114b929f authored by Erik Johnston's avatar Erik Johnston
Browse files

Check presence state is a valid one

parent ddca9c56
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,6 @@ class PresenceState(object):
OFFLINE = u"offline"
UNAVAILABLE = u"unavailable"
ONLINE = u"online"
FREE_FOR_CHAT = u"free_for_chat"
class JoinRules(object):
......
......@@ -606,6 +606,12 @@ class PresenceHandler(BaseHandler):
status_msg = state.get("status_msg", None)
presence = state["presence"]
valid_presence = (
PresenceState.ONLINE, PresenceState.UNAVAILABLE, PresenceState.OFFLINE
)
if presence not in valid_presence:
raise SynapseError(400, "Invalid presence state")
user_id = target_user.to_string()
prev_state = yield self.current_state_for_user(user_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment