Eklavya Sharma
958335bdb3
Change all default values in models to unicode.
2016-07-11 21:30:32 -07:00
Tomasz Kolek
d7c7279523
Add is_status_message method to Message model.
2016-07-11 12:09:06 -07:00
Rishi Gupta
43c2f35776
Add realm setting to disable message editing.
...
This is controlled through the admin tab and a new field in the Realms
table. This mirrors the behavior of the old hardcoded setting
feature_flags.disable_message_editing. Partially resolves #903 .
2016-07-10 11:57:24 -07:00
Rishi Gupta
07e7230ae1
models.py: Add post_save to Message.
...
Flushes message from cache after a message.save(). Needed for tests
where we directly manipulate Message objects in the database.
2016-07-10 11:42:18 -07:00
Tim Abbott
1e2d38e790
Move stringify_message_dict into to_dict_uncached.
2016-07-08 17:58:56 -07:00
Umair Khan
035fceb814
Add dynamically loaded language dropdown.
2016-07-04 11:56:02 -07:00
Eklavya Sharma
6d8ba90db9
zerver/models.py: Modify imports for mypy in py3 mode.
...
Change 'from zerver.lib import bugdown' to
'import zerver.lib.bugdown as bugdown' to make zerver/models.py
pass mypy check in python 3 mode.
2016-07-02 10:38:48 -07:00
Kartik Maji
f8bb7503e6
Add ability to pin streams to top of the streams sidebar list.
...
Based on work by Lauren Long, with some tweaks by tabbott.
2016-06-30 22:26:09 -07:00
acrefoot
acd7ff7aff
Fix typo in Recipient comment.
2016-06-27 18:34:02 -07:00
Tim Abbott
b2a24e0306
Revert "Add authorization check before serving files."
...
This reverts commit e985b57259
.
This commit will break production when we next do a release, because
we haven't done a migration to create Attachment objects for
previously uploaded files.
2016-06-27 12:09:56 -07:00
rahuldeve
e985b57259
Add authorization check before serving files.
2016-06-27 11:24:35 -07:00
rahuldeve
8cecb37743
Modify Attachment model to track file access permissions.
2016-06-23 17:46:16 -07:00
Vishnu Ks
ad1c3894d9
Add interface for creating new realms.
...
This is controlled by settings.OPEN_REALM_CREATION; if that setting is
off, this feature doesn't do anything.
2016-06-17 16:15:28 -07:00
Eklavya Sharma
7ec9cb7e93
Annotate model fields: Attachment.
...
Also fix clashing annotations.
2016-06-13 20:01:03 +05:30
Eklavya Sharma
86978cb2a3
Annotate model fields: Stream.
2016-06-13 20:01:03 +05:30
Eklavya Sharma
1ec7e124c7
Annotate model fields: Message.
2016-06-13 20:01:02 +05:30
Eklavya Sharma
f27cff57c3
Annotate model fields: UserProfile.
2016-06-13 20:01:02 +05:30
Eklavya Sharma
9f39c9276f
Annotate model fields: DefaultStream, Referral, ScheduledJob.
2016-06-13 19:37:07 +05:30
Eklavya Sharma
4f890cca2a
Annotate model fields: UserActivity, UserActivityInterval, UserPresence.
2016-06-13 19:37:07 +05:30
Eklavya Sharma
7290f9cb83
Annotate model fields: Subscription and Huddle.
2016-06-13 19:37:07 +05:30
Eklavya Sharma
ddaaa98b25
Annotate model fields: UserMessage.
2016-06-13 19:30:58 +05:30
Eklavya Sharma
acd1767398
Annotate model fields: Recipient and Client.
2016-06-13 19:30:57 +05:30
Eklavya Sharma
c0004a5874
Annotate model fields: PushDeviceToken and MitUser.
2016-06-13 19:30:57 +05:30
Eklavya Sharma
04740fb620
Annotate model fields: PreregistrationUser.
2016-06-13 19:30:56 +05:30
Eklavya Sharma
d666e00833
Annotate model fields: RealmEmoji and RealmFilter.
2016-06-13 19:30:56 +05:30
Eklavya Sharma
6c7dd07ec2
Annotate model fields: Realm and RealmAlias.
2016-06-13 19:30:56 +05:30
Eklavya Sharma
c654c4032d
zerver/models.py: Annotate get_display_recipient.
...
get_display_recipient's annotation clashes with other wrong annotations.
Fix those wrong annotations.
Since get_display_recipient returns a Union, use isinstance checks and
casts to make mypy checks succeed.
2016-06-12 23:34:57 +05:30
Eklavya Sharma
ed61c4c581
Improve model string representation.
...
Define __str__, __repr__ and __unicode__ correctly on models.
This will help in python 3 compatibility.
2016-06-12 09:55:12 -07:00
Eklavya Sharma
17b9422546
zerver/models.py: Fix regex strings.
...
Some regex strings were not declared as raw, even though they used
a lot of backslashes.
2016-06-12 09:31:19 -07:00
Eklavya Sharma
81759d56be
zerver/models.py: Fix string annotations in UserPresence.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
e11bec28c2
zerver/models.py: Fix annotations (str -> text_type).
...
Change str to text_type where appropriate in annotations related to
Attachment, PreregistrationUser and Huddle.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
d76bea8f25
zerver/models.py: Identify functions returning QuerySets.
...
Identify functions which return QuerySets and give them a return type
`Sequence` with appropriate parameter. Typing them as QuerySet will
not be useful since generic stubs for QuerySets are not available and
not knowing the type of QuerySets is hardly useful for type checking.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
39060aa221
zerver/models.py: Fix annotations related to Message.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
2841aa642d
Fix annotations related to make_safe_digest and hashes.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
9020177418
zerver/models.py: Add annotations related to Stream and Client.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
10f2ec043d
Fix zerver.lib.utils.generate_random_token.
...
generate_random_token used to return a value of type six.binary_type
and its return type was annotated as `str`. This commit fixes that
by making it return a value of type `six.text_type` and updating
the annotation accordingly.
Also fix clashing annnotations.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
56d5785c2e
zerver/models.py: Change some constants to unicode literals.
...
Change choices of UserProfile.avatar_sources and UserProfile.tutorial_status
from str literals to unicode literals. This is done because these fields
are CharFields, which are of type `six.text_type`. So the set of values
which they can take should also be of the type `six.text_type`.
Also fix clashing annotations.
2016-06-12 09:30:53 -07:00
Eklavya Sharma
0cc7a6583c
zerver/models.py: Fix last_reminder_tzaware annotation.
...
Fix annotated return type of UserProfile.last_reminder_tzaware from
`str` to `Optional[datetime.datetime]`.
2016-06-12 09:30:33 -07:00
Eklavya Sharma
8acc51218e
Fix realm emoji and realm filter annotations.
...
Change `str` to `text_type` in annotations in zerver/models.py
related to realm emoji and realm filters.
Also fix clashing annotations in zerver/lib/bugdown/__init__.py.
2016-06-12 09:25:42 -07:00
Eklavya Sharma
e68d99eb2e
zerver/models.py: Make cache_keys text_type.
2016-06-12 09:25:32 -07:00
Tim Abbott
f44b227b85
Refactor getting cross-realm users into a function.
2016-06-11 11:22:22 -07:00
Eklavya Sharma
53084fe03c
Use text_type as type of cache keys and update users.
...
This changes the type annotations for the cache keys in Zulip to be
consistently text_type, and updates the annotations for values that
are used as cache keys across the codebase.
2016-06-11 09:10:34 -07:00
Eklavya Sharma
d3b80d94a2
Use appropriate string types and correctly encode/decode them.
2016-06-11 17:34:23 +05:30
Tomasz Kolek
999093b227
Add new is_incoming_webhook bot type.
...
This type of bot is only able to send messages via webhook endpoints.
2016-06-07 21:23:35 -07:00
Tim Abbott
9c5f15e89b
models: Fix use of non-lazy ugettext at import time.
...
Was introduced in 03debdf82f
.
2016-06-04 17:46:03 -07:00
Tim Abbott
6f69053911
Annotate most of the rest of bugdown.
2016-06-04 11:35:29 -07:00
Tim Abbott
ac3989c114
models: Add most missing type annotations.
2016-06-04 00:03:54 -07:00
Tim Abbott
03debdf82f
Fix malformed error message when creating invalid Realm Emoji.
...
Thanks to Greg McCoy for his help finding this bug.
2016-06-03 23:12:36 -07:00
Max
0f4673ae3b
Add type annotation to mention.py, redis_utils.py, timestamp.py, user_agent.py
...
Some functions in models.py had input typed as int when they needed to be typed as datetime.datetime
2016-06-03 19:00:16 -07:00
Max
1148f6ff8a
Rename timestamp kwarg in to_presence_dict to dt
...
It is not a timestamp, it is a datetime object. This is better ducktyping
2016-06-03 19:00:16 -07:00