Aman Agrawal
d9431a5e66
exceptions: Raise InvalidSubdomainError when realm is invalid.
...
When user requests for a realm that doesn't exists, we raise
a InvalidSubdomainError.
This reduces our effort at repeatedly ensuring realm is valid
in request in web-public queries.
2020-09-03 10:45:14 -07:00
Anders Kaseorg
a276eefcfe
python: Rewrite dict() as {}.
...
Suggested by the flake8-comprehensions plugin.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-02 11:15:41 -07:00
Aman Agrawal
9f9daeea5b
message_fetch: Allow access to web-public msgs for unauth users.
...
Via API, users can now access messages which are in web-public
streams without any authentication.
If the user is not authenticated, we assume it is a web-public
query and add `streams:web-public` narrow if not already present
to the narrow. web-public streams are also directly accessible.
Any malformed narrow which is not allowed in a web-public query
results in a 400 or 401. See test_message_fetch for the allowed
queries.
2020-08-12 16:39:02 -07:00
Tim Abbott
28b43b4edc
message_fetch: Refactor get_base_query_for_search.
2020-08-12 16:33:59 -07:00
Tim Abbott
221cd496c6
NarrowBuilder: self.user_profile.realm -> self.realm.
2020-08-12 16:33:59 -07:00
Tim Abbott
35bd14574d
message_fetch: Refactor public-streams query logic.
2020-08-12 16:33:59 -07:00
Tim Abbott
d2e191b94e
NarrowBuilder: Rename self.user_realm to self.realm.
...
The previous name will be very confusing in upcoming commits where the
UserProfile becomes Optional but Realm is not (E.g. for web-public
queries).
2020-08-12 16:33:59 -07:00
Aman Agrawal
94839c9492
NarrowBuilder: Directly use denormalized 'recipient_id' of streams.
...
'recipient_id' was is now directly accessible and we can now use
it instead of doing an extra query to Recipient model.
2020-08-11 11:22:22 -07:00
Anders Kaseorg
61d0417e75
python: Replace ujson with orjson.
...
Fixes #6507 .
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:55:12 -07:00
Anders Kaseorg
36bae2e86c
message_fetch: Use strings as dict keys.
...
JSON keys must be strings, and orjson enforces this.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-07 11:12:32 -07:00
Steve Howell
f960df04e8
narrows: Validate negated field.
2020-06-25 13:52:59 -07:00
Anders Kaseorg
07fa63e0c8
validator: Fix type errors hidden by bad Any use in set_type_structure.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 16:30:17 -07:00
Tim Abbott
866965f162
views: Rename messages.py to message_fetch.py.
...
This completes to effort to split zerver.views.messages into smaller
modules focused on the different core type of work.
2020-06-22 15:08:34 -07:00