Commit Graph

940 Commits

Author SHA1 Message Date
Cory Lynch d32e89aae4 jQuery: Remove broken use of "removeAttr".
This function no longer sets properties to false, so the supported
way of doing this is to instead use prop(foo, false). Some tests
had to be fixed to accommodate this.
2017-07-24 10:54:47 -07:00
Cory Lynch 02c6672499 drafts: Fix casper timing bug in jQuery 3. 2017-07-24 10:54:47 -07:00
Harshit Bansal c1dc48f41b emoji: Merge the two semantically same tips on the `Custom emoji` page.
In case the user was not allowed to upload an emoji, we were displaying
two different but sematically same tips. This commit merges them and
also updates `update_custom_emoji_ui()` function in settings_emoji.js
to live update tooltip.
2017-07-21 13:29:27 -07:00
Cynthia Lin 4a545728a5 node tests: Add tests covering new subsetting functionality. 2017-07-21 12:13:43 -07:00
Steve Howell 0e25055c1d Add explicit message field for locally_echoed.
We now set locally_echoed to true for messages that are
locally echoed, and we change some of our code to look
for this flag.
2017-07-21 11:38:25 -07:00
Steve Howell 7134bbfbe3 message edit: Prevent editing any failed messages.
Our logic for editing failed messages is broken in various ways,
so we are removing the codepath for editing for now.  We will
try to restore these features as part of #5841.
2017-07-21 11:38:25 -07:00
Steve Howell bd59b91faa reactions: Simplify markup related to message ids.
Because of local echo, message ids can change in message rows.
Having reactions use markup to indicate their message id just
creates more moving parts, since we would need to handle
message_id_changed events.

Now our handlers just call row.get_message_id() as needed.
2017-07-21 11:38:25 -07:00
Steve Howell c256b1663e local echo: Extract message_store.reify_message_id().
We no longer do the message_store piece of reifying ids
via a trigger.  We now make an explicit call to an
ordinary function.

This has several benefits:
    - no more initialize() function
    - no more scary comments about garbage collection
    - the function has a real name now
    - the function is less indented
    - we can easily see when the message_store step happens
    - simpler node tests
    - simpler tracebacks (no jQuery cruft)
2017-07-21 11:38:25 -07:00
Joshua Pan 09043c25ca markdown.js: Move markdown.js test to bugdown-data.json. 2017-07-18 12:56:47 -07:00
Joshua Pan 5e5ca48063 markdown.js: Fix inconsistent #**stream** on new line.
This commit removes all code related to headers because
(1) we don't need the code and (2) it splits #**stream**
as a paragraph, which we don't want. This commit also
fixes the inconsistency when #**stream** is on a new line.

Fixes #4678.
2017-07-18 11:07:25 -07:00
Pweaver (Paul Weaver) d3ffc81726 Enable Hot Module Replacement in webpack.
This allow the webbpack dev server to properly reload JavaScript modules
while running in dev without restarting the server. We need to connect
to webpack-dev-server directly because SockJS doesn't support more than
one connection on the same host/port.
2017-07-18 11:02:05 -07:00
Steve Howell 1ed35be88c stream_list: Use more direct code in build_stream_list.
We eliminate `.get(0)` calls in buld_stream_list.

The easy case is that we stop building jQuery objects
for the splitters only to pull out the DOM immediately.

The more subtle case is that we also don't do `.get(0)` calls
to get DOM out of our individual list items.  By passing
in full jQuery objects to `append()`, we should prevent ourself
from orphaning the old objects, which may in the future have
things like tooltip logic attached to them.
2017-07-18 09:58:16 -07:00
Joshua Pan ec669a0c45 markdown.js: Fix inconsistent user mention on new line.
The user mention regex was checking for multiple lines,
so it broke when the user mention was on a new line.
This changes the regex AND adds a couple tests to
test inline markdown regexes.
2017-07-18 00:07:49 -07:00
Brock Whittaker 0d3ea50379 settings: Change .btn => .button components.
This changes all of the old bootstrap .btn buttons in the settings UI
to the new .button classes that they should be.
2017-07-17 17:20:09 -07:00
Brock Whittaker e5e73f364b settings: Change [Change] button styles. 2017-07-17 16:18:46 -07:00
Brock Whittaker 330a3bd144 setttings: Indent display settings checkboxes and fix header styles.
Aside from the indentation of checkboxes, the headers are added and
changed to become more unified with other page styling.
2017-07-17 16:15:04 -07:00
Cory Lynch a607130cae search_suggestion: Add tests for query with spaces.
Specifically, this checks to make sure that if you
surround an operand with quotes, having spaces inside
is permitted. Also, an extra space after the operator is
also permitted.
2017-07-14 17:33:09 -07:00
Cory Lynch 8125857999 filter.js: Add test coverage for space after operator. 2017-07-14 17:33:09 -07:00
Cory Lynch 35eb878e31 filter.js: Add test coverage for quoted operands. 2017-07-14 17:33:09 -07:00
Cory Lynch 1dba70ca0d search_suggestion: Fix highlighting for multi-word streams.
I deleted a test case that involved a highlighted stream, but
the query was empty. This produces kind of a weird result with
typeahead_helper.highlight_with_escaping, but this function already
has coverage in node_tests/typeahead_helper.js, so the check here
was essentially redundant anyway. Specifically, the highlighter
wraps every character individually with <strong>, and looks really
messy in html.
2017-07-14 17:33:09 -07:00
Vaida Plankyte 28ea174ed9 backend: Implement high contrast mode display setting. 2017-07-14 14:53:24 -07:00
Steve Howell 475eb21a5e Revert commits related to client_message_id.
I pushed a bunch of commits that attempted to introduce
the concept of `client_message_id` into our server, as
part of cleaning up our codepaths related to messages you
sent (both for the locally echoed case and for the host
case).

When we deployed this, we had some strange failures involving
double-echoed messages and issues advancing the pointer that appeared
related to #5779.  We didn't get to the bottom of exactly why the PR
caused havoc, but I decided there was a cleaner approach, anyway.
2017-07-14 12:13:35 -07:00
Steve Howell bc67f6a8ca Add sent_messages.track_messages().
This change has us tracking messages as soon as we start
sending the message to the server.  The next step is to
reconfigure the timeouts a bit to deal with the server not
responding.
2017-07-13 23:42:27 -04:00
Steve Howell 9ee2be4a0d Use client_message_id as key for sent_messages lookups.
We now use a client-side message id to track the state of our
sent messages.  This sets up future commits to start tracking
state earlier in the message's life cycle.

It also avoids ugly reify logic where we capture an event to
update our data structure to key on the server's message id
instead of the local id.  That eliminates the node test as well.

Another node test gets deleted here, just because it's not
worth the trouble with upcoming refactorings.
2017-07-13 23:42:27 -04:00
Steve Howell 7e88fb25b3 Move sent_messages callbacks into transmit_message().
This mostly sets the stage for a subsequent commit to start
using client_message_id as the key into sent_messages.

It has the nice side effect of making it more explicit that
certain things should always happen when transmit_message()
succeeds.

This commit does regress our node test coverage a bit.
2017-07-13 23:42:27 -04:00
Steve Howell 68f8ba0449 Generate client_message_id() sequentially.
This commit starts to decouple client_message_id from local_id.

We don't really take advantage of the decoupling in this
commit--in fact, it's a bit of a pain at first.  But this should
be a fully working checkpoint commit.
2017-07-13 23:42:27 -04:00
Steve Howell 25b59d0044 Extract sent_messages.message_state class.
This class helps us encapsulate the state of a message, with all
the dates/flags that get sent as part of /json/report_send_time.
2017-07-13 23:42:27 -04:00
Steve Howell f6d670ae3d Extract sent_messages.js.
This is mostly straightforward moving of code out of compose.js.

The code that was moved currently supports sending time
reports for sent messages, but we intend to grow out the new
module to track more state about sent messages.

The following function names in this commit are new, but their
code was basically pulled over verbatim:

    process_success (was process_send_time)
    set_timer_for_restarting_event_loop
    clear
    initialize

All the code in the new module is covered by previous tests that
had been written for compose.js.  This commit only modifies
a few things to keep those tests.

The new module has 100% node coverage, so we updated `enforce_fully_covered`.
2017-07-13 23:42:27 -04:00
Steve Howell 8fbb55df85 Introduce client_message_id on the server.
We are deprecating local_id/local_message_id on the Python server.
Instead of the server knowing about the client's implementation of
local id, with the message id = 9999.01 scheme, we just send the
server an opaque id to send back to us.

This commit changes the name from local_id -> client_message_id,
but it doesn't change the actual values passed yet.

The goal for client_key in future commits will be to:
    * Have it for all messages, not just locally rendered messages
    * Not have it overlap with server-side message ids.

The history behind local_id having numbers like 9999.01 is that
they are actually interim message ids and the numerical value is
used for rendering the message list when we do client-side rendering.
2017-07-13 23:42:27 -04:00
Aditya Bansal 85289163a4 compose.js: Refactor to extract of a helper func in test_on_events. 2017-07-11 12:14:09 -04:00
Aditya Bansal 783f75ef10 compose.js: Add a setup statement in an on() test. 2017-07-11 12:14:09 -04:00
Tim Abbott 32af1ed7b4 casper: Fix nondeterministic failures in realm creation tests.
This was previously failing because we didn't wait for a particular
state after logging in, and the title changes at least once during the
process after the URL changes to the Zulip homepage.
2017-07-10 16:18:17 -07:00
Durga Akhil Mundroy 38b70f27d9 typeahead: Use recent_senders/pm_conversations to sort suggestions.
In typeahead_helper.js, added a compare function to first sort by
subscription, then by pm partners and lastly based on recency in the
current topic. Altered function sort_for_at_mention to take topic data
and sort using the above function. Also altered node tests for
typeahead_helper.js to test for the above added functionality.

Fixes: #4249
2017-07-09 10:51:19 -04:00
Aditya Bansal 2479e74867 compose.js: Add coverage for message_id_changed event on document. 2017-07-09 08:49:45 -04:00
Aditya Bansal 51257ee93d compose.js: Add coverage for uploadFinished() function. 2017-07-09 08:49:45 -04:00
Aditya Bansal 18d2be0d5c compose.js: Add coverage for uploadError() function. 2017-07-09 08:49:45 -04:00
Aditya Bansal 43aaab3adf compose.js: Add coverage to progressUpdated() function. 2017-07-09 08:49:45 -04:00
Aditya Bansal 1f6ad92121 compose.js: Add coverage for uploadStarted() function. 2017-07-09 08:49:45 -04:00
Aditya Bansal d9a0217cfe compose.js: Add coverage for undo_markdown_preview_clicked event. 2017-07-09 08:49:45 -04:00
Aditya Bansal f67c9ae9d7 compose.js: Add coverage for markdown_preview_compose_clicked event. 2017-07-09 08:49:45 -04:00
Aditya Bansal 0b363b427f compose.js: Add coverage for attach_files_compose_clicked event. 2017-07-09 08:49:45 -04:00
Aditya Bansal ed3ab27908 compose.js: Add coverage to compose_invite_close_clicked event. 2017-07-09 08:49:45 -04:00
Aditya Bansal f9cbd015cb compose.js: Add coverage for compose_invite_users_clicked event. 2017-07-09 08:49:45 -04:00
Steve Howell 359c9aaec8 zjquery: Remove jquery_array().
This commit simplifies how our zjquery objects are constructed.

We used to have a strange array proxy (my fault) that turns out
to be unnecessary.
2017-07-09 08:31:22 -04:00
Steve Howell 203a0bf119 minor: Set object length for stream_list test. 2017-07-09 08:31:22 -04:00
Steve Howell 1cf18cfbeb compose: Avoid render for duplicate mentions.
There is no reason to render the template for compose mention
warnings if the user is already in the widget.

This commit also restructures the unit test significantly to more
carefully exercise each case, particularly in regard to when
templates get rendered.
2017-07-09 08:30:46 -04:00
Aditya Bansal bea44fb28a compose.js: Add coverage to compose_all_everyone_confirm_clicked.
(Steve Howell also helped.)
2017-07-08 10:50:48 -04:00
Aditya Bansal 777581a1e4 compose.js: Add coverage for usermention_completed.zulip event. 2017-07-08 10:42:20 -04:00
Steve Howell 7376934a77 zjquery: Add $.create() method.
This commit add $.create(), which allows you to create a
jQuery object that just has a name to identify it, as opposed
to some selector or HTML fragment.  It's useful for things that
are really used as stubs.

This also fixes a bunch of the existing tests to use $.create().

Before this fix, you could actually just do $('some-stub'), but
now we enforce that the input to $() looks like a valid selector
or HTML fragment, and we make some exceptions for things like
window-stub and document-stub.
2017-07-08 10:32:32 -04:00
Steve Howell 90777fd1fa zjquery: Add parents() and set_parents_result(). 2017-07-08 08:49:09 -04:00