Commit Graph

16 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
Harshit Bansal efc2df168c subs: Fix the autocomplete suggestions while adding subscribers.
Earlier, the autocomplete was also showing the emails of the users who
were already subscribed to the stream.

Fixes: #4028.
2017-07-05 13:22:07 -07:00
Harshit Bansal efa1cf6fb5 subs: Fix the traceback when an user subscribes/unsubscribes.
On receiving a `peer_add`/`peer_remove` event we were performing a
subscribers list re-rendering even when the stream settings form was
not open which was causing a traceback. This commit fixes this behavior
by first checking if the corresponding stream settings form is open and
performs a re-rendering only when it is open.
2017-06-27 16:23:00 -04:00
Harshit Bansal aee130bf06 subs: Fix the real-time sync when adding/removing the subscribers.
We were incorrectly amending the HTML directly whenever a subscriber
was added/removed. For updating any list which is being managed by
`list_rendering.js`, instead of modifying the HTML directly we should
just update the data in list render instance and perform a re-render.

Fixes: #4812.
2017-06-20 15:44:20 -04:00
Harshit Bansal e82a53117a stream_edit.js: Add `rerender_subscribers_list()` function.
This function can be used for updating the subscribers list correctly
when a subscriber is added or removed.
2017-06-20 15:44:20 -04:00
Harshit Bansal 3f0ccd66c5 stream_edit.js: Extract `get_email_for_subscribers()` function.
This function can be used for mapping subscribers's id to their email.
2017-06-20 15:44:20 -04:00
Steve Howell 499962bb6b Change arg for stream_list.redraw_stream_privacy().
We now pass in a sub, not a stream name.
2017-06-14 11:24:42 -04:00
Akhil ff9a929d7a typeahead: Remove highlighting and add common template. 2017-06-13 16:16:17 -04:00
Akhil cc0dbef5a4 typeahead: Move highlight_with_escaping into render_person. 2017-06-08 12:01:03 -07:00
Sarah 9ebb503340 settings_notifications.js: Save notification settings on change.
Refactor settings_notifications to save each setting on change.

Fixes #3264.
2017-06-07 13:39:27 -07:00
Steve Howell 958ed20a0f Only render one stream at a time for editing.
We used to render the subscriptions_settings template for every
stream when you loaded "Manage Streams," which can be very slow
for a big realm.  Now we only render the right pane on demand.
2017-05-11 08:46:52 -07:00
Steve Howell a9031fe7b3 Fix some bugs for changing stream privacy.
The function stream_data.add_admin_options() got removed as
part of a somewhat recent fix.  This caused a console error, and
the modal would not go away.

We now call the new stream_data.update_calculated_fields().

This commit only addresses the recent regression.  We still have
the known issue that public/private changes do not get
live-updated for other users.
2017-05-11 08:46:52 -07:00
kunall17 e087bc24f8 streams: Migrate stream property changes to new REST endpoint.
This is one of the last major endpoints that were still done in the
pre-REST style.

While we're at it, we change the endpoint to expect a stream ID, not a
stream name.
2017-05-09 13:39:23 -07:00
Brock Whittaker 2fafc6bec5 Change streams subscriber lists to render progressively. 2017-05-01 16:56:54 -07:00
Steve Howell 8eb86335b9 Extract narrow_state.js.
Despite the length of this commit, it is a very straightforward
moving of code from narrow.js -> narrow_state.js, and then
everything else is just s/narrow.foo()/narrow_state.foo()/
(with a few tiny cleanups to remove some code duplication
in certain callers).

The only new functions are simple setter/getters that
encapsulate the current_filter variable:

    narrow_state.reset_current_filter()
    narrow_state.set_current_filter()
    narrow_state.get_current_filter()

We removed narrow.predicate() as part of this, since it was dead
code.

Also, we removed the shim for narrow_state.set_compose_defaults(),
and since that was the last shim, we removed shim.js from the app.
2017-04-25 09:57:32 -07:00
Steve Howell 7326971380 Extract stream_edit.js.
This code makes the right pane work in "Manage Streams" when
you are editing a stream subscription.  It handles basic
functionality (submitting forms, etc.), live updates, and
showing the pane as needed.

Most of the code here was simply moved from subs.js, but some
functions were pulled out of larger functions:

    live update:
        add_me_to_member_list
        update_stream_name
        update_stream_description

    collapse/show:
        collapse
        show_sub

We also now export subs.show_subs_pane.

We eventually want stream_edit not to call into subs.js, and
this should be fairly easy--we just need to move some shared
methods to a new module.
2017-04-25 09:57:32 -07:00