Commit Graph

1480 Commits

Author SHA1 Message Date
Steve Howell 6a54dfc127 Remove recent_subjects from node tests.
We now use stream_data.populate_stream_topics_for_tests(),
which hides some of the implementation details of initializing
the data structure.
2016-10-28 13:52:25 -07:00
Steve Howell 8acdf718bc Move process_message_for_recent_topics() to stream_data.js. 2016-10-28 13:52:25 -07:00
Steve Howell c799ac3126 Extract stream_data.is_active(). 2016-10-28 13:51:21 -07:00
Steve Howell ecbd77d8a5 Flip conditional in stream_list.add_sidebar_li(). 2016-10-28 13:51:21 -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
Tim Abbott 30c654f83f templates: Fix stack traces throwing handlebars errors.
This fixes the fact that we weren't using `throw` correctly, and also
the "handlerbars" typo.

Fixes #2143.
2016-10-27 22:06:56 -07:00
Steve Howell f98e605840 Extract topic_list.set_click_handlers(). 2016-10-27 15:49:25 -07:00
Steve Howell 8ebf48793c minor: Remove copy/pasted comment. 2016-10-27 15:49:25 -07:00
Steve Howell 9de7551f4f Extract topic_list.rebuild().
This was pulled from rebuild_recent_topics(), which still
exists to wrap passing in the stream_li parameter.
2016-10-27 15:49:25 -07:00
Steve Howell f7e6cfc892 Extract topic_list.build_list().
This used to be stream_list._build_subject_list().  The code
didn't change except for one s/subject/topic fix.
2016-10-27 15:49:25 -07:00
Steve Howell 8783a0e51d Move remove_expanded_topics() to topic_list.js. 2016-10-27 15:49:25 -07:00
Steve Howell 9b6b743a1a Move get_topic_filter_li to topic_list.js.
This also brought along:
    iterate_to_find (copied, see large comment explaining why)
    activate_topic (extracted from a one-liner)
    set_count (formerly stream_list.set_subject_count)

For get_topic_filter_li, we now pass in stream_li instead of
stream to decouple parent/child responsibilities between the
components.

Also, I made some s/subject/topic/ fixes.
2016-10-27 15:49:25 -07:00
Steve Howell 4f38cfdc7f Extract topic_list.update_count_in_dom().
This creates the new topic_list.js module, and the first
function that we extract is topic_list.update_count_in_dom().

This function needed to be decoupled from some non-topic-list
stuff which was overly complicated.
2016-10-27 15:49:25 -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 14dc98d8b9 server_events: Switch to using REST-style URLs.
This eliminates our use of /json/get_events; we'll remove that
endpoint in a future commit.
2016-10-25 18:02:16 -07:00
Brock Whittaker fd9a3f4609 admin: Remove values from emoji form input on success.
This removes the values after successfully creating a new realm emoji.
2016-10-25 17:01:03 -07:00
Tim Abbott 7ebfa25f5a message_edit: Make .save() automatically call .end() if no changes.
Previously, all of the callers of message_edit.save() would check if
it returned true, and if so, call message_edit.end().  This resulted
in various bugs in the past, so we switch to the much cleaner model of
just calling .end() inside .save().
2016-10-25 16:34:57 -07:00
Tim Abbott 05a2e57b14 message_edit: Make enter save when editing topics.
Fixes #1272.
2016-10-25 16:34:57 -07:00
Tim Abbott ff575aed99 message_edit: Fix error handling if user has re-narrowed. 2016-10-25 16:34:57 -07:00
Tim Abbott 985b4072c0 message_edit: Show a success message briefly. 2016-10-25 16:34:56 -07:00
Rishi Gupta d14f276322 topic_edit_form: Rename message_edit_topic to inline_topic_edit.
message_edit_form.handlebars already has a message_edit_topic that
refers to the topic edit section of message editing, and this made
things very confusing.
2016-10-25 16:33:20 -07:00
Rishi Gupta 82a0fe0eca actions popover: Change "Topic Edit" to "View Source / Topic Edit".
Also edit the icon to show "View Source" as the primary feature.
2016-10-25 15:12:32 -07:00
Rishi Gupta 7c227d8bb2 message_edit: Set focus to cancel button in topic-edit-only case.
Because the user was most likely intending to use the "View Source"
functionality, this makes exiting more convenient.
2016-10-25 15:11:39 -07:00
Brock Whittaker 82b5ef34be lightbox: Close lightbox if use clicks anywhere on the background. 2016-10-25 14:51:55 -07:00
Brock Whittaker 2ce601ebd1 Fix Multiple Lightbox Issues.
This fixes the following issues:
1. Photos are no longer resized larger than their native resolution.
2. Photos with transparency now have a checkerboard behind them to
signal an alpha of less than one.
2016-10-25 14:51:35 -07:00
Brock Whittaker bb23d6ed60 lightbox: Fix focus state when exiting lightbox.
Previously, exiting the lightbox and then hitting enter reopened the
lightbox with a null image.

Fixes #1982.
2016-10-25 14:48:34 -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
Steve Howell de727245aa subs: Add subscriber counts to the /#subscriptions page.
This borrows some work from krtkmj in #525.

Fixes #483.
2016-10-25 14:40:00 -07:00
Steve Howell 029682ec41 Fix stream_data.remove_subscriber().
We get events to delete subscribers for streams we are not
necessarily subscribed to, and it is now important to
process those events to produce the correct UI for showing
the number of subscribers to streams.
2016-10-25 14:29:27 -07:00
Tomasz Kolek 4790316b57 Add user setting option to always send push notifications.
Add option in user's settings for getting mobile push notifications
even if a Zulip browser is online.  Default is False.

Fixes: #1596.
2016-10-25 10:52:29 -07:00
Rishi Gupta b6da450b96 admin.js: Use RealmAlias instead of Realm to show the restricted domains.
Passes the allowed domains for a realm to the frontend, via
page_params.domains. Groundwork for allowing users to add and
remove domains via the admin setting page, rather than via the
realm_alias.py management command.
2016-10-25 10:07:20 -07:00
Tim Abbott 28cefc4996 hashchange: Fix buggy arguments to hashchanged causing scrolltop bug.
Because jQuery passes the actual hashchange event to an onhashchange
handler, the `if reload` checks in the `hashchanged` function were
always returning true, resulting in the wrong logic being used for
computing where to send the user in the event that they edited the
hash in the browser to change their narrow.
2016-10-23 20:07:12 -07:00
Rishi Gupta 49b23ea84a frontend: Allow users to see the source of messages they can't edit.
Previously we showed an "Edit" item in the actions popover menu when a user
could edit the content or topic of a message, and nothing otherwise. We now
show "Edit", "Edit Topic", or "View Source" in the popover menu for every
message, depending on the editability of the message, and present an
appropriate version of message_edit_form when the menu item is clicked.

Finishes #1604 and #1761.
2016-10-22 18:53:59 -07:00
Rishi Gupta 879f2a1e2e message editing: Refactor editability computation to use editability_types.
We compute the editability of messages in several places around the
frontend; standardize the definitions and store in
message_edit.get_editability. This commit should not change app behavior.
2016-10-22 18:52:49 -07:00
Rishi Gupta c2c389e949 message_edit.js: Refactor edit_message.
Cleanup and re-organize edit_message in preparation for the view source
changes. There are no behavior or logic changes in this commit.
2016-10-22 18:52:49 -07:00
Tim Abbott bd416c0425 message_edit: Cleanup unnecessary 2-layer nesting. 2016-10-22 18:52:49 -07:00
Tim Abbott 5b3caa4d18 message_edit: Fix tooltip with multiple messages being edited.
This fixes an issue where if there were multiple messages being
edited, all of them would have the same tooltip content.
2016-10-22 18:52:49 -07:00
Tim Abbott 5b656db303 message_edit: Clean up tooltip creation code.
This contains no functional changes.
2016-10-22 18:52:49 -07:00
Tim Abbott 0ccf8b162e message_edit: Move topic-editing-only warning.
This makes no functional change, because
`page_params.realm_message_content_edit_limit_seconds === 0` means
can_edit_content is always true.
2016-10-22 18:52:49 -07:00
Tim Abbott d5c3ad8eb5 message_edit: Only initialize composebox_typeahead if needed. 2016-10-22 18:52:49 -07:00
Tim Abbott 76d49300b3 message_edit: Move original_topic variable to a better spot. 2016-10-22 18:52:49 -07:00