Commit Graph

323 Commits

Author SHA1 Message Date
Brock Whittaker
3d8ed7b55f subs: Rewrite Stream Filter Function.
This is more performant, along with accepting a parameter for
filtering only streams that are subscribed to if the toggle is set to
subscribed only.

Also, it now does substring matches, rather than just matching if an
entire word matches the search query.

Fixes #2141.
2016-11-15 12:21:43 -08:00
Steve Howell
f3373d62e1 stream sidebar: Clean up unsubscribe logic.
From subs.js we don't redundantly try to remove an element
from ths sidebar; we just trigger the event.

In stream_list.js we continue to remove the element from
the DOM, and we also remove the widget from our internal
Dict of sidebar rows, so that if we re-subscribe, we know
we'll automatically re-build the widget from the template
and the latest data from stream_data.js.
2016-11-11 12:12:13 -08:00
Steve Howell
00068f3164 Extract stream_data.unsubscribe_myself(). 2016-11-09 15:03:08 -08:00
Tim Abbott
ee361cbe30 js: Eliminate process_loaded_for_unread global. 2016-11-05 11:33:04 -07:00
Brock Whittaker
4400665a6d subs: Move stream settings into an independent overlay.
This replaces the scrolling stream settings feature with a stream
settings overlay.
2016-11-04 17:13:26 -07:00
Tim Abbott
78ec0341c4 subs: Fix color picker issue with subscribing. 2016-11-04 17:13:26 -07:00
Tim Abbott
73f020645f subs: Remove unnecessary update_stream_color call.
The color was already being updated in the response from the server.
2016-11-04 16:37:29 -07:00
Tim Abbott
a70c5eb923 colorpicker: Migrate to use stream IDs to access things. 2016-11-04 16:37:29 -07:00
Tim Abbott
ab6fd87161 subs: Fix rename stream handling of email addresses. 2016-11-04 16:37:29 -07:00
Tim Abbott
e6734bfada subs: Cleanup stream rename logic. 2016-11-04 16:37:29 -07:00
Tim Abbott
ee976a9bdc subs: Use subscription_settings when changing descriptions. 2016-11-04 16:37:29 -07:00
Tim Abbott
45c7945818 subs: Use sub_settings in subscriber add/remove flow. 2016-11-04 16:37:29 -07:00
Tim Abbott
8e522cd933 subs: Convert stream_home_view_clicked to use sub_settings. 2016-11-04 16:37:29 -07:00
Tim Abbott
2467f765ad subs: Stop using sub_row when rendering settings. 2016-11-04 16:37:29 -07:00
Tim Abbott
16408da823 subs: Cleanup change_stream_privacy.
We now:
(1) Only look up streams by ID

(2) Correctly look up both the stream-row and subscriptions_row after
the success handler returns.
2016-11-04 16:37:29 -07:00
Tim Abbott
32a571445a subs: Use settings_for_sub when redrawing privacy stuff. 2016-11-04 16:37:29 -07:00
Tim Abbott
b67c0a4ad5 subs: Move settings_for_sub and button_for_sub earlier. 2016-11-04 16:37:28 -07:00
Tim Abbott
b1a5d57405 subs: Update get_subscriber_list to use subscription_setings. 2016-11-04 16:37:28 -07:00
Tim Abbott
109287dceb subs: Update descriptions in settings separately from stream rows. 2016-11-04 16:37:11 -07:00
Tim Abbott
7a59ae591a subs: Fix get_stream_name to use IDs from the DOM.
We haven't added a data-stream-name to the subscription_settings
object yet, and ideally we'd be moving away from using
data-stream-name anywhere.
2016-11-04 16:16:07 -07:00
Brock Whittaker
7d51b6a454 subs: Create get_stream_name to get stream name from UI.
This accepts an arbitrary click target in the DOM inside a stream row
or stream settings element and returns the stream name.
2016-11-04 13:53:12 -07:00
Steve Howell
3941334d00 Use user_ids for subscribers in stream_data.js.
We still shim a lot of methods to keep using emails, but the
internal data structure now has user_ids.
2016-11-04 11:37:12 -07:00
Steve Howell
7509f73f02 Clean up stream renaming in the JS code.
We now use stream_id as our key to rename streams, which
should prevent a few race conditions long term.  (We are
still possibly contending with other events that use
stream_name as a key, so this is not perfect.)
2016-11-04 11:30:18 -07:00
Steve Howell
4ace9bbd77 Remove dead code related to subs.create_sub().
Since we started handling the stream/create event properly,
create_sub() became dead code.
2016-11-04 11:30:18 -07:00
Tim Abbott
368b585980 subs: Redesign the rows of the #subscriptions table. 2016-11-03 17:33:33 -07:00
Steve Howell
148e1e6add subs: Avoid duplicate prepend_subscriber() call.
We don't want to prepend new subscribers to our list of
subscribers in the settings page when they hit enter; we
want to wait till we get the event from the server.

This is a fairly new regression that was added when we
live-updated peer subscriber changes.
2016-11-01 14:01:29 -07:00
Steve Howell
758c040558 Make stream-invite typeahead more dynamic and accurate.
The typeahead for inviting users to an existing stream now
uses a function, not a static list, and it now only shows
users from your realm.
2016-11-01 13:55:48 -07:00
Tim Abbott
1bc9be7aed subs: Fix stream privacy changes not working after renaming.
This fixes and issue where the change_stream_privacy template had its
own duplicate copy of the data-stream-name attribute, which wasn't
updated when streams were renamed.

Fixes #2016.
2016-10-28 16:42:32 -07:00
Tim Abbott
6927a9bdc4 subs: Update subscription settings data when renaming streams. 2016-10-28 16:41:54 -07:00
Tim Abbott
0185764be7 subs: Fetch stream name from data-stream-name. 2016-10-28 16:12:50 -07:00
Tim Abbott
9507ed8a05 subs: Move show_settings_for earlier in file. 2016-10-28 16:10:59 -07:00
Tim Abbott
c10fd243f1 subs: Rename subscriber_count class to subscriber-count.
Also remove the unused subscriber-count-row class.
2016-10-28 16:07:28 -07:00
Tim Abbott
c0a774ef8c subs: Remove use of $-based variable names. 2016-10-28 16:07:02 -07:00
Tim Abbott
b8304c3359 subs: Find elements using the new data-stream-id value.
This is preparation for no longer having the subscription inside the
subscription_row object.
2016-10-28 16:06:40 -07:00
Tim Abbott
3727ea6fb0 subs: rename .subscription_description to .description. 2016-10-28 14:47:23 -07:00
Tim Abbott
dd2fab9374 subs: Rename data-subscription-id to data-stream-id. 2016-10-28 14:47:23 -07:00
Tim Abbott
66e2632809 subs: Rename .subscription_name to .stream-name. 2016-10-28 14:47:22 -07:00
Tim Abbott
f18d53d46a subs: Rename .subscription_row to .stream_row.
The new name is clearer, since we show these rows for streams whether
or not you're subscribed.
2016-10-28 14:25:00 -07:00
Steve Howell
15602ee6bb Stop using /json/streams on the client.
We no longer need to fetch streams from the server when
we render the settings page.

The name populate_and_fill() may not be a great name any
more.
2016-10-28 13:44:46 -07:00
Steve Howell
10bc093375 Stop using server data to draw "Manage Streams".
We have all the data we need on the client side.
2016-10-28 13:44:46 -07:00
Steve Howell
9d4debd1eb Live-update added/removed subscribers. 2016-10-28 13:43:09 -07:00
Tim Abbott
01f0be27a7 subs: Combine another set of settings show handlers. 2016-10-27 22:24:40 -07:00
Tim Abbott
426f2b0405 subs: combine some settings show handlers. 2016-10-27 22:22:28 -07:00
Tim Abbott
3fd94cc58a subs: s/subrow/sub_row/ in variable names. 2016-10-27 22:19:30 -07:00
Tim Abbott
12331e2596 subs: Extract show_subscription_settings. 2016-10-27 22:06:56 -07:00
Steve Howell
65a2f012d4 Simplify pin/unpin code path.
I make server_events slimmer by not handling a specific
property when subs.update_subscription_properties() should
do all the dispatching (and mostly did).

And then since update_subscription_properties() has
a "sub" already, I can call directly to stream_list code
and remove a function from subs.js.  Since I lose the
wrapper function in subs.js, I rename the stream_list
function as part of this commit.

The only code that gets slightly heavier here is that
we have two lines in the 'pin_to_top' case instead of one.
2016-10-25 23:29:15 -07:00
Steve Howell
1a927a424f Avoid passing around full_name parameter in subs.js.
All of the eventual callers to prepend_subscribers()
and format_member_list_elem() call people.get_by_email()
anyway, so now we do it one place.  The one exception
was using page_params.fullname, which is awkwardly
different than what we call that variable elsewhere
(fullname vs. full_name).
2016-10-25 18:15:24 -07:00
Steve Howell
51f0f7c7c4 Simplify creating subscriber list.
We were awkwardly reversing a list to use a one-line
helper method that did exactly the opposite of what
we wanted. :)  Now we just append simply.
2016-10-25 18:15:24 -07:00
Steve Howell
89b17ec2a4 Extract prepend_subscriber().
This is a minor change to avoid some 2-line calls in our
code.  (We're about to introduce a third usage of this.)
2016-10-25 18:15:24 -07:00
Tim Abbott
0f7c8c6d34 subs: Rerender subscriber counts from peer changes correctly.
This makes subscriber count management completely nice and real-time.
2016-10-25 14:40:24 -07:00