Commit Graph

15593 Commits

Author SHA1 Message Date
Tim Abbott 515340ed00 Add message edit history backend with tests.
Based on work by Kartik Maji in #1204.

This has a few significant changes from the original version:
* We correctly handle filling in data for topic edits
* Has a complete test suite verifying correctness of the logic
* Currently, it doesn't include a special "start" entry

Things we may want to further change include:
* Adding a special "start" entry.
* Reversing the order of the history data returned for clarity.
2017-02-19 16:13:35 -08:00
Tim Abbott 498f6782a2 EditMessageEdit: Add complete test of edit history. 2017-02-19 16:13:35 -08:00
Tim Abbott 976868cf01 message_edit: Store which user edited a given message.
This is important for, in the future, being able to display who edited
the topic of a message if that wasn't the person who originally sent
the message.
2017-02-19 16:13:04 -08:00
Tim Abbott f1d82af191 Include prev_rendered_content_version in edit events. 2017-02-19 15:23:08 -08:00
Tim Abbott 78b2eaefc9 timerender: Add get_full_time function.
We'll need to do some iteration, but something like this will be
useful for message edit history.
2017-02-19 15:18:22 -08:00
Tim Abbott 6ad883fb61 docs: Update queuing documentation for new templates. 2017-02-19 13:12:34 -08:00
Tim Abbott 34046c1f55 check-rabbitmq-consumers: Add missing embed_links consumer. 2017-02-19 13:12:00 -08:00
Tim Abbott 213af24e47 check-rabbitmq-consumers: Reformat worker_queues list. 2017-02-19 13:12:00 -08:00
Tim Abbott 64898dd0d1 run-dev-queue-processors: Remove dead code. 2017-02-19 13:11:19 -08:00
Feorlen 87429e1ff9 Fix typo in webhook "Create documentation" section. 2017-02-19 10:02:33 -08:00
Tim Abbott e29663a2b3 compose: Fix behavior hitting enter with the preview area open.
The new behavior is:
(1) If enter-sends is enabled, just send the messsage.
(2) If enter-sends is not enabled, return focus to the compose area.

Based on great work by khantaalaman in #3673.

Fixes #3489.
2017-02-18 23:31:54 -08:00
Tim Abbott 08a7e0db44 render_messages: Fix buggy handling of edit history. 2017-02-18 22:33:26 -08:00
Tim Abbott 0383ff1dfd lint: Fix homeassistant PEP8 violations. 2017-02-18 21:51:14 -08:00
ausDensk 14024963f2 Add a simple Home Assistant integration for Zulip. 2017-02-18 21:18:10 -08:00
Feorlen 0578ad1563 Add an Advanced topics section.
Add a new section after the Hello World walkthrough for additional detail that
doesn't directly apply to this example. Included are discussions on creating
negative tests and handling custom query parameters.

Remaining integration of the material originally for #3478
2017-02-18 21:03:28 -08:00
Feorlen a97e0f6730 Add detail to the existing Hello World webhook example.
Fill in additonal detail following the existing document structure.
Includes authentication, custom streams, negative tests, and types
of test data and fixtures. Also fix typos and reformat to match the
new integration doc style.

Partial integration of the material originally for #3478
2017-02-18 21:03:28 -08:00
Cynthia Lin 5090de41f2 user docs: Add responsive design. 2017-02-18 20:54:56 -08:00
Tim Abbott 9ac66b0121 test-backend: Update blacklist of covered files based on CI.
After accidentally merging ecadb33fbc
before I go CI input, I discovered that coverage in my development
environment differs from that in CI :(.
2017-02-18 18:52:59 -08:00
Tim Abbott 32bfebeb7a mypy: Fix inconsistencies in use of *args/**kwargs. 2017-02-18 18:39:44 -08:00
Tim Abbott 473c0ee1fe mypy: Remove now-unused type: ignores. 2017-02-18 17:01:01 -08:00
Tim Abbott ecadb33fbc test-backend: Add 100% test coverage assertions.
This adds an assertion, when `test-backend` is run with `--coverage`,
that we have 100% test coverage on a list of files that we expect to.
There's a whitelist/blacklist, managed in tools/test-backend.

Fixes #3363.
2017-02-18 16:34:40 -08:00
Tim Abbott 1abfdc340a lint-all: Soften check for % comprehensions. 2017-02-18 16:29:47 -08:00
Tim Abbott b63a8a7880 integrations: Fix mypy error. 2017-02-18 15:29:43 -08:00
Tim Abbott b30fb37037 Fix URL routing for users with email addresses starting with "me".
Our URL routing previously attempting to segment the /users/ endpoint
namespace into /me (affecting yourself) or /username@domain (affecting
other users) by regular expressions incorrectly, specifically in the
case of email addresses starting with `me`.  This prevented various
admin actions like removing a user as an organization administrator.
2017-02-18 15:26:04 -08:00
Rishi Gupta e83d69def8 docs: Copyedit docs/chat-zulip-org.html.
Removed the blurb on "#design" since it appears twice.
2017-02-18 15:03:57 -08:00
Tim Abbott bbecd41376 help: Fix link to index page being present on index page.
Fixes #3613.
2017-02-18 14:59:43 -08:00
Tim Abbott 6ba1cd797b Fix regression in whitespace stripping at the start of messages.
This fixes a regression in 4060a97656,
which incorrectly stripped whitespace at the start of messages as
well.

Fixes #3719.
2017-02-18 14:47:28 -08:00
Cynthia Lin d75a1b0bfc user docs: Add user guide for *Add an emoji reaction to a message*.
Fixes #3616.
2017-02-18 14:13:57 -08:00
Cynthia Lin 6890f80383 user docs: Fix minor errors in *Star a message*. 2017-02-18 09:21:35 -08:00
Cynthia Lin 3647a6414a user docs: Add"emoji reaction" to Zulip glossary. 2017-02-18 09:21:35 -08:00
Tim Abbott 3ccbc7c114 run-dev: Use a different path for casper test PID file.
This fixes an issue where running the casper tests while a development
server was running would effectively corrupt the PID file.
2017-02-17 16:31:28 -08:00
Steve Howell b9ec2545bb Simplify and speed up stream deactivation.
This is a fairly risky, invasive change that speeds up
stream deactivation by no longer sending subscription/remove
events for individual subscribers to all of the clients who
care about a stream.  Instead, we let the client handle the
stream deactivation on a coarser level.

The back end changes here are pretty straightforward.

On the front end we handle stream deactivations by removing the
stream (as needed) from the streams sidebar and/or the stream
settings page.  We also remove the stream from the internal data
structures.

There may be some edge cases where live updates don't handle
everything, such as if you are about to compose a message to a
stream that has been deactivated.  These should be rare, as admins
generally deactivate streams that have been dormant, and they
should be recoverable either by getting proper error handling when
you try to send to the stream or via reload.
2017-02-17 15:53:22 -08:00
Steve Howell 465a765cb0 Add stream_data.delete_sub().
(There was a method with the same name before, but it wasn't
being used.  The new version will accept stream_id instead
of name, and we will use it as part of deactivating streams.)
2017-02-17 15:49:43 -08:00
Steve Howell 1722f1e6c4 Extract stream_list.remove_sidebar_row(). 2017-02-17 15:49:43 -08:00
Steve Howell b215a23456 bug fix: Fix stream deactivation being super slow.
This fix prevents stream deactivation from being basically
un-usable for medium to large sites.  Instead of calling
bulk_remove_subscriptions one at a time for every individual
member of the realm, we call it once for all the users that
care about the stream.  This change makes a huge difference, but
the feature is still a bit clunky, and we should only temporarily
revert to this fix if future, more-invasive fixes have flaws.

Fixes #3631.
2017-02-17 15:48:10 -08:00
Tim Abbott c61d0a78f4 home: Remove unused get_client import. 2017-02-17 15:35:38 -08:00
Tim Abbott 7a5065da62 views: Stop hardcoding the 'website' client for the / endpoint.
We were apparently incorrectly harcdoding the client for the main
logged-in site loading to website, rather than using the existing
logic that could sort out the desktop apps.
2017-02-17 15:20:42 -08:00
Tim Abbott 8487a24a6c socket: Hardcode website message sender for fake messages. 2017-02-17 15:20:32 -08:00
Tim Abbott f105e8270d compose: Fix hardcoding of 'website' client.
We already do detection of the client on the backend based on
User-Agent and the fact that it's a JSON view, which is pretty safe.
This fixes an issue where the server was not treating the Electron app
as its own client.
2017-02-17 15:20:32 -08:00
Tim Abbott 9072d3c350 socket: Transmit HTTP_USER_AGENT for websockets sending.
This significantly simplify the logic for our logging process, making
it the case that websockets message sending requests always are logged
as having the exact same client as a normal AJAX request from that
server.
2017-02-17 15:19:21 -08:00
Tim Abbott c9126e772e decorator: Don't block ZulipElectron name in json views.
This fixes the logging of the ZulipElectron client in server logs.
Message sending is still logged as "website"; that will be fixed soon.
2017-02-17 15:19:10 -08:00
Tim Abbott 2dc553df0a settings: Fix logging settings for Casper tests.
Previously the casper server.log files basically only had tracebacks;
this should help a lot with debuggability of Casper issues.
2017-02-17 15:18:45 -08:00
Tim Abbott 5c911c44d6 MessageSenderWorker: Reformat environment setup. 2017-02-17 15:00:57 -08:00
Umair Khan a9bc625dda testing: Serialize test_upload.
This commit makes test_upload tests compatible with parallel model.
2017-02-17 12:40:39 -08:00
Umair Khan b7d22e3308 testing: Isolate test_patch_bot_avatar.
This commit changes test_patch_bot_avatar to upload avatars to a
different directory so that there is no race condition when tests are
run in parallel mode.
2017-02-17 12:18:43 -08:00
Umair Khan 555d5b4dc6 database: Use new name of PostGresql backend. 2017-02-17 12:18:43 -08:00
Brock Whittaker 7f5703a21f Prevent HTML from being pasted into the stream name/description box.
This prevents users from either dragging formatted markup into content
editable boxes or pasting it in. This uses the “input” event rather
than “paste” because “paste” does not have the end result of the
contents whereas “input” does.

This is not a security vulnerability as it may seem. Processing on the
backend sanitizes input if it contains HTML.
2017-02-17 12:01:24 -08:00
Harshit Bansal 3498c01e1b admin: Make restricted to domains checkbox readonly incase of no domains.
If there are no domains then there is no meaning of setting restricted to
domains checkbox and hence it should be disabled.

Fixes: #3436.
2017-02-17 11:55:15 -08:00
Harshit Bansal 21dccaedd1 test_events.py: Add a test for the `do_change_realm_alias()` function. 2017-02-17 11:55:15 -08:00
Harshit Bansal fec145fc0c zerver/models.py: Add comments in 'get_realm_by_email_domain()` function.
Add necessary comments explaining our query sequence.
2017-02-17 11:55:15 -08:00