Commit Graph

20224 Commits

Author SHA1 Message Date
Umair Khan
de5f43ea47 result.json: Upgrade test_bots. 2017-08-17 09:03:35 -07:00
Umair Khan
1c09f95e0e result.json: Upgrade test_auth_backends. 2017-08-17 09:03:35 -07:00
Umair Khan
6d4ba50ceb result.json: Upgrade test_views. 2017-08-17 09:03:35 -07:00
Umair Khan
abed403a81 result.json: Upgrade test_classes. 2017-08-17 09:03:35 -07:00
Umair Khan
cec45b0ae5 tools: Add inline string replacer for files. 2017-08-17 09:03:35 -07:00
Steve Howell
770ec92891 hotkeys: Fix "n" key to work inside a muted stream.
Normally the "n" key skips over muted streams, but if we
are currently narrowed inside a muted stream, it will now
go to the next topics within that stream.

For me the use case was that I have a stream I check up on
about once a day, and "n" would be super useful for me to
clear out unread counts while still skimming some content,
and without having to temporarily unmute the stream.
2017-08-17 09:01:49 -07:00
Tim Abbott
f8b1916781 stream_sidebar_row: Rename data-name to data-stream-name.
This is for greater consistency with the rest of the codebase.
2017-08-16 18:03:44 -07:00
Tim Abbott
9271346753 stream_sidebar_row: Remove duplicate data-name attribute. 2017-08-16 18:03:44 -07:00
Tim Abbott
5e968ce30d stream_list: Use data-topic-name for topic names.
The name data-name was ambigious.
2017-08-16 18:03:44 -07:00
Tim Abbott
d9dcdbbbe9 stream_popover: Use data-stream-id when building topic popovers. 2017-08-16 18:03:29 -07:00
Tim Abbott
dbae28683c stream_popover: Use data-stream-id when building popover. 2017-08-16 18:03:29 -07:00
Tim Abbott
c6d7cfb60b stream_popover: Fetch the current stream by data-stream-id. 2017-08-16 18:03:29 -07:00
Tim Abbott
7d9303cfe8 topic_list: Stop accessing legacy data-stream name field.
We should be using data-stream-id everywhere.
2017-08-16 18:03:28 -07:00
Tim Abbott
88e3ba9576 stream_list: Fix enter key to use data-stream-id. 2017-08-16 18:02:57 -07:00
Tim Abbott
047237e45b stream_list: Remove a reference to data-name in sidebar. 2017-08-16 18:02:56 -07:00
Tim Abbott
4acd7595cd stream_sidebar: Clean up use of ambiguously named data-id.
We prefer to specify the type of data objects wherever possible.
2017-08-16 18:02:29 -07:00
Tim Abbott
78d9fcd23a streams: Remove a reference to data-stream-name. 2017-08-16 18:02:29 -07:00
Greg Price
1dc26ba250 Bump psycopg2 dependency to 2.7.3 to get a bugfix.
This should fix #6153.
2017-08-16 17:58:13 -07:00
Greg Price
b8dcac1b42 run-mypy: Stop running mypy --py2.
Also unconditionally use the `mypy` from our virtualenv --
that's how we ensure we use a common version across different
Zulip developers and in CI.

And as a side effect of cutting some Python 2 vs. Python 3 logic,
fix a bug where `--all` was having no effect.
2017-08-16 17:54:43 -07:00
Greg Price
6346861ccd py3: Cut out the build-release-tarball --py3 flag.
This is now redundant, as we've applied this transformation to the
source tree itself.
2017-08-16 17:54:43 -07:00
Greg Price
78b41f375d py3: Revise and update shebang discussion in docs/shell-tips.
This keeps the examples in line with our actual codebase.

Also while I'm here revise it to explain the actual motivation for our
use of `env`, and to correct some subtle details -- it's actually the
kernel that interprets the shebang (as visible in e.g. a `strace` log),
not the shell, and when the program is executed as `./my_program.py`
the exact name including `./` is passed to the interpreter.
2017-08-16 17:54:43 -07:00
Greg Price
33430f83eb py3: Rely on the shebang to invoke provision too.
We had been forcing provision to Python 3 in dev.  Now that everything
is Python 3 and the `tools/lib/provision.py` shebang reflects that, we
can just invoke the script directly like everything else.
2017-08-16 17:54:43 -07:00
Greg Price
a099e698e2 py3: Switch almost all shebang lines to use python3.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Greg Price
b7ec1b55dd py3: Cut Python 2 codepaths from provision. 2017-08-16 17:54:43 -07:00
Greg Price
d968179e54 py3: Stop running on Python 2 in Travis.
This clears the way to dropping logic in lots of places
for supporting Python 2.
2017-08-16 17:54:43 -07:00
Greg Price
aa0ecd79d6 zephyr: Fix bogus uses of force_bytes that break on Python 3.
An expression like `force_bytes(chr(...))`, on Python 3 where the
`force_bytes` finds itself with something to do because `chr` returns
a text string, gives the UTF-8 encoding of the given value as a
Unicode codepoint.

Here, we don't want that -- rather we want the given value as a
single byte.  We can do that with `struct.pack`.

This fixes an issue where the "Link with Webathena" flow was producing
invalid credential caches when run on Python 3, breaking the Zephyr
mirror for any user who went through it anew.
2017-08-16 17:23:57 -07:00
Tim Abbott
30181dcc08 node: Fix node test for user_events. 2017-08-16 16:46:41 -07:00
Tim Abbott
7cfb4e195f do_deactivate_user: Add acting user to RealmAuditLog. 2017-08-16 16:23:41 -07:00
Tim Abbott
98aae162dc do_change_full_name: Include original name in RealmAuditLog. 2017-08-16 16:23:41 -07:00
Tim Abbott
4b72b461e5 user_events: Fix buggy-looking logging code.
The previous logging exception looked like it sorta left off.
2017-08-16 16:23:41 -07:00
Aditya Bansal
7beeef9782 emoji_picker: Export emoji_collection and complete_emoji_catalog. 2017-08-16 19:18:26 -04:00
Aditya Bansal
406806b7df emoji_picker: Start using current emoji categories for rendering. 2017-08-16 19:18:26 -04:00
Aditya Bansal
245d571ae9 emoji.js: Refactor to make better use of initialize(). 2017-08-16 19:18:26 -04:00
Aditya Bansal
505262ca0b emoji_picker.js: Export initialize function. 2017-08-16 19:18:26 -04:00
Aditya Bansal
85fe355ba7 emoji_picker: Move click handler out from global scope.
In this commit we are moving the .emoji-popover-emoji.reaction
click handler to register_click_handlers() so as to have parity
with rest of the code design.
2017-08-16 19:18:26 -04:00
Tim Abbott
3a2a396303 zephyr: Fix tracebacks opening user info popovers. 2017-08-16 16:07:27 -07:00
Steve Howell
29c05c82f0 Fix A/D hotkeys for cycling through stream narrows.
We now use similar code for A/D hotkeys as we do for the "n"
key.

The old code was using jQuery operations that got tripped up
by our splitters between active and inactive streams.

Fixes #4569
2017-08-16 15:45:47 -07:00
Steve Howell
b4590e1303 Add topic_generator.reverse_wrap_exclude().
This allows us to traverse a list backwards, cycling to the
bottom as needed.

This code is going to be used for the "A" key that cycles
upward in the stream sidebar.  It's probably overkill for
that use case, but it does give us O(1) behavior and avoids
the pitfall of accidentally mutating a list when reversing it.
2017-08-16 15:45:47 -07:00
Tim Abbott
4ce079b689 docs: Clean up release notes for the Zulip 1.7 release.
Now that we have the expensive migrations running automatically early
in the process, we can drop them to more of a footnote.
2017-08-16 13:28:05 -07:00
Tim Abbott
d43f5ceeec database: Add database index for wildcard mentions. 2017-08-16 13:28:04 -07:00
Tim Abbott
dac7cfa026 emoji picker: Fix exceptions with regex characters in emoji filter.
Previously, the Zulip webapp would throw an exception if you used a
character like "+" in your search query, since we were using regular
expressions, when really we should have been just searching for
characters.
2017-08-16 13:06:05 -07:00
Tim Abbott
8bb812c8a9 database: Add database index for alert words. 2017-08-16 12:39:01 -07:00
Steve Howell
aedd433f7b Call create_large_migrations as part of upgrade.
We now call the create_large_migrations management command as part of
upgrade-zulip-stage-2 if needed, so that we can create large indexes
while the app is still up.
2017-08-16 12:39:00 -07:00
Steve Howell
3a825ef22c Add create_large_indexes management command.
This management command creates the same indexes as migrations
82, 83, and 95, which are all indexes on the huge UserMessage
table. (*)

This command quickly no-ops with clear messaging when the
indexes already exist, so it's idempotent in that regard. (If
somebody somehow creates an index by the same name incorrectly,
they can always drop it in dbshell and re-run this command.)

If any of the migrations have not been run, which we detect simply
by the existence of the indexes, then we create them using a
`CREATE INDEX CONCURRENTLY` command.  This functionality in
postgres allows you to create indexes against large tables
without disrupting queries against those tables.  The tradeoff
here is that creating indexes concurrently takes significantly
longer than doing them non-concurrently.

Since most tables are small, we typically just use regular
Django migrations and run them during a brief interval while
the app is down.

For indexes on big tables, we will want to run this command
as part of the upgrade process, and we will want to run
it while the app is still up, otherwise it's pointless.

All the code in create_indexes() is literally copy/pasted
from the relevant migrations, and that scheme should work
going forward.  (It uses a different implementation of
create_index_if_not_exist than the migrations use, but the
code is identical lexically in the function.)

If we ever do major restructuring of our large tables, such
as UserMessage, and we end up droppping some of these indexes,
then we will need to make this command migrations-aware.  For
now it's safe to assume that indexes are generally additive in
nature, and the sooner we create them during the upgrade process,
the better.

(*) UserMessage is huge for large installations, of course.
2017-08-16 12:38:51 -07:00
Tim Abbott
5061223dd3 streams: Send stream creation events to new zephyr mirror subscribers.
This fixes a frequent JS exception that we would get when subscribing
to a new stream in the Zephyr realms.
2017-08-16 12:09:15 -07:00
Tim Abbott
fa4968da92 actions: Extract send_stream_creation_event. 2017-08-16 12:03:44 -07:00
Tim Abbott
7a5c6628a6 server_events: Fix formatting of server_events exception. 2017-08-16 11:59:49 -07:00
Tim Abbott
debfe708d0 test-all: Fix buggy PYTHONWARNINGS invocation.
Shell only sets variables if they're the first thing on a line.
2017-08-16 11:56:24 -07:00
Steve Howell
47bcedbc1b Fix server searches for is:mentioned and is:alerted.
Before this change, server searches for both
`is:mentioned` and `is:alerted` would return all messages
where the user is specifically mentioned (but not
at-all mentions).

Now we follow the JS semantics:

    is:mentioned -- all mentions, including wildcards
    is:alerted  -- has an alert word

Here is one relevant JS snippet:

        } else if (operand === 'mentioned') {
            return message.mentioned;
        } else if (operand === 'alerted') {
            return message.alerted;

And here you see that `mentioned` is OR'ed over both mention flags:

    message.mentioned = convert_flag('mentioned') || convert_flag('wildcard_mentioned');

The `alerted` flag on the JS side is a simple mapping:

    message.alerted = convert_flag('has_alert_word');

Fixes #5020
2017-08-16 11:29:12 -07:00
Tim Abbott
7d49ce13b1 bugdown: Fix mypy error with empty return. 2017-08-16 11:29:12 -07:00