Commit Graph

1608 Commits

Author SHA1 Message Date
Steve Howell 320425fde3 node tests: Add tests for message_list_data. 2018-05-05 06:31:51 -07:00
Steve Howell 264dcb6f40 refactor: Extract MessageListData class.
Most of this was straightforward.

Most functions that were grabbed verbatim and whole from
the original class still have one-line wrappers.

Many functions are just-the-data versions of functions that
remain in MessageList:  see add, append, prepend, remove as
examples.  In a typical pattern the MessageList code becomes
super simple:

    prepend: function MessageList_prepend(messages) {
        var viewable_messages = this.data.prepend(messages);
        this.view.prepend(viewable_messages);
    },

Two large functions had some minor surgery:

    triage_messages =
            top half of add_messages +
            API to pass three lists back

    change_message_id =
            original version +
            two simple callbacks to list

For the function update_muting_and_rerender(), we continue
to early-exit if this.muting_enabled is false, and we copied
that same defensive check to the new function
named update_items_for_muting(), even though it's technically
hidden from that codepath by the caller.
2018-05-05 06:31:51 -07:00
Rohitt Vashishtha 7fef91a405 zblueslip: Convert node_tests/settings_user_groups.js to zblueslip. 2018-05-03 16:27:05 -07:00
Rohitt Vashishtha 22ca18f59c zblueslip: Convert node_tests/pm_list.js to zblueslip. 2018-05-03 16:27:05 -07:00
Rohitt Vashishtha c5d9a052c0 zblueslip: Convert node_tests/people.js to zblueslip. 2018-05-03 16:27:05 -07:00
Rohitt Vashishtha 8219d2dcf4 zblueslip: Convert node_tests/messge_store.js to zblueslip. 2018-05-03 16:27:05 -07:00
Rohitt Vashishtha f51e151e62 zblueslip: Convert node_tests/markdown.js to zblueslip.
Also allows comparing in zblueslip using toString() for cases like
comparing an `Error('hello')` object and a `'hello'`.
2018-05-03 16:27:05 -07:00
Rohitt Vashishtha cba2c529f9 zblueslip: Convert node_tests/activity.js to zblueslip. 2018-05-03 16:27:05 -07:00
Steve Howell a68fa980d3 Add starred messages to our new API for unread ids.
Even though starred messages are never unread, it's useful
for us to have helper functions for them.

This change makes it so that clicking on "Starred Messages"
takes you to the last read message immediately, without a
server delay.
2018-05-03 14:36:34 -07:00
Steve Howell 3e19efca36 Change narrow.get_first_read_id -> get_first_read_info.
This function, which is only used in tests so far, needs
to return something more meaningful than undefined when
we don't find an id.
2018-05-03 12:44:30 -07:00
Steve Howell 4eb033964e Add fetch_status.has_found_newest(). 2018-05-03 12:44:30 -07:00
Shubham Dhama 9f78540bd0 org settings: Make save-discard widget look better.
This fixes some minor glitches with buttons:
* Movement of the organization-settings-parent block on the
  appearance of widgets.
* Large and odd look of save button.
* Use of fadeIn and fadeOut rather than changing opacity as
  opacity don't actually remove them.
2018-05-03 10:32:34 -07:00
Tim Abbott 0ada5fa9d8 stream_data: Fix exception when notifications_stream is private.
If notifications_stream is private and the current user has never been
subscribed, then we would throw an exception when trying to look up
notifications_stream.  In this situation, we should just treat it like
the stream doesn't exist for the purposes of this user.
2018-05-03 08:33:07 -07:00
Steve Howell 6bab68ff6a node tests: Fix flaws with narrow_activate tests.
The original version of this function was simulating kind
of an illogical code path, where -1 was sort of pointing to
a real message, which doesn't make sense.

Now we pass in an explicit then_select_id.
2018-05-03 07:52:15 -07:00
Aditya Bansal 898c281692 public_archives: Add styling to the public topics. 2018-05-02 15:23:33 -07:00
Steve Howell 66cd2edee4 Add narrow_state.get_first_unread_id(). 2018-05-02 13:34:54 -07:00
LuisFSilva a072b2a153 right-sidebar: Fix group PMs online indicator.
People found it confusing that it would show up at light-green when
the users in the thread were idle.

Fixes #8242.
2018-05-02 12:41:01 -07:00
Shubham Dhama c67897ba5b upload: Make progress bar for each file independent.
Here `file.lastModified` is unique for each upload so it is used
to track each upload individually.
Also, we have used `uploadStarted` function because it is
called for each file during an upload.

Fixes: #9068.
2018-05-02 12:32:13 -07:00
Steve Howell 230ecb24ed Add narrow_state.get_unread_ids(). 2018-05-02 11:23:58 -07:00
Steve Howell ceee49c075 Add filter.is_for_only(operand). 2018-05-02 11:23:58 -07:00
Steve Howell 7bc95efb41 Add unread.get_msg_ids_for_mentions(). 2018-05-02 11:23:58 -07:00
Steve Howell 9987ea525f Add unread.get_msg_ids_for_private(). 2018-05-02 11:23:58 -07:00
Steve Howell 7222dbd99b refactor: Simplify narrow_state.is_for_stream_id().
This takes advantage of the new function narrow_state.stream_id().

We now assume the incoming stream_id is a valid stream_id, so we
no longer need to test some of the error checking.  (It's possible that
the incoming stream_id may no longer be for a stream you subscribe
to, but the nice benefit of working more in "id space" is that if
it doesn't match the narrow's stream id, we know false is a safe
return value.)
2018-05-02 09:16:24 -07:00
Steve Howell a62c85c015 Add narrow_state.stream_sub() and narrow_state.stream_id(). 2018-05-02 09:16:24 -07:00
Steve Howell 0232e92038 Add filter.is_pm_with_only(). 2018-05-02 09:16:24 -07:00
Steve Howell 2a70f0dba4 Add filter.is_stream_topic_only(). 2018-05-02 09:16:24 -07:00
Steve Howell 08307c0e87 Add filter.is_stream_only(). 2018-05-02 09:16:24 -07:00
Steve Howell 0150c01027 Add unread.get_msg_ids_for_person(). 2018-05-02 09:16:24 -07:00
Steve Howell 2b35f26b88 Add unread.get_msg_ids_for_stream(). 2018-05-02 09:16:24 -07:00
Steve Howell c432acb436 Add unread.get_msg_ids_for_topic().
This will be useful for some narrowing related changes.
2018-05-02 09:16:24 -07:00
Steve Howell 76b97d8b54 refactor: Add util.sorted_ids().
We borrowed this from typing_data.js and gave it a slightly
different name (sorted -> sorted_ids).
2018-05-02 09:16:24 -07:00
Shubham Padia 23e82315b5 stream-settings: Remove redundant actually_filter_streams function call.
After adding a newly created stream to the top of the stream list,
call to actually_filter_streams in stream_events.mark_subscribed
rerendered the filter_table and the stream list was refreshed.  The
call to actually_filter streams was introduced to rerender the
subscriber list but stream_edit.rerender_subscribers_list takes care
of it already.

Fixes #9033.
2018-04-30 11:38:47 -07:00
Rohitt Vashishtha 639fa0db77 zblueslip: Convert node_tests/narrow_state.js to zblueslip. 2018-04-30 10:12:55 -07:00
Rohitt Vashishtha a87123ec23 zblueslip: Convert node_tests/input_pill.js to zblueslip. 2018-04-30 10:12:55 -07:00
Rohitt Vashishtha aa0c9a1a2a zblueslip: Convert node_tests/dict.js to zblueslip. 2018-04-30 10:12:55 -07:00
Rohitt Vashishtha 65bb2f3c40 zblueslip: Convert node_tests/channel.js to zblueslip. 2018-04-30 10:12:55 -07:00
Yashashvi Dave 7bbe44d7a0 org settings: Remove "Delete streams" administrative tab from settings.
Fixes #9227
2018-04-30 17:47:34 +05:30
Tim Abbott 7d6bb3dcb4 settings: Remove obsolete default_desktop_notifications setting.
This actually hasn't been hooked up to do anything in years.

While we're at it, we remove the entire "Zulip Labs" settings page.
2018-04-28 13:46:07 -07:00
Shubham Dhama 7f679bcdce org settings: Make allowed domain table status element fade out. 2018-04-28 13:24:59 -07:00
Shubham Dhama da8157d414 message: Extract function for editability of topic. 2018-04-28 13:00:29 -07:00
Steve Howell 160931377f node tests: Test deactivating streams. 2018-04-28 11:15:14 -07:00
Steve Howell 6e851f98f6 node tests: Test refreshing pinned streams. 2018-04-28 11:15:14 -07:00
Steve Howell cf24445809 node tests: Add test for stream_list.rename_stream. 2018-04-28 11:15:14 -07:00
Steve Howell 74e7c81c94 node tests: Add coverage for topic zooming.
These tests cover the stream_list side of the interaction.
2018-04-28 11:15:14 -07:00
Steve Howell c22a1d1f23 refactor: Simplify return values for would_receive_message().
Instead of treating false differently from undefined, our
function is now a regular boolean function, and we limit our
code comments to the one corner case where the true/false
decision is kind of arbitrary and possibly confusing.
2018-04-28 11:15:14 -07:00
Steve Howell fe62dacee0 node tests: Add coverage for stream sidebar search. 2018-04-28 11:15:14 -07:00
Steve Howell e9c6f3a07d stream list: Use newer code for the list cursor.
The new list_cursor class is more generic and saves the state
of your cursor across redraws.

Note that we no longer cycle from bottom to top or vice versa.

The node test code that was removed here was kind of complex
and didn't actually assert useful things after calling methods.
2018-04-28 11:15:14 -07:00
Steve Howell 779535fda3 minor: Extract some vars in stream_sort tests.
This is just to make the next commit a bit more convenient.
2018-04-28 11:15:14 -07:00
Steve Howell 605a90ce36 node tests: Reach 100% coverage for scroll_util.js. 2018-04-28 11:15:14 -07:00
Steve Howell 97b9367d20 refactor: Extract scroll_util.js.
We now use scroll_element_into_container() in two different
places, so it's worth extracting.
2018-04-28 11:15:14 -07:00