Commit Graph

8279 Commits

Author SHA1 Message Date
Jeff Arnold c0a8fc459a Make c/C compose to a new destination instead of being identical to r/R
R means "I want to send a PM, you can guess the destination"
r means "I want send a stream message, you can guess the destination"
C means "I want to send a PM and specify the destination"
c means "I want to send a stream message and specify the destination"

(imported from commit 755c92aed79ab79089b2e35d2c100582f012736a)
2013-11-27 10:35:37 -05:00
Allen Rabinovich ca4e6a0ff8 Updates to stream list
(imported from commit 426a8035e9661598f9bbfa6ae83883ca3ac6106e)
2013-11-13 14:59:07 -08:00
Steve Howell 7bde1f7716 Add activity.short_huddle_name().
(imported from commit e3f0389298631fd06169dbc9559691470ac19d00)
2013-11-07 16:54:13 -05:00
Steve Howell 9adcba1e6d Add activity.huddle_fraction_present().
Add a method that lets us know what percentage of a huddle is
present.  (We can use this later to set the opacity of huddles
in the UI.)

(imported from commit 8a2383951807d7bfbf9d730a8980d977cf23b379)
2013-11-07 16:54:13 -05:00
Kevin Mehall d93c7545f6 Revert rendering window changes related to summarization
This reverts commit c10d9c1a0d23891acce88bf8d79866c08cb75681.
This reverts commit 9259a246946cd968a8725c38ff5ef2d4b4793717.

(imported from commit 50e9e0136c2487cc63d75ae2b78df0c70a1b0be1)
2013-11-07 11:04:27 -05:00
Steve Howell 4fb4e04501 Add activity.full_huddle_name().
(imported from commit 304e47ac88d7497fcde49f448912a2e063dd0bd1)
2013-11-05 15:34:29 -05:00
Steve Howell e628efff6c Fix people_dict in activity.js tests.
The simulated people_dict in the activity.js test was not
matching the production code, and going forward, we'll want to
share the people_dict setup for all of our tests.

(imported from commit fc21a02216b9422130b9fe9c11bcf80590612844)
2013-11-05 15:34:28 -05:00
Steve Howell 6d511486cb Add activity.process_loaded_messages() and get_huddles().
Activity.js now has the capability to track huddles that
come through in loaded messages and return them in reverse
chronological order by their most recent message.  Right
now this only connected to a unit test, not any production
code.

(imported from commit 59957086fa2e454e5711472df091f178217aed2b)
2013-11-05 15:34:28 -05:00
Jessica McKellar 8684c98eef tests: add basic navigation Casper tests.
(imported from commit 66ebb76123213167e551fb0d776a824e218a9032)
2013-10-31 17:34:34 -04:00
Tim Abbott 901a5c342c Use os.path directly rather than sometimes importing it separately.
(imported from commit 48486c4ea64d02a15faeebb0f490d31e9b113d62)
2013-10-28 15:44:13 -04:00
Steve Howell 9979d884e5 Remove 06-unread.js.
This test has been broken for a couple months, and nobody has taken
ownership of fixing it.  It's always slow, sometimes it fails
randomly, sometimes it fails for things that aren't really problems,
and it's generally been way more trouble than it's worth.

(imported from commit 8080e81b226a372e763a2558f4e5668c3a4d087c)
2013-10-25 11:27:25 -04:00
Zev Benjamin a04ac35012 casper: Marginally improve page loaded detection
We really should be setting a variable in Javascript to indicate that
we've finished loading, but this hasn't bitten us yet.

(imported from commit ee1f7c76d9f3c482561cc5c44b81537c7e9636be)
2013-10-22 18:45:11 -04:00
Kevin Mehall bd58861b09 Ignore summarized messages when calculating rendering windows.
Summary blocks can contain hundreds of messages. When the rendering window
code didn't take this into account, it would lead to all kinds of
unpleasant behavior when you scroll.

Trac #1888

Unfortunately, this replaces a subtraction with a function that iterates
through all the messages.

(imported from commit 9259a246946cd968a8725c38ff5ef2d4b4793717)
2013-10-21 11:48:57 -04:00
Steve Howell b7eba8fe5c Test unread.update_unread_subjects() more thoroughly.
(imported from commit 5f1bbdbc6822615d487404930f5e50c970536761)
2013-10-15 14:57:38 -04:00
Steve Howell 7076258b15 Get stream_data.js to 100% branch coverage
(imported from commit fa1fa18271ba280d819bcec8cdea6337230f1953)
2013-10-15 14:57:38 -04:00
Leo Franchi 6e188fb067 Tweak alert_word matches and add some more tests
(imported from commit 63dc4064c15d5d33a7ec0c992b183bf323dd4ee8)
2013-10-10 10:58:21 -04:00
Leo Franchi 51e0bea608 Autocomplete emails in sender: completion
(imported from commit 44dc337842d46349b103cf9631faa7d439be682c)
2013-10-07 14:55:58 -04:00
Leo Franchi 0d6ad56c29 Decode operand in filter.js in operator-aware way
When decoding an operand, a + can be converted to a space
only if the operand is not an email address.

(imported from commit 08fc36a579bbe6409137c60c0fa9579fe3ab2c43)
2013-10-02 12:11:15 -04:00
Steve Howell 8f1498c766 [important] Fix stacktrace in unread.js.
There is a scenario where we call process_read_message()
for a message that we haven't recorded as unread before.
I'm not sure how it happens, but I put back code to
guard against crashing.  The regression happened in
5752458c821.

(imported from commit 5ce15d2e236b738b445ed88f1733aa0612be0ff3)
2013-09-29 22:42:33 -04:00
Steve Howell 2a4cd3c69a Exclude muted topics from stream/home unread counts.
Update get_counts() so that it ignores counts for muted topics
when calculating stream/home unread counts.

(imported from commit 9b4e4da4346c225c535e97d709d3dee032603cc5)
2013-09-28 14:53:11 -04:00
Steve Howell c7b7f8d79a Inlined unread_hashkey() function.
The indirection was more confusing than helpful, especially
since the function had side effects, despite its getter-like
name.

(imported from commit 85d9cf642b4177f62488136f0e0f7f6c9304942e)
2013-09-28 14:53:11 -04:00
Leo Franchi d9dba41767 Add some tests for composebox_typeahead.compose_content_begins_typeahead
(imported from commit 01e71ebe87da6e866817dc56555a7e6ee61cb003)
2013-09-27 13:52:13 -04:00
Steve Howell 49a55ca6fa Call blueslip.warn from stream_data.js functions.
It used to be calling blueslip.warning(), i.e. the wrong name,
and would crash.

(imported from commit ddc953488cdb22dd37ddf674dddf1e05f34eaec9)
2013-09-24 16:19:53 -04:00
Steve Howell 660475bd0c Hide muted messages.
Instead of collapsing muted messages, just hide them altogether
in view where it makes sense to hide them.

(imported from commit 1c2c987ff302ceb135a025753cf421b4de1aea71)
2013-09-23 10:53:06 -04:00
Steve Howell 022ef6e9b9 Add narrow.muting_enabled()
(imported from commit 8972d1e3ca347397664094a7f150ec86fd2f8f8e)
2013-09-23 10:53:06 -04:00
Steve Howell e79e74ade4 Add narrowed_to_topic() helper function.
(imported from commit 9190caa9b183893fb7ae883686b9bdbd661d5895)
2013-09-19 15:41:00 -04:00
Steve Howell a4e2ed9fd2 Add test_narrowed() to narrow.js unit tests.
(imported from commit 060032ac00d0c28a9625e2885ee3156bc94ff130)
2013-09-19 15:40:59 -04:00
Steve Howell 51b8caf442 Add set_filter() to narrow unit tests.
(imported from commit 60734fa1a9d0d28e8c0277a41cc69186bc2b6c0e)
2013-09-19 15:40:59 -04:00
Steve Howell c6a9297f1a Add blueslip warnings to stream_data functions.
Warn inside these functions when you get data on streams that you
are not subscribed to:

  add_subscriber
  remove_subscriber
  user_is_subscribed

The back end should be smart enough not to spam us with subscriber
info that we don't care about.

(imported from commit b27644be2abc37c11ddff884ef392ea208bd1bd3)
2013-09-19 08:52:54 -04:00
Steve Howell e1b881629c Use fold_case:true for subscribers Dict
(imported from commit 8acc794cb5369baadef512a9fcdb3537231dd604)
2013-09-17 10:32:13 -04:00
Steve Howell 4b90f1685d Add stream_data.set_subscribers() method.
This allows us to encapsulate our use of Dict for the internal
data structure.

(imported from commit e8acc50b4c17d339015cb9db9939b9452a62cc8b)
2013-09-17 10:32:11 -04:00
Steve Howell e83c026a27 Set focus-related flags correctly after a server reload
(imported from commit 408469c0da0cfa5513e6838329816cd88665981f)
2013-09-16 12:29:34 -04:00
Steve Howell 5eaeddea12 Get stream_data.js back to 100% coverage
(imported from commit 5b82a10d50b6599c0c42604fe86275b21f9a6396)
2013-09-12 17:23:52 -04:00
Steve Howell 0165dc54ad Create blueslip error for undefined keys in Dict.
We create a blueslip error for undefined keys in Dict.  This led
to a straightforward change in the unit tests for Dict.  For the
unread test, to avoid the blueslip error, we had to be more specific
in setting up a user in one place, but this reduced our coverage,
leading to another small test being added.

(imported from commit 33e14795500d9283de2a7c03c4c58aec11cea4b8)
2013-09-11 18:07:37 -04:00
Steve Howell 9eefc8ae62 Test fold_case option of Dict
(imported from commit 630643767a21818c1ef4adb557c794e560783c3e)
2013-09-11 18:07:37 -04:00
Steve Howell e9adaaa0c0 Avoid Dict crashes for undefined keys when fold_case is true.
The exceptions were cryptic before, and they were inconsistent with
the fold_case: false behavior.

(imported from commit a40704d1a22bcdc60d91be832ee3c81eb416c6dd)
2013-09-11 18:07:37 -04:00
Steve Howell a8ebd80c89 Test that vanilla Dict handles undefined keys
(imported from commit 09846eafa55f2321ca10db950ad3785ce78ae2c6)
2013-09-11 18:07:37 -04:00
Steve Howell c6131b630b Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
2013-09-11 16:47:36 -04:00
Steve Howell f616148181 Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
2013-09-11 16:47:36 -04:00
Steve Howell 0641e693fa Add muting.set_muted_topics
(imported from commit c84cd085e513d57e3913543d40cd8fd6b5d45b67)
2013-09-11 16:47:36 -04:00
Steve Howell 04c6a8198a Add muting.get_muted_topics
(imported from commit 5edb1d36ae66dfc42cf534edc452959df8306661)
2013-09-11 16:47:36 -04:00
Steve Howell 8626276dc3 Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
2013-09-11 16:47:35 -04:00
Kevin Mehall 7fea9e0755 Fix race condition in 06-unread
There was nothing to ensure that the changes resulting from scrolling
happened before the unread counts were checked. We already had a long
wait there; might as well do those checks after it to ensure that the
DOM is updated.

(imported from commit 0d4014ae6a74dd684521fecabefc4bf79015f842)
2013-09-10 18:06:57 -04:00
Kevin Mehall 5991b0003f Fix 06-unread PM count selector for changes in 2b82fbb
(imported from commit 0d8e52f17fb06092efff7cdf4fc4b01ab4901e2f)
2013-09-10 18:06:57 -04:00
Leo Franchi a1d7e6336c Add stub for .on() in activity test
(imported from commit 82727e18739cb8bed7b2c64f8013e7f0fe386b94)
2013-09-10 13:25:59 -04:00
Steve Howell 5bcc403ea4 Add filter tests for is:alerted predicate
(imported from commit 077fdab5437f498f015da7ed81a77036c9ff6361)
2013-09-10 13:13:18 -04:00
Scott Feeney 17cad06a2d Add Dict.from_array()
(imported from commit 0650edb2217afa2c37be1bbc4f9e2ac40f4c0e2c)
2013-09-06 23:13:47 -04:00
Leo Franchi 663fd4653f Feature-flag alert words to staging + reddit
(imported from commit 1fe9c596b26ce6676514719e4ed2e185108685cb)
2013-09-05 10:21:39 -04:00
Leo Franchi 41b286232d Allow filtering to alerted messages with is:alerted
(imported from commit 99834f1ee1b9b2e0f5c7427afa1494bf404e3626)
2013-09-05 10:18:41 -04:00
Leo Franchi 897dd87b94 Add a span around alert words to mark them visually
(imported from commit 9b8fbbd957086f1eeaa3409e5830aa6d7974fbe8)
2013-09-05 10:18:40 -04:00
Steve Howell 1e88bb914e Add test_private_suggestions() to search_suggestion.js
(imported from commit db89f8574a4f7e169e66ebaff3a9c2cd49a4b0dc)
2013-08-28 17:41:17 -04:00
Steve Howell 8363b7c59a Add test_subset_suggestions() to search_suggestion.js
(imported from commit db9173ffa92ca225baf24a1103807034e4f31a7f)
2013-08-28 17:41:16 -04:00
Steve Howell 857680102f Remove enforce_arity checks from Dict
(imported from commit 8fdb6d8807e5c16349c7fcf71f25ce73348a5fe1)
2013-08-28 12:29:11 -04:00
Jessica McKellar b27f27f932 node tests: add some asserts for stream_data.delete_sub.
(imported from commit 3428f32206105b240e230e1050e7c16cd9c3729c)
2013-08-28 10:24:52 -04:00
Steve Howell 667372068c Add idempotency test coverage for muting.js
(imported from commit 50496866fa11df433150ff28f0f1e58e9e8b33bc)
2013-08-27 15:40:54 -04:00
Allen Rabinovich 2bb6f45af2 Add a data-name attribute to stream elements in the stream list and modify the test accordingly
(imported from commit 24791703015a47ae89fdf628d6511736b9d0f026)
2013-08-27 09:44:57 -07:00
Steve Howell a2bf6c3dd7 Test stream_data.in_home_view()
(imported from commit 29f1a187000e1818797c1a4781afaabca0ed29de)
2013-08-26 13:59:33 -04:00
Steve Howell b486f06e71 Test stream_data.get_invite_only for unknown stream
(imported from commit fb4e51b44b8c20844a7575af1a471a626273ae39)
2013-08-26 13:59:33 -04:00
Steve Howell 5e2de02dfc Test stream_data.get_color() for unknown stream
(imported from commit 7507e43de3f261a19d210c58863d1e614567f4bc)
2013-08-26 13:59:32 -04:00
Steve Howell ca5cf073f4 Add test_get_and_set() to stream_data tests
(imported from commit 007486f08879ea8b98524a91ef3fc02565cc4d86)
2013-08-26 13:59:32 -04:00
Steve Howell 96a2f0d907 Test TypeError exception in Dict.from
(imported from commit 088bf04ecf10338e2d1cff1b86d5beb263ee19dc)
2013-08-26 11:21:30 -04:00
Steve Howell 5dda9a5816 Test is_subscribed=false path of unread.get_counts
(imported from commit 7fb6531fb6d2d475bf43de6267fd018cc7347d7a)
2013-08-26 11:21:30 -04:00
Steve Howell 1821005dfe Restore subject counts for Uppercase streams
(imported from commit ef0e78d39c56da67544441a73ea257f215fefd94)
2013-08-26 11:21:29 -04:00
Steve Howell ffa9cfd492 Test that unread.process_loaded_messages ignores read messages.
(imported from commit 262f20933551e786022de564f46c75f901d8123f)
2013-08-26 11:21:29 -04:00
Steve Howell 582eef8305 Add test_message_unread()
(imported from commit 7f26cafb90757a9c490a148b6dd7b4f4f0fb5f95)
2013-08-26 11:21:29 -04:00
Steve Howell 06065d50bf Add dict.num_items()
(imported from commit 209a01b61d18d4b65b54e473cf727065aada68e8)
2013-08-26 11:21:29 -04:00
Steve Howell 63fa194139 Turn off the "muted" topic special case
(imported from commit ea34ea060eb29864c4816d0f14ee106dcb10be9d)
2013-08-23 18:33:48 -04:00
Steve Howell 4a7bab9a6f Allow collapsing of recipient sections.
This is experimental, for staging only.  There might be a better
way to model this than dueling force_expand/force_collapse flags,
but it works for now.  The code in collapse_recipient_group()
could also be DRYed up relative to expand_summary_row().

(imported from commit 107151d1ecd640970fb7700d41278a003bd1abaa)
2013-08-23 15:57:31 -04:00
Steve Howell b3ebb13469 Remove some ".d" suffixes in predicate tests.
I was saying bar.d in places where I wasn't really specifically
testing the .d feature, and it was distracting and just an
unintentional consequence of copy/paste.

(imported from commit 7b137b28cb33c72b83f02fe1d2961c5c6accc263)
2013-08-23 14:10:03 -04:00
Steve Howell 439e984f3d Break up Filter predicate tests
(imported from commit 780559045d6ea84612617db9249d7f191dbd86d9)
2013-08-23 13:56:28 -04:00
Steve Howell 3239efd864 Simplify MIT regex code and harden tests
(imported from commit 96c988fb8c90d04dd4bcd7d2bbc04f1b1c8d8cb7)
2013-08-23 13:32:10 -04:00
Steve Howell df812b40f9 Have test excercise Filter.predicate caching code.
(imported from commit 504abea7c1ef3a9cdb58b5bbcf2d751c5d98b1ea)
2013-08-23 13:32:10 -04:00
Steve Howell f8c3b70ced Clarify Filter tests dealing with bogus operators
(imported from commit db8327eb6df70bc8ffee7fb8166bc6491bd2fe70)
2013-08-23 13:32:09 -04:00
Steve Howell ec5bfa2a10 Test Filter.public_operators()
(imported from commit 47e08ffb3eb7f91b95b84b91a249bcf99157998e)
2013-08-23 12:56:09 -04:00
Steve Howell c205b8b29f Test Filter.predicate better.
(imported from commit d32a1e0d7a638bc5bd010b902475a27527e699ba)
2013-08-23 12:56:08 -04:00
Steve Howell 795248a1d0 Mute any topic named "muted" on zulip.com.
This change will allow us to test the muting feature on
staging.  Any topic named "muted" will automatically be
muted.  You can also mute any other topic on the console:

    muting.mute_topic('devel', 'ios');
    current_msg_list.rerender();

More UI around this experiment will be coming soon, as well
as support for muting entire streams.

The muting module keeps track of which topics are muted, but a
user can expand muted messages, and once that happens, the
messages are marked with the "force_expand" flag that gets
persisted to the back end.

Muted messages are rendered in similar fashion to the summarized
rows, and as part of unifying some of that code, we have
made it so that expanding a summarized section doesn't remove
individual flags related to summaries; instead, the messages
get the force_expand flag set.

(imported from commit acee4190e63813d46850415c41ff8ebfae4a6953)
2013-08-23 12:10:27 -04:00
Steve Howell dca1ffdf96 [bugfix] Restore toString() call in Filter.unparse().
I regressed this recently, thinking that all our operators are
strings, but I forgot about the "near:" operator used in the
"Narrow messages around this time" feature.  The user facing
symptom was that the search bar showed up empty instead
of saying near:50, which might actually be the better
behavior, but it certainly was not intentional. :)

(imported from commit fcb93cecbe9a052bb9bc1af7fcac5aecaba5aafb)
2013-08-22 14:55:43 -04:00
Steve Howell c4d598b36e Move parse/unparse from narrow to Filter.
I'm trying to move well-isolated methods out of narrow.js, so that
narrow.js is more strongly focused on UI/ajax interactions and
big, heavy lifting stuff.  The logical home for parse/unparse
seemed to be Filter, and they brought along two private methods
with them.  The big code moves involved trivial follow ups
like s/exports/Filter/.

(imported from commit ace0fe5aa1c7abce0334d079ba9eb8d9a57bd10f)
2013-08-22 14:53:00 -04:00
Scott Feeney f0e9786c08 Test user-sidebar unread counts & fix broken tests
This is hard to break up into separate commits; sorry about that.

Before this commit we had 3 tests:

1. Claims to check that an unread count was 3, but actually doesn't.
2. Checks that scrolling down causes the left-sidebar stream unread
   count to decrease.
3. Claims to check that unread counts are correct, but actually doesn't.

From talking to Leo, it seems that he originally tried to actually do
what tests 1 and 3 claim to do, but found it too fragile to check an
exact unread count because of font sizes, layout, etc.

We now have 4 tests. For each of the stream sidebar and user sidebar, we
test that:

1. Scrolling down causes the unread count to decrease
2. Logging out and back in again leaves the unread count unchanged

I've removed the two bogus tests and some other code that didn't seem to
serve a purpose.

(imported from commit 9f8e4b521e2765099510426d0b7e2960885e6f19)
2013-08-22 14:46:13 -04:00
Scott Feeney d4661b22c8 Remove deprecated parameter in Casper unread test
You used to have to call casper.test.done(N) where N was the number of
tests run. This is no longer required and is deprecated in CasperJS 1.1.

(imported from commit 0de9ecb1930cbce416fa02c24a882e926cdc8e87)
2013-08-22 14:46:13 -04:00
Scott Feeney f41f042127 Remove an outdated comment in CasperJS unread test
The test now works standalone, contrary to what the comment said.

(imported from commit 1280923dd522518689624628df5f3063fbdc1a1d)
2013-08-22 14:46:13 -04:00
Steve Howell 58c141ad79 Avoid side effects in ui.set_presence_list().
Have ui.set_presence_list() only touch the presence list.

Before this change, it was calling update_unread_counts(), which
has a bunch of side effects unrelated to the presence list.

(imported from commit 690f754d78874a03fa36f8ff8765d5a63e431d28)
2013-08-22 14:46:13 -04:00
Steve Howell 7b9d9bcdae Avoid monkeypatching in search_suggestion tests.
(imported from commit 5b36a8e7effce9f174c4f7aa0447b7c570db1ffc)
2013-08-21 18:18:58 -04:00
Steve Howell 3e259e028b Avoid monkeypatching stream_data object.
(imported from commit 4755cf44736190b566645a83a7fc576d3c8451cb)
2013-08-21 18:18:58 -04:00
Steve Howell 0202ca0261 Run unit tests in deterministic order.
(imported from commit 74e1690e3bd401730313e66611423dcdf4709f81)
2013-08-21 18:18:58 -04:00
Steve Howell d21cbac611 Clean up globals after each unit test.
The functions add_dependencies() and set_global() are convenience
methods that allow you to modify the global namespace while
the current file is running but then have it be cleaned up
by index.js when you're done.

(imported from commit f75b8a10c19f773a8d2d3a8fa4bc39b1679566fe)
2013-08-21 18:18:58 -04:00
Zev Benjamin 3f95e54dc1 dict: Add setdefault method
This is like Python's dict.setdefault.  I don't love the name, but
the consistency is nice.

We have lots of places where we do things like:

    if (! dict.has('foo')) {
      dict.set('foo', []);
    }

    var arr = dict.get('foo');
    arr.push(3);

We can now write:

    var arr = dict.setdefault('foo', []);
    arr.push(3);

(imported from commit b8933809c69ba47ec346ed51d53966793403e56c)
2013-08-21 14:11:39 -04:00
Zev Benjamin 62aec87962 dict: Make set() return the value passed
We were accidentally leaking our internal representation.

(imported from commit 08ddc42583fb13a2ad51eea7ed1b30bf5ccb4645)
2013-08-21 14:11:39 -04:00
Zev Benjamin 59041d993b dict: Move Dict.from(otherdict) functionality into clone method
(imported from commit 6a3981a726922d7acf55b49ea2d477271da430d3)
2013-08-20 15:37:08 -04:00
Zev Benjamin 2c775d0894 Make recent_subjects case-insensitive
(imported from commit 36c423f506c1e8dc0536c80a4a085b689623191a)
2013-08-20 15:37:08 -04:00
Zev Benjamin 3a70c4e928 dict: Make copying Dict constructor a class constructor method
(imported from commit 7bd5f6029c1290036a47688cf2b80f9317fe9c13)
2013-08-20 15:35:53 -04:00
Steve Howell edda967100 Leave casing alone in search suggestions.
The function narrow.unparse() is used in a bunch of places in
the search suggestion code, and now it no longer lower cases
operands.  This change contributes to fixing trac #1659.

(imported from commit 6b44b8a818482b5c8b4f9a45bc7d3a9d21e04eba)
2013-08-20 14:27:44 -04:00
Steve Howell 890a4f0ac0 Remove unused var in search_suggestion.js test
(imported from commit 2298d4c8642ac031cd98729c23eed79e2b994876)
2013-08-20 14:27:43 -04:00
Steve Howell 0a22094e24 Change operator canonicalizations.
Streams are converted to their "official" names now.
Topics are not canonicalized at all.
All other operands continue to be lowercased.

Since we don't lowercase stream/topic at the parsing stage,
we have to modify the predicate function to do the lowercasing
of stream/topic to enable case-insensitive comparisons.  This
is slightly more expensive.  The server-side predicate
functions are already case-insensitive.

(imported from commit 286f118c6c3ff9d23b37c7f958cab4c0eacd5feb)
2013-08-20 14:27:43 -04:00
Steve Howell 767a8ae400 Add test_predicates() to filter.js tests
(imported from commit 551f396b4458ac529858f91f693b424bc7d06b8c)
2013-08-20 14:27:43 -04:00
Steve Howell 33c70f0f69 Extract Filter.canonicalize_tuple().
(imported from commit 96b8dc8c27c07d6d13f1e02c88a164abcab5a5c2)
2013-08-20 14:27:43 -04:00
Steve Howell d5f997eb58 Use the correct stream name in compose defaults.
If we have a stream named "Denmark" and we're narrowed to it,
then use "Denmark" as the default stream name in the compose box
even if the narrow operators are lowercase.

(imported from commit e9f06b7307c73231aa887dc95849e0307984e6f0)
2013-08-20 14:27:42 -04:00
Steve Howell 18857f6601 Added stream_data.get_name().
This function returns the stream's actual name, if we can get it;
otherwise, it's the identity function.

(imported from commit 7a981adba9632d6c6eba54cb6514a9226d1e83e8)
2013-08-20 14:27:42 -04:00
Steve Howell eccd7e90ab Add unit tests for stream_data.js.
(imported from commit 9a91aea1db3afc7936b1dbaeb4c014a3df6cd633)
2013-08-20 14:27:42 -04:00
Steve Howell 579f53845e Have search_suggestion clean up after itself
(imported from commit def5797f02868ecdb7dc3ffcc25caf1e532e2764)
2013-08-20 14:27:42 -04:00
Steve Howell 3d20f6478c Add unit test for narrow.set_compose_defaults().
(imported from commit 819b326bb10b4126438c9336d41e4aadce94d381)
2013-08-20 14:27:42 -04:00
Steve Howell f593c551da Add tests for Filter canonicalizations
(imported from commit def24dda1f178b658f6e49f3d2c67db779059c89)
2013-08-20 14:27:42 -04:00
Steve Howell 2491a80aa6 Fixed comment in in index.js
(imported from commit d28abf87d80f53038f1273529fcfe758fe7db2af)
2013-08-20 14:27:41 -04:00
Kevin Mehall d29484daa7 Casper tests for message editing
(imported from commit 4a62267241099432b40ef2cd592e0d5c20384f75)
2013-08-20 14:07:49 -04:00
Scott Feeney 69efe2a695 Add a Node.js-based test runner
There are no functional changes; you can still use the shell script
tools/test-js-with-node. It just delegates now to the new index.js to
iterate through all the other .js files in the test directory and run
them. This sets the stage for Istanbul to correctly compute test
coverage.

(imported from commit 6f521c78b7a314d010fa113f9c2c971ab999b637)
2013-08-20 10:46:22 -04:00
Steve Howell 53f62bd71c Created MessageListView class.
(The code for MessageListView  was extracted from message_list.js.)

(imported from commit 60c0bac4c734d3850f8b8c047a978c292b19cc13)
2013-08-19 12:17:56 -04:00
Steve Howell 29c012dc74 Create stream_data.js module.
This pulls a lot of data-centric functions out of subs.js.

(imported from commit 0deed7d4bf5697e893af9bc9d888c2d5da8d9fa2)
2013-08-19 12:17:55 -04:00
Steve Howell a4af6c7062 Add unit tests for composebox_typeahead.add_topic().
This tests topics_seen_for() as well.

(imported from commit a748134af8068d9e4ae223fb7ecbbbc6c170137e)
2013-08-16 17:59:40 -04:00
Steve Howell 3e1cdaaded Add MessageList.nth_most_recent_id().
(imported from commit 69a424d4990402b9e77fbfa57fa573a002cf04ce)
2013-08-15 08:20:29 -04:00
Steve Howell 947ca3a0e0 Add Dict.each().
Dict.each() allows to iterate through values and keys of a Dict.
The callback function is passed value as the first parameter to
be similar to _.each()'s calling sequence.

(imported from commit e745e8b5d2f167b8b8acf7542b767494e354b037)
2013-08-14 14:24:38 -04:00
Steve Howell 878ee2b3fd Move Filter class to filter.js from narrow.js.
1) The class Filter now lives in its own module.
2) The function canonicalized_operators() is now a class method on Filter.
3) The function message_in_home moved to filter.js and became private.
4) Various calling code had to change, of course.
5) Splitting out Filter helped simplify a few tests.

(imported from commit e41d792b46d3d6a30d3bd03db0419f129d0a2a7b)
2013-08-12 13:58:32 -04:00
Zev Benjamin ec9322fc87 Use Dict everywhere we have keys based on potentially dangerous, user-supplied data
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.

(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
2013-08-09 17:35:14 -04:00
Zev Benjamin 0cfc8fae9f Add basic Javascript Dict implementation
(imported from commit 9f2fb089eb6e269549de26b37bd588355757d22c)
2013-08-09 17:20:14 -04:00
Zev Benjamin e0eddabeb1 Add util.enforce_arity
util.enforce_arity takes a function and returns a new version which
throws an error if an incorrect number of arguments (as determined by
the function prototype) are passed.

(imported from commit 20e69a6dc7b6f8455726ab4fae8d5b7b04dc4103)
2013-08-09 17:12:23 -04:00
Steve Howell 6790ed79cc Add a unit test for activity.js.
This includes slightly invasive, but harmless, changes to
the production code.

(imported from commit ff40af504de2360ada866508da262e0d2e9f7ad9)
2013-08-09 13:11:59 -04:00
Steve Howell db33028b98 Added tools/test-js-with-casper symlink.
The test-all script now calls the symlink, and the run script
has been cleaned up to be symlink friendly.

(imported from commit 8abb5c1e5744416e94ff843e50c53e0d0f7e1316)
2013-08-09 13:04:52 -04:00
Steve Howell cf1d94edef Add a test for stream_color.js (pick_color).
(imported from commit a49f96a4a7b61ef51c057e8a3f11c116d77ebb49)
2013-08-09 12:29:02 -04:00
Steve Howell cef72fd8b8 Add tests for the Filter class.
(imported from commit ef0917bd7911c5cc6f6d20d356c156d483ba723f)
2013-08-09 12:04:43 -04:00
Steve Howell cc73619a9d Add unit tests to narrow.js.
This includes slightly invasive, but harmless, changes to
production code.

(imported from commit 847557c11088b75c836cc399d0af75353a8faa3a)
2013-08-09 11:59:32 -04:00
Steve Howell 50b28dec49 Add node-based unit tests for util.js.
(imported from commit df666a5b96d378787e911c2cd6e509b7d42e1cb4)
2013-08-08 17:25:24 -04:00
Steve Howell 0b4c37ef8d Autocomplete names w/spaces in search.
See trac #1356.

(imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
2013-08-08 12:54:20 -04:00
Kevin Mehall 0b9497305f Add defensive checks against undefined messages to _is_summarized_message.
Should fix the issue with empty realms.

(imported from commit afca70ebf3b7b74ae0d0c269c72b4f8d54fc254b)
2013-08-08 12:47:23 -04:00
Tim Abbott 9181c7c75b Move generate-fixtures to tools/.
(imported from commit 3d452b17e315ba9adf91e33408a7711d16b069a2)
2013-08-08 10:22:32 -04:00
Tim Abbott 7b9305b06f Rename Django project to zproject.
This includes a hack to preserve humbug/backends.py as a symlink, so
that we don't need to regenerate all our old sessions.

(imported from commit b7918988b31c71ec01bbdc270db7017d4069221d)
2013-08-07 11:04:03 -04:00
Tim Abbott 41433e552f Remove old sqlite path zephyrdb from .gitignore files.
(imported from commit 1d9c9849de46854ace1caa4c32d5fe4c86d2ff5c)
2013-08-07 10:00:08 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Steve Howell 57f518c9c2 Add node JS unit tests for MessageList.
(imported from commit 486a343add91fd5037431504e1ce4a750bfa9fbf)
2013-08-07 09:25:13 -04:00
Steve Howell 3aa5930191 Streamline search suggestions when query has trailing space.
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.

Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.

(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
2013-08-06 14:04:29 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00