mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 03:54:52 -04:00
Use strings instead of opaque magic-number constants for presence states; rename AWAY to UNAVAILABLE
This commit is contained in:
parent
2a0f7541c7
commit
55944ccf72
7 changed files with 34 additions and 37 deletions
|
@ -27,7 +27,7 @@ from synapse.handlers.presence import PresenceHandler, UserPresenceCache
|
|||
|
||||
|
||||
OFFLINE = PresenceState.OFFLINE
|
||||
BUSY = PresenceState.BUSY
|
||||
UNAVAILABLE = PresenceState.UNAVAILABLE
|
||||
ONLINE = PresenceState.ONLINE
|
||||
|
||||
|
||||
|
@ -149,12 +149,12 @@ class PresenceStateTestCase(unittest.TestCase):
|
|||
|
||||
yield self.handler.set_state(
|
||||
target_user=self.u_apple, auth_user=self.u_apple,
|
||||
state={"state": BUSY, "status_msg": "Away"})
|
||||
state={"state": UNAVAILABLE, "status_msg": "Away"})
|
||||
|
||||
mocked_set.assert_called_with("apple",
|
||||
{"state": 1, "status_msg": "Away"})
|
||||
{"state": UNAVAILABLE, "status_msg": "Away"})
|
||||
self.mock_start.assert_called_with(self.u_apple,
|
||||
state={"state": 1, "status_msg": "Away"})
|
||||
state={"state": UNAVAILABLE, "status_msg": "Away"})
|
||||
|
||||
yield self.handler.set_state(
|
||||
target_user=self.u_apple, auth_user=self.u_apple,
|
||||
|
@ -555,7 +555,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
content={
|
||||
"push": [
|
||||
{"user_id": "@apple:test",
|
||||
"state": 2},
|
||||
"state": "online"},
|
||||
],
|
||||
}),
|
||||
call(
|
||||
|
@ -564,7 +564,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
content={
|
||||
"push": [
|
||||
{"user_id": "@apple:test",
|
||||
"state": 2},
|
||||
"state": "online"},
|
||||
],
|
||||
})
|
||||
], any_order=True)
|
||||
|
@ -582,7 +582,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
"remote", "m.presence", {
|
||||
"push": [
|
||||
{"user_id": "@potato:remote",
|
||||
"state": 2},
|
||||
"state": "online"},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
@ -646,7 +646,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
content={
|
||||
"push": [
|
||||
{"user_id": "@apple:test",
|
||||
"state": 2},
|
||||
"state": "online"},
|
||||
],
|
||||
}),
|
||||
call(
|
||||
|
@ -655,7 +655,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
content={
|
||||
"push": [
|
||||
{"user_id": "@banana:test",
|
||||
"state": 0},
|
||||
"state": "offline"},
|
||||
],
|
||||
}),
|
||||
], any_order=True)
|
||||
|
@ -666,7 +666,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
|
||||
self.handler._user_cachemap[self.u_clementine] = UserPresenceCache()
|
||||
self.handler._user_cachemap[self.u_clementine].update(
|
||||
{"state": PresenceState.ONLINE}, self.u_clementine)
|
||||
{"state": ONLINE}, self.u_clementine)
|
||||
self.room_members.append(self.u_potato)
|
||||
|
||||
yield self.distributor.fire("user_joined_room", self.u_clementine,
|
||||
|
@ -680,7 +680,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||
content={
|
||||
"push": [
|
||||
{"user_id": "@clementine:test",
|
||||
"state": 2},
|
||||
"state": "online"},
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
@ -882,7 +882,7 @@ class PresencePollingTestCase(unittest.TestCase):
|
|||
content={
|
||||
"push": [
|
||||
{"user_id": "@banana:test",
|
||||
"state": 0,
|
||||
"state": "offline",
|
||||
"status_msg": None},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue