Kevin Lin
b2c29274f3
presence: Allow bots to fetch realm presence data.
...
Before, presence information for an entire realm could only be queried via
the `POST /api/v1/users/me/presence` endpoint. However, this endpoint also
updates the presence information for the user making the request. Therefore,
bot users are not allowed to access this endpoint because they don't have
any presence data.
This commit adds a new endpoint `GET /api/v1/realm/presence` that just
returns the presence information for the realm of the caller.
Fixes #10651 .
2018-10-15 12:51:28 -07:00
Tim Abbott
07af59d4cc
tornado: Split get_events_backend into two functions.
...
The lower-layer function, now called get_events_backend, is intended
to be called by multiple code paths (including the upcoming
get_events_internal).
2018-07-30 12:28:31 -07:00
Tim Abbott
cedad52c59
presence: Extract and use get_active_user helper.
...
This adds a new reusable function for fetching just active users.
2018-05-20 19:07:29 -07:00
Tim Abbott
79e8bff8fa
views: Change use of typing.Text to str.
...
This is the first part of a general migration of our typing codebase
to use the simpler `str` for strings.
2018-04-23 18:51:23 -07:00
rht
1324d9f000
mypy: Use Python 3 type syntax in zerver/views.
2017-12-30 07:34:05 -05:00
Greg Price
68b0a419ec
decorator: Cut a bunch of dead imports of two view decorators.
...
Saw these when grepping for these two decorators; they're actually
more numerous than the surviving use sites are. Cut out the noise.
2017-11-04 19:27:00 -07:00
rht
45e8ce559d
zerver/views: Use python 3 syntax for typing.
2017-10-26 21:58:22 -07:00
rht
15ca13c8de
zerver/views: Remove absolute_import.
2017-09-27 10:00:39 -07:00
Tim Abbott
accc7406da
views/presence: Refactor get_user_profile_by_email -> get_user.
2017-05-22 16:43:08 -07:00
Aditya Bansal
db3c05002a
pep8: Add compliance with rule E261 to zerver/views/presence.py.
2017-05-18 03:00:32 +05:30
Rishi Gupta
e14c940ecc
decorator: Add human_users_only decorator.
...
Applies it to presence.update_active_status_backend as an example of usage.
2017-04-16 12:51:23 -07:00
Tim Abbott
9400689f86
presence: Remove use of timezone.now().
2017-04-16 12:32:57 -07:00
Rishi Gupta
b5482d51b1
presence.py: Change bot-related error messages to match each other.
2017-04-14 14:34:17 -07:00
Rishi Gupta
bbddbdeb25
presence.py: Enforce bots cannot use update_active_status_backend.
...
We need to keep the UserActivity table clean now that we're using it to
compute 15day actives in analytics.
2017-04-14 14:34:17 -07:00
Steve Howell
205f2c1562
Add ping_only flag for presence updates.
...
The web app doesn't need any presence data for its first ping to
the server, because it already has up-to-date presence info in
page_params. So now we can tell the server not to send us a big
payload that we were already ignoring.
2017-04-04 15:57:10 -07:00
K.Kanakhin
173f34b7aa
user-presence: Add offline status to aggregated info.
...
- Add `OFFLINE_THRESHOLD_SECS` settings parameter
to handle offline period.
- Set aggregated status to offline if user's status
haven't changed for `OFFLINE_THRESHOLD_SECS` period.
- Add test for offline aggregated status.
2017-03-07 20:09:53 -08:00
K.Kanakhin
2f251dedaf
user-presence: Add aggregated status to user presence info.
...
- Add aggregated status to user presence status dict.
- Add tests for aggregated presence status.
- Fix removing unused keys from status dict
with aggregated data for user.
Fixes #3692
2017-03-07 20:09:53 -08:00
Raghav Jajodia
a3a03bd6a5
mypy: Added Dict, List and Set imports.
...
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Tim Abbott
46226bad21
presence: Fix mypy errors in new feature.
2017-02-10 23:57:28 -08:00
Tim Abbott
71af0f7e2e
Add endpoint to fetch presence data for a single user.
...
This is an experimental API subject to its data format being changed.
Fixes #3638 .
2017-02-10 23:52:56 -08:00
Yago González
7fe090f902
translations: Improve some poorly-worded strings.
2017-01-28 18:04:17 -08:00
Rishi Gupta
9e6e1a1e69
Remove several instances of datetime.datetime.utcnow().
...
Change to the timezone-aware django.utils.timezone.now() where django is
available.
2016-11-07 20:13:53 -08:00
Steve Howell
edfa022bac
Remove json/get_active_statuses endpoint.
2016-09-27 14:33:56 -07:00
Steve Howell
2b4d59d6e8
Fix comment in update_active_status_backend().
2016-09-13 14:45:27 -07:00
Tim Abbott
375551aaa6
Clean up most hardcoding of mit.edu domain checks.
...
This moves all this code to be gated on a few virtual realm settings.
2016-07-26 20:30:12 -07:00
Tim Abbott
6dc5681171
views: Move presence views to presence.py.
2016-07-26 14:29:32 -07:00