Commit Graph

3758 Commits

Author SHA1 Message Date
Cynthia Lin 4cc33b6173 hotkeys: Disable enter hotkey while Streams menu is open.
Prevents compose box from opening and potentially sending a message.
Fixes #2412
2017-05-15 20:28:56 -07:00
Steve Howell c7f710b8d4 muting.js: Track muted streams using stream id.
This should prevent some glitches with stream rename events.
2017-05-15 14:47:41 -07:00
Steve Howell 8eb9723283 stream_list: Call update_streams_sidebar() on renames.
If you rename a stream, call update_streams_sidebar() to
make sure we redraw the active stream correctly.
2017-05-15 14:47:41 -07:00
Steve Howell 76f68e9836 Fix buggy update_streams_sidebar().
If you were narrowed to an unpinned stream, and then pinned it,
we were mostly redrawing the sidebar correctly, but we weren't
setting the active-filter class.  Now we accomplish this by
calling maybe_activate_stream_item(), which also reduces some
code duplication.  (The new code introduces a bit of extra logic
to do `stream_li.addClass('active-filter')`.
2017-05-15 14:47:41 -07:00
Steve Howell 5b6bd6767b refactor: Extract stream_list.maybe_activate_stream_item(). 2017-05-15 14:47:41 -07:00
Steve Howell 1a11042fdf refactor: Use stream id more in topic_list.js. 2017-05-15 14:47:41 -07:00
Steve Howell 2e39d48626 Add stream_data.get_recent_topics_for_id(). 2017-05-15 14:47:41 -07:00
Steve Howell 762194f98d Add stream_data.id_is_subscribed().
We use this function in stream_list.js.
2017-05-15 14:47:41 -07:00
Steve Howell efb35afeb7 Track recent topics (and active streams) using stream id.
This commit changes the key for recent_topics to be a
stream id.  For streams that have been renamed, we will now
get accurate data on recent topics and active streams as
long as stream_data.get_stream_id(stream_name) returns a
valid value.
2017-05-15 14:47:41 -07:00
Steve Howell 5d33d02235 Track unread counts using stream_id. 2017-05-15 14:47:41 -07:00
Steve Howell c125ba1d08 Fix how we find if streams are muted.
This commit changes stream_data.in_home_view() to
take a stream_id parameter, which will make it more
robust to stream name changes.

This fixes a bug.  Now when an admin renames a stream
you are looking at, it will correctly show itself to
be un-muted. (Even with this fix, though, the stream
appears to be inactive.)

Some callers still do lookups by name, and they will
call name_in_home_view() for now, which we can
hopefully deprecate over time.
2017-05-15 14:47:41 -07:00
Steve Howell d3a7aa3a37 Have get_stream_li() take a stream_id.
Rather than having get_stream_li() look up stream id using
stream name, we force the callers to pass in the stream id.

This adds an extra line to most of the callers for now, but
this will eventually change as we fix some of the callers to
have their callers pass in stream_id.

In places where we now call stream_data.get_stream_id() to
get the stream id, we will be more resilient toward stream
renamings, at least until the next reload, since
stream_data.get_stream_id() can resolve old names that
are stored when we process stream-rename events.
2017-05-15 14:47:41 -07:00
Steve Howell a48419310e Simplify get_filter_li() and get_stream_li().
We no longer have get_stream_li() delegate to get_filter_li(),
which simplifies the logic in get_filter_li() and makes
get_stream_li() more direct.

We also move the two functions closer to each other in the file.
2017-05-15 14:47:41 -07:00
Steve Howell 292b0ac64d Extract set_stream_unread_count. 2017-05-15 14:47:41 -07:00
Steve Howell cfdf256c62 refactor: Call get_stream_li() in a few places.
This is a step toward simplifying get_filter_li().
2017-05-15 14:47:41 -07:00
Cynthia Lin 934bae5232 user docs: Add user guide for *View and edit your message drafts*.
Fixes #4335.
2017-05-15 13:32:18 -07:00
Aditya Bansal debcf507bd Clean organization-settings-admin to use 4 space indents. 2017-05-15 11:51:21 -07:00
Aditya Bansal 8530997542 Clean default-streams-list-admin to use 4 space indents. 2017-05-15 11:51:21 -07:00
Cynthia Lin 1bea4da0f4 org settings: Fix minor styling inconsistencies.
Fixes #4789.
2017-05-15 11:35:58 -07:00
Tim Abbott 157e0623f8 5xx: Remove hardcoded twitter/email contacts from nginx 500 page.
There's no correct contact that we can list here unconditionally;
previously, we had people emailing zulip-devel@ because their server
was misconfigured.

Addresses #696 enough that it's no longer a priority issue.
2017-05-13 22:44:34 -07:00
Steve Howell 252d0a6e15 Use stream_data.get_name() in narrow_state.stream().
Using get_name() is more robust for stream name changes.  This
fixes, for example, the situation where you narrow to a stream,
edit it via the sidebar, and then close the modal, and the message
redraw logic thinks you have unsubscribed.

Fixes #4686.
2017-05-13 21:59:08 -07:00
Steve Howell 8b78f3f133 Look up old stream names in stream_data.get_name().
This change fixes a few small things related to stream
renames, such as what happens if you hit the back button
to go to a narrow where the stream had been renamed.  You
will now get the correct behavior in terms of filtering
and searching.  Unfortunately, this will only last until
you reload.
2017-05-13 21:59:08 -07:00
Steve Howell 191741a382 Use stream ids to filter messages in client-side narrows.
We now use stream ids to filter messages in narrowing
situations, instead of doing stream name comparisons.

This partially fixes certain stream-renaming scenarios, since
we will be able to match the stream id for an out-of-date
stream operand, but it doesn't fix some other stuff, such
as the query that the server gets.
2017-05-13 21:59:07 -07:00
Steve Howell 8ecfda9344 stream_data: Remember old stream names.
This is not a user-facing change, but it starts us down the
path to having the JS client be able to look up old stream
names for situations like people clicking old external links
or for live-update scenarios.
2017-05-13 21:58:37 -07:00
Tim Abbott 286bbff800 left-sidebar: Change color of STREAMS label on hover. 2017-05-13 14:41:58 -07:00
derAnfaenger 45a9b657c7 Refactor left sidebar topic cursor css.
This commit addresses to issues with the left sidebar:
The cursor flickering when hovering over topics, and
the cursor not becoming a pointer when resting just right
of a topic's name (in a clickable area).

This is a follow-up to #4675.
2017-05-13 14:41:48 -07:00
Tim Abbott d6059d0d9a landing: Add template containing comparison checkmarks.
Can be added to the landing pages via:
+    {% include 'zerver/compare.html' %}
+

I'm avoiding adding that include into the landing pages until we have
time to do a bit of tweaking of the styling to integrate better into
/hello/ (primarily color-wise).

Most of the work for this was done by Brock, huge thanks to him!
2017-05-13 14:32:24 -07:00
Tim Abbott 4d2bb0dec8 templates: Clean up visuals for account-not-found SSO flow.
Also, clarify that the account that isn't found is your Zulip account,
not a GitHub/Google Oauth account.
2017-05-13 12:46:05 -07:00
hackerkid cf15a7b561 presence.js: Make get_status return active for logged in user. 2017-05-12 14:28:23 -07:00
Abhijeet Kaur 0b7d138871 settings: Make description textarea readonly for non-admin users.
Fixes #4754.
2017-05-12 14:16:43 -07:00
Tim Abbott f25d7dd721 settings: Fix spelled of muted topics message. 2017-05-12 12:38:29 -07:00
Steve Howell a0fab6842c Improve error handling in get_action_menu_menu_items(). 2017-05-12 12:25:03 -07:00
Aditya Bansal 33f3d773b0 Clean user-list-admin to use 4 space indents. 2017-05-12 12:23:01 -07:00
Aditya Bansal 0c39a45d72 Clean bot-list-admin to use 4 space indents. 2017-05-12 12:23:01 -07:00
Steve Howell f0b30b57ca modals: Make error reports more specific.
We now give a more specific error message when something goes
wrong in closing a modal.
2017-05-12 08:27:25 -07:00
Cory Lynch 08f1c86041 Make reaction picker case-insensitive.
The search bar for picking message reactions now is case-insensitive,
since that's a better user experience, and there isn't a clear use
case for capital letters in emoji names.

Fixes #4666.
2017-05-11 19:10:21 -07:00
Tejas Kasetty 9b9c323314 emoji picker: Move cursor to end of filter string when focusing.
This is a much less annoying behavior than the Chrome browser default.

Explanatory comment added by tabbott, thanks to Steve Howell for the
research.

Fixes #4604.
2017-05-11 18:54:44 -07:00
Brock Whittaker f1a7db2503 Add placeholders to all empty lists.
This adds placeholders that state that the lists are empty.
2017-05-11 17:49:27 -07:00
Brock Whittaker e294035c93 Fix table display.
This fixes the way that tables display across the settings page,
so that the buttons shouldn't collapse to the second line anymore.
2017-05-11 17:49:26 -07:00
Brock Whittaker 8559acec1d Clean up settings overlay "Your Account" tab display.
This enforces a max-width of 1024px on the #settings overlay.

This commit also cleans up the "Your Account" tab to display
correctly without the avatar bleeding over to the next line.
2017-05-11 17:49:26 -07:00
Brock Whittaker 478011c0af Remove headers from templates. 2017-05-11 17:49:26 -07:00
Brock Whittaker f95021d419 Add settings sections to header.
This adds the settings section that you are in to the page header.
2017-05-11 17:49:26 -07:00
Brock Whittaker 6e7305f784 js: Implement DynamicText class.
This implements the DynamicText class for resizing of text to fit the
parent node.
2017-05-11 17:23:53 -07:00
Rishi Gupta 0ce04556bf CSS: Change color of PMs from yellow to blue-grey. 2017-05-11 16:18:39 -07:00
Steve Howell d415d4cf11 Add error handling in watch_manual_resize().
We now explicitly complain if a caller passes in a bad
selector to this function and return undefined.
2017-05-11 15:45:47 -07:00
Tim Abbott 35a5ca411a emoji: Fix scaling of realm emoji in reactions.
Fixes #4762.
2017-05-11 14:40:05 -07:00
Tim Abbott eb6af282fb login: Shrink font size of organization name. 2017-05-11 14:26:06 -07:00
Tim Abbott 223624be25 settings: Add support for longer, markdown-powered realm descriptions.
This makes it possible to create much prettier login pages.

Further work on styling may be necessary.
2017-05-11 13:59:46 -07:00
Tim Abbott 2c64626e7a mobile: Disable tutorial on mobile clients. 2017-05-11 11:01:56 -07:00
Steve Howell d7813ee6b3 reactions: Remove unneeded message_store.get() calls.
Both callers to get_user_list_for_message_reactions() already
had a message object, so there was no need to pass in an id
just to fetch it from message_store again, so now the first
parameter is message, not message_id.
2017-05-11 09:39:17 -07:00
Steve Howell 87f5c22593 Simplify how we find the current user's emoji reactions.
This adds the current_user_has_reacted_to_emoji() helper.

This new helper is easier to use and slightly more efficient
than calling get_user_list_for_message_reaction() and then
indexOf().

This also replaces one call to get_user_list_for_message_reaction()
with a list of user_ids that we already had locally.

The node tests were improved a bit here, including a minor
whitespace fixup.
2017-05-11 09:39:17 -07:00
Tim Abbott 3bf5c647d9 css: Remove black background for signin logo. 2017-05-11 09:00:23 -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
hackerkid 9aaf175ec6 Move add new default stream box to top.
Fixes #4734.
2017-05-10 16:56:30 -07:00
Brock Whittaker f651c7fb18 user-profile: Add mobile-responsive styling.
This changes the styling of the user profile popup to be responsive
to mobile devices. In this case it is converted to a modal form using
flex to center it on devices with screen sizes under 768px in width.

Fixes #4669.
2017-05-10 16:49:42 -07:00
Tejas Kasetty 5dd5c84854 Add support for emoji picker hotkeys in compose context.
This is a follow-up to merging the compose and reactions emoji
pickers.  The logic for what happens when the user picks an emoji via
the hotkeys (i.e. hits `enter`) was still attempting to add a reaction
to the currently selected message unconditionally.

This commit adds a check in the two `enter` key code paths, and does
the correct thing in each case.

Fixes #4736.
2017-05-10 16:26:58 -07:00
Brock Whittaker 52059d21a4 product-pages: Fix broken click target on .hamburger.
The click target was still for #hamburger even though it has since
been changed to .hamburger. This fixes the selectors to make it work
with the new className declaration over ID.
2017-05-10 14:56:36 -07:00
Steve Howell f60a829b4d Remove lightbox.is_open property.
Outside of lightbox.js, we now use modals.lightbox_open() to
detect that the lightbox modal is open.
2017-05-10 09:46:21 -07:00
Steve Howell 1d7f93e550 Avoid re-opening the lightbox.
If the lightbox is already open, don't re-open it.
2017-05-10 09:46:21 -07:00
Tim Abbott c2a11655ef css: Decrease stream padding in left sidebar. 2017-05-10 09:45:40 -07:00
Tim Abbott 3d5350408b css: Fix vertical alignment of global filter counts.. 2017-05-09 19:17:33 -07:00
Tim Abbott 60a81fef43 design: Restore font color in left sidebar to #333.
This fixes a major complaint with the left sidebar styling.
2017-05-09 19:00:46 -07:00
Brock Whittaker 7dbf0c8811 Normalize left and right sidebar font size.
This normalizes the left and right sidebar font size to be 0.89rem.
2017-05-09 18:54:10 -07:00
Brock Whittaker 242eb9b346 portico-sidebar: Fix sidebar logo to be current logo.
This fixes the sidebar logo to be the current zulip logo rather
than a mockup of a potential logo that was from the redesign.
2017-05-09 18:48:33 -07:00
Steve Howell 5c52495b64 Use modals.settings_open().
We now uses modals.settings_open() to check for the settings
modal being open, rather than doing a regex check on
windows.location.hash.
2017-05-09 18:44:08 -07:00
Steve Howell 37254c9031 Simplify ESC handling for modals.
Rather than checking every modal individually in hotkey.js for
handing the escape key, we now use the modals API:

    is_active: says whether any modal is open
    close_active: closes the active modal
2017-05-09 18:44:08 -07:00
Steve Howell 23b7be90c2 Fix console errors with closing settings.
We were mapping the escape key to fake-click a redundant
click handler when the settings pages were open.  This fix
lets the actual click handling work via modals.js, and it
lets keyboard handling directly calls modals.close_settings().
2017-05-09 18:44:08 -07:00
Brock Whittaker 3fd3ae4199 Restyle /hello/ page.
This restyles the /hello/ page to be the new portico branding.
2017-05-09 16:31:57 -07:00
Brock Whittaker a82a0d16d5 Add landing page assets.
This adds the required logos and other assets for the /hello/ page.
2017-05-09 15:26:45 -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
Rishi Gupta a75af36039 stats: Change sort order of client labels to match default view. 2017-05-09 11:32:35 -07:00
Rohitt Vashishtha 5be7494ddf Remove duplicate connection-error message.
There's really no need for a separate user-visible error message for
get_messages vs. get_events.

Fixes #4703.
2017-05-09 11:13:27 -07:00
Steve Howell 94b7058743 Make local_echo an official feature.
This commit removes all references to feature_flags.local_echo.
It's been a core feature for about four years, so I think we
can safely say the experiment was successful.:)
2017-05-09 11:06:10 -07:00
Steve Howell 0a0f567aeb Split out markdown.js from echo.js.
The new module handles markdown rendering.

The code left behind in echo.js does local-echo kind of things
like reifying message ids.
2017-05-09 11:06:10 -07:00
Mahim Goyal 49fec57768 Add hotkey for narrowing to next unread topic.
Fixes: #4199.
2017-05-09 10:02:54 -07:00
Tim Abbott 40e43d8cba narrow: Remove unused by_conversation_and_time and by_id helpers.
Now that we just copy links to the clipboard, neither of these are
used.  (Actually, the narrow.by_id helper has been dead code for
years).
2017-05-09 09:59:37 -07:00
Mahim Goyal a2adcfd7fc popovers: Add direct copy to clipboard link feature.
Change the onClick function of copy link of
conversation to actually copy the link to clipboard.

Fixes: #4621.
2017-05-09 09:59:23 -07:00
Mahim Goyal 6fe0728afa Return absolute URL from narrow.by_conversation_and_time_uri 2017-05-09 09:55:38 -07:00
Steve Howell 70d4ac93ce Add modals.info_overlay_open().
This also removes ui_state.js, since its last function
is now replaced by modals.info_overlay_open().
2017-05-09 09:19:27 -07:00
Steve Howell 742c55f514 Speed up key handling by adding modals.is_active().
The function modals.is_active() can see if modals are open
without having to look at the DOM.  This should make it snappier
to type in the compose box.  Even if the speedup is pretty minor,
not having to worry about jQuery slowness should make it easier
to diagnose future compose box issues.

The new function gets used in other places, too, where performance
isn't so much an issue.
2017-05-08 22:04:56 -07:00
Steve Howell 3c0ef6295f Enforce that only one modal can be open at any time. 2017-05-08 22:04:56 -07:00
Steve Howell ddded59a6d Remove modals.set_close_handler(). 2017-05-08 22:04:56 -07:00
Steve Howell 07248ee7bd Use modal.open_overlay() for info overlays. 2017-05-08 22:04:56 -07:00
Steve Howell 4bcb4d6c15 Use modal.open_overlay() in subs.js. 2017-05-08 22:04:56 -07:00
Steve Howell 0965fc5a05 Use modal.open_overlay() in settings/admin. 2017-05-08 22:04:56 -07:00
Steve Howell b82a802c22 Use modal.open_overlay() in lightbox.js. 2017-05-08 22:04:56 -07:00
Steve Howell 02c743853c Use modal.open_overlay() in invite.js. 2017-05-08 22:04:56 -07:00
Steve Howell 6d1a6934b8 Use modal.open_overlay() in drafts.js. 2017-05-08 22:04:56 -07:00
Steve Howell 09a37ec179 Add modals.open_overlay(). 2017-05-08 22:04:56 -07:00
Steve Howell 2f6edf47bc Fix code format of modals.js.
Our de facto coding standard for JS modules is not indent
within the boilerplate, and we assign functions to `exports`
in single JS statements.
2017-05-08 22:04:56 -07:00
Tim Abbott 9da63bc087 ui: Initialize settings_sections before hashchange.
This is important, since settings_sections must be initialized in
order to load the page with a hash in the settings UI.
2017-05-08 22:02:56 -07:00
Mahim Goyal 6464514ca9 Break compose.js and drafts.js dependency. 2017-05-08 14:43:49 -07:00
Mahim Goyal a44a291cdf Don't open compose when clicking links containing search terms.
Link that is a search term opens compose box, add this exception to
the is_clickable_message_element.

Fixes: #4651.
2017-05-08 11:39:00 -07:00
derAnfaenger d63fdf5bc6 Fix Twitter bot breaking layout with long words/links.
Long words and links now get automatically broken down in the
'twitter-tweet' div; prevents a message box overflow.

Fixes #4659.
2017-05-08 09:56:35 -07:00
Tim Abbott d3c05eaf42 templates: Fix alignment issue deactivated users table. 2017-05-05 14:14:37 -07:00
Brock Whittaker 8c715a79b9 Change admin active users list to render progressively. 2017-05-05 14:14:37 -07:00
Brock Whittaker 1a8a8b6d0c Change admin bots list to render progressively. 2017-05-05 14:14:37 -07:00
Brock Whittaker db40d62092 Change admin streams list to render progressively. 2017-05-05 14:14:37 -07:00
Brock Whittaker 0e4f2f732d Change admin default streams list to render progressively. 2017-05-05 14:14:37 -07:00
Brock Whittaker 6c3606cf36 Change admin deactivated users table to render progressively. 2017-05-05 14:14:37 -07:00
Brock Whittaker 7408656218 Improve list_render implementation's edit flow.
The list_render class "list" prop was immutable so when the
data prop would be updated it would not appropriately update
the data inside the primary list for filtering.

This commit also fixes an issue where if a jQuery selection was
passed in, all the nodes rather than just the first get copied over.
2017-05-05 14:14:12 -07:00
Brock Whittaker c8902d5d71 settings: Make settings overlay more responsive.
This doesn't completely fix settings responsiveness, but it's a big
step along the way.  Outstanding issues include:

1. When switching tabs from settings to organization, it will launch
the first item which is more annoying in this view since it brings you
into that tab. Haven’t decided on an elegant solution to this yet.

2. Sidebar scrolling doesn’t work. I have to restructure how the top
section and bottom sections of content are displayed to fix this.
Likely by enforcing min-height of 100% - bottom height on the top piece.

3. Most of it is actually reasonably responsive but some isn’t, and
should be fixed on a case-by-case.
2017-05-05 13:42:09 -07:00
Brock Whittaker 2ae23054ee informational-overlays: Focus overlay body on shortcut "?".
This focuses the body content of the informational overlay after
going to it from "?" so that you can use up and down arrows to then
scroll the content easily.

Fixes: #4480.
2017-05-05 09:53:58 -07:00
Cory Lynch 3d0cf35f49 message_edit.js: Fix bug with ctrl+enter hotkey not working.
This was a regression introduced in ba7b7a9. The ID of the
edit boxes were changed in that commit, but this event
listener was not updated to reflect that.
2017-05-04 19:46:10 -07:00
Brock Whittaker 1bb260325c settings: Improve general table styling.
This generally makes the tables that have thead attributes look
uniform with the tables that use the first tbody column as a thead.
2017-05-04 16:43:34 -07:00
Tim Abbott e219dda071 reload: Fix tracebacks on browsers without local storage.
This fixes an issue where browsers without local storage (aka the
Zulip ancient QT-based desktop app) would throw an exception trying to
reload in modern Zulip.
2017-05-04 16:21:58 -07:00
Tim Abbott a493694e10 reload: Clean up handling of invalid reload tokens.
Previously, we'd log an exception whenever an invalid hashchange
reload token appeared, which is probably a bit excessive given that
this can happen without anything being wrong.

We instead just log something for debugging in the blueslip log and
make sure the #reload hash is cleared.
2017-05-04 16:16:35 -07:00
Tim Abbott f207450cdb presence: Avoid throwing exceptions for "missing users" when offline.
This should eliminate the most common javascript traceback one gets
running Zulip in production.
2017-05-04 16:11:05 -07:00
Tim Abbott a28f5db050 presence: Check for unsuspend status on receiving responses.
This is the first part of handling an annoying race that would cause
us to try drawing the right sidebar using (in part) users that we
haven't learned about yet (because we were offline/suspended when they
were created, and we haven't quite realized our event queue is gone yet).
2017-05-04 16:11:05 -07:00
Tim Abbott b0bd501c0d portico: Remove now-unused hello-footer code. 2017-05-04 16:09:12 -07:00
Brock Whittaker d21e1ccc1c Unify styling on password reset flow pages. 2017-05-04 16:09:12 -07:00
Brock Whittaker 55b1d480ec Fix avatar sizing issue.
The avatars were previously their natural width, however the avatars
should always be 100% width since the height and width of the images
are known to always be equal.
2017-05-04 16:09:12 -07:00
Brock Whittaker 736701f900 Add account_send_confirm styling. 2017-05-04 16:09:12 -07:00
Brock Whittaker 48ac49385e Fix lack of uniformity with box content layout.
The various portico pages had various styling differences that made
them less consistent when responsive.
2017-05-04 16:09:12 -07:00
Brock Whittaker 89242da269 Remove .footer_padder in favor of proper screen tolerances.
This removes the .footer_padder element in favor of just having correct
min/max heights and margins on the footers.
2017-05-04 16:09:12 -07:00
Brock Whittaker 58d00af6c3 portico-pages: Fix flex height issues with content.
This fixes the existing issue where the titles of content is chopped
off when the screen height is too small.
2017-05-04 16:09:12 -07:00
derAnfaenger 37a8a43cc4 Change cursor to pointer when hovering over streams.
Before this commit, hovering over the blank area of a stream
would not reflect its "clickability". This behavior is
inconsistent with other clickable lists, such as the user sidebar.
This commit changes the cursor to a pointer when hovering over a
stream and removes annoying pointer-default-pointer changes when
hovering with the mouse over multiple users in the user sidebar.
2017-05-04 15:55:51 -07:00
Brock Whittaker ed4866b9f9 message-feed: Improve scroll perf by removing scaling on emojis.
This removes scaling from the emojis by changing the background size to
a lower value and then allowing for the widths and heights of the
emojis to be proportionally smaller.

The transform: scale property would cause many more repaints in Chrome
and other browsers than should have been necessary which would render
messages above and below the feed light grey boxes that would
momentarily flash as blank before filling with content.

Modified by tabbott to use a percentage in the background-size.

Fixes #4660.
2017-05-03 14:49:47 -07:00
Tim Abbott b20a24875a emoji: Switch to using iamcal sprite sheets for reactions and pickers.
Without changing how we render emoji in messages or changing the data
set used for emoji names, this switches us to the superior
percentage-based system for choosing which emoji from the spritesheet
to select and the iamcal sprite sheets.

It requires some small changes to CSS to ensure emoji are centered
properly in the new design.

Based on Harshit Gupta's work on "Interrelated emoji infrastructure changes".
2017-05-03 13:30:42 -07:00
Tim Abbott ddd3bbd32c echo: Separate realm emoji formatting from normal emoji. 2017-05-03 13:28:50 -07:00
Cory Lynch 5d6724345a Fix scrollbar stylining for reactions picker.
Scrollbar previously collapsed when searching for
emoji and became misaligned. Fixed in CSS.
2017-05-02 14:23:26 -07:00
Tim Abbott 07db233ffd register: Remove long-unused company-email HTML/CSS. 2017-05-01 17:18:03 -07:00
Rohitt Vashishtha 47eb19331d ux: Display error on login/registration if no auth backends are enabled.
Also makes a small tweak to CSS to ensure the styling is consistent on
the two pages.

Fixes #4525.
2017-05-01 17:17:37 -07:00
Brock Whittaker 2fafc6bec5 Change streams subscriber lists to render progressively. 2017-05-01 16:56:54 -07:00
Brock Whittaker 4e980ad545 Change <thead> styling in settings containers.
Tables were previously improperly using the <tbody> to show the headers
so it was not obvious that the styling for <thead> did not represent
the styling of the rest of the tables anymore, so this normalizes
the styling to be consistent with how it looked when the first row
was in the <tbody>.
2017-05-01 16:56:54 -07:00
Brock Whittaker 0ffdfa3699 Change from `toLowerCase` => `toLocaleLowerCase`.
This now respects the locale of the string set and will lowercase it
respective of the character set rather than standard latin/English.
2017-05-01 16:56:54 -07:00
Steve Howell 23df948457 left sidebar: Scroll to newly pinned streams.
If we pin a stream, we now scroll up as needed to make sure the
stream is still in view after pinning it.  (Note that we don't do
this in the un-pinning case, since users un-pinning stuff may be
doing cleanup on pinned streams they no longer care about.)

Fixes #1714.
2017-05-01 16:39:37 -07:00
Steve Howell 07633b3872 left sidebar: Scroll to newly activated streams.
When we activate a stream (or one of its topics), we now scroll
the sidebar so that the stream comes into view.  We scroll it
just enough to get it to the top or the bottom, depending on
where it had been offscreen before.
2017-05-01 16:39:37 -07:00
Brock Whittaker f599b517d3 Switch checkbox styling to new style in #invite.
The checkboxes in invite are now converted in this commit to the new
style.
2017-05-01 16:01:36 -07:00
Brock Whittaker 3ff55034fe admin: Restyle administration checkboxes to match new style.
This restyles the administration checkboxes to look similar to those
that are currently present in the settings section.
2017-05-01 16:01:36 -07:00
Tim Abbott f4262e0169 message_edit: Fix exception closing "view source".
This fixes a regression introduced in
81a575e4d5.
2017-05-01 15:08:01 -07:00
Tim Abbott 03b7be17a6 settings: Fix unnecessary/ugly exclamations in error messages.
The previous code would produce errors of the form "Failed!: ...".
2017-05-01 14:50:20 -07:00
K.Kanakhin f13d6a18eb realm-emoji: Add realm emoji uploading instead url providing.
- Add file_name field to `RealmEmoji` model and migration.
- Add emoji upload supporting to Upload backends.
- Add uploaded file processing to emoji views.
- Use emoji source url as based for display url.
- Change emoji form for image uploading.
- Fix back-end tests.
- Fix front-end tests.
- Add tests for emoji uploading.

Fixes #1134
2017-05-01 14:50:20 -07:00
Tim Abbott 0785c377a4 zephyr: Fix link to webathena login from error bar.
This was apparently broken when we moved the webathena login errors
out of the right sidebar.
2017-04-30 21:31:25 -07:00
Tim Abbott cfeff245c1 emoji: Manage Zulip emoji as a custom/extra realm emoji.
This is prerequisite for converting our emoji system to work off of
iamcal sprite sheets.

Also, fixes #4308.
2017-04-30 16:40:31 -07:00
Tim Abbott 5321e2e2c1 hotkey: Reorder compose and emoji picker escape handlers.
This fixes an issue where escape could close the compose box, not the
compose emoji picker.
2017-04-30 15:15:33 -07:00
Jack Zhang df817f12f4 emoji: Rename reaction-popover to emoji-popover.
The name emoji-popover should now be more appropiate, as there's no more
need to distinguish between reacting to messages and composing messages.
2017-04-30 15:15:33 -07:00
Jack Zhang a9505654da emoji: Replace the old compose emoji picker with the reactions picker.
This removes the old compose emoji picker in its entirety, changing
the few callbacks needed to launch the reactions-style emoji picker
instead and hook it up properly.

Callbacks for reactions and composing messages are distinguished by
selecting for, respectively, the .reaction and .composition classes.

Fixes #4122.
2017-04-30 15:14:42 -07:00
Jack Zhang 58a92a0eff emoji: Extend reaction_popover_content template for compose. 2017-04-30 15:09:43 -07:00
Tim Abbott 87d06268ca toggle_reactions_popover: Support being passed no message ID.
This is intended to facilitate calling this function for the compose
picker, where there is no message yet.
2017-04-30 15:08:51 -07:00
Jack Zhang 3c257a19c0 emoji-picker: Extract generate_emoji_picker_content.
This is a pure refactor, with no functional changes.
2017-04-30 15:02:12 -07:00
Tim Abbott 66f927762b emoji_picker: Extract compute_placement function.
Thanks to Jack Zhang for identifying this useful refactoring.
2017-04-30 14:41:54 -07:00
Jack Zhang f8b3ce7d15 emoji: Move all emoji picker logic/events into emoji_picker module.
Added emoji_picker.js to static asset pipeline.
2017-04-30 14:13:36 -07:00
Aditya Bansal cab87fef2a Refactor: Extract default-language-modal to be a partial.
We are doing this refactor for the sake of keeping our template
consistent with the indentation policy and maintaining its
readability at the same time.
2017-04-29 08:35:25 -07:00
fionabunny 78f2df5649 home.py: move initial_pointer as pointer to register_ret.
This is the last of the fields in page_params that could come from
register_ret but wasn't doing so.
2017-04-28 23:39:14 -07:00
fionabunny d3e7e6542a home.py: move user_profile full_name to register_ret.
Move the user_profile data section down into fetch_initial_state_data
so it entirely pulls from register_ret for #3853.
2017-04-28 23:31:28 -07:00
Tim Abbott df8f4a837c home: Get page_params.enable_desktop_notifications from register_ret. 2017-04-28 23:15:35 -07:00
Tim Abbott c4eeb13353 account-settings: Always display the medium-size avatar. 2017-04-28 23:09:32 -07:00
fionabunny 4696819629 Restructure format of avatar events and push into register_ret.
This moves the avatar_ fields in page_params to come from
register_ret.  Unlike many fields, changing this had a bit of
complexity, because the avatar update events didn't actually contain
some of the details required for moving these into register_ret to
work correctly without races.

We fix that as part of this change.

Modified significantly by tabbott.
2017-04-28 23:04:01 -07:00
Tim Abbott 2a16cc1d24 home: Get enable_stream_desktop_notifications from register_ret. 2017-04-28 22:01:46 -07:00
Tim Abbott 2a8a101fe2 home: Get page_params.enable_stream_sounds from register_ret. 2017-04-28 21:56:58 -07:00
Tim Abbott 30db811167 home: Get page_params.enable_sounds from register_ret. 2017-04-28 21:54:05 -07:00
fionabunny 78bcbc79d6 home.py: move people_list as realm_users to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:33:33 -07:00
fionabunny 7db8c61aac home.py: move event_queue_id as queue_id to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:33:17 -07:00
Tim Abbott 27f07e6a99 activity: Remove page_params.presences after use.
This is just meant to avoid there being any confusion about whether
this field does anything after this point.
2017-04-28 21:31:19 -07:00
fionabunny 453fc06686 home.py: move initial_presences as presenses to register_ret.
Simplify the page_params generation logic #3853.
2017-04-28 21:30:29 -07:00
fionabunny 84c4d67916 home.py: move bot_list as realm_bots to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:24:44 -07:00
fionabunny a7192f4334 home.py: move neversubbed_info as never_subscribed to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:24:44 -07:00
fionabunny 5676eaab50 home.py: move unsubbed_info as unsubscribed to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:24:43 -07:00
fionabunny 26d080cf64 home.py: rename subbed_info and move to register_ret. 2017-04-28 21:24:43 -07:00
fionabunny b7c6d46bf9 home.py: move password_auth_enabled as realm_password_auth_enabled.
Part of #3853.
2017-04-28 21:23:48 -07:00
fionabunny 635a05fe80 home.py: move name_changes_disabled as realm_name_changes_disabled.
This appears to have been partially completed prior.  Part of #3853.
2017-04-28 21:12:23 -07:00
fionabunny 70fe2eab60 home.py: move is_zephyr_mirror_realm as realm_is_zephyr_mirror_realm.
Part of #3853.
2017-04-28 21:12:16 -07:00
fionabunny 935ddf3b17 home.py: move show_digest_email as realm_show_digest_email.
Part of #3853.
2017-04-28 21:12:10 -07:00
fionabunny 64041e0da1 home.py: move mandatory_topics as realm_mandatory_topics to register_ret.
Part of #3853.
2017-04-28 21:12:05 -07:00
fionabunny 6d2785c853 home.py: move domains as realm_domains to register_ret.
Part of #3853.
2017-04-28 21:11:56 -07:00
Cory Lynch e972453a73 message edit: Remove Topic and Content labels.
Removed the components from the template and
cleaned up the relevant css.

Fixes #4562
2017-04-28 20:57:06 -07:00
Steve Howell 4762673929 Fix how we calculate fields in stream_data.js.
We used to have code scattered in multiple places to
calculate things like admin options, preview urls,
subscriber counts, and rendered descriptions for
streams before we rendered templates in the "Manage
Stream" code.

These are all consolidated into a new function
called stream_data.update_calculated_fields().

This is mostly code cleanup, but it also fixes a bug where
the "View Stream" button would not work for a newly created
stream.
2017-04-28 17:49:33 -07:00
Rafid Aslam 7b2ef7c1a9 compose: Validate subscriptions in browser when !autosubscribe.
This doesn't quite complete the goals of #4650, which has a plan for
how to remove this entirely, but it causes this problematic code to
now be contained to a very rare case.

Refactored significantly by tabbott just due to rebase age.

Fixes #3629.
2017-04-28 17:46:15 -07:00
Tim Abbott 3f1df50c7b compose: Remove unnecessary check_stream_existence wrapper.
This function had become just an empty shell.
2017-04-28 17:41:12 -07:00
Tim Abbott e0954d8811 compose: Refactor check_stream_for_send error handling.
The extra lines in removed were already part of compose_error.
2017-04-28 17:41:02 -07:00
Cory Lynch 0965c43238 Add typeahead for syntax highlighting languages.
Modified composebox_typeahead.js to recognize the triple backtick
and tilde for code blocks, and added appropriate typeahead functions
in that file and in typeahead_helper.js.

Additionally, a new file pygments_data.js contains a dictionary of
the supported languages, mapping to relative popularity
rankings. These rankings determine the order of sort of the
languages in the typeahead.

This JavaScript file is actually in static/generated/pygments_data.js, as it
is generated by a Python script, tools/build_pymgents_data.py. This is
so that if Pygments adds support for new languages, the JavaScript file
will be updated appropriately. This python script uses a set of popularity
rankings defined in lang.json.

Corresponding unit tests were also added.

Fixes #4111.
2017-04-28 17:22:59 -07:00
Steve Howell 5965dc092a Move check_stream_existence() to compose.js.
The function check_stream_existence() temporarliy got moved
to stream_create.js, and our call from compose.js was still trying
to find it in subs.js.  Now we move the function to compose.js,
since we no longer use it stream_create.js.

This function is pretty dubious, and we may want to only check
for duplicate stream names locally.
2017-04-28 16:17:52 -07:00
Steve Howell d999827465 Improve how we report errors when we name new streams.
When the user creates a stream, we no longer do a synchronous
check on the back end to find if the stream name already exists.
Instead, we only check our local data, which will prevent many
typical errors, and then we let the back end capture duplicates for
stream names that the client doesn't know about.

We also tone down errors when the stream name is blank--we
only whine about empty streams right before submitting the form.

Also, since our check for duplicate streams is less expensive,
we now capture the "input" event instead of the "focusout" event,
so that if you fix up the name to avoid a collision, you get more
immediate feedback.

When we do detect stream name errors, we conveniently focus the
text field to let the user correct the problem.
2017-04-28 16:17:52 -07:00
Rishi Gupta cf90fed418 stats: Remove users_today from Active Users.
It's technically the number of users yesterday. Also, "number of active
users today" suggests something like daily actives today, whereas this graph
currently shows 2-week actives.
2017-04-28 16:15:07 -07:00
Tim Abbott a0e276c54a settings: Fix autocomplete in email change form. 2017-04-28 14:39:18 -07:00
Tim Abbott 6c9daf7c3b alerts: Clean up network error messages a bit. 2017-04-28 12:58:30 -07:00
Brock Whittaker c7cb20d873 alerts: Polish .alert-box .alert styling.
This polishes the styling on the alerts inside of the .alert-box to
have more appropriate colors, margins, and padding.
2017-04-28 12:50:04 -07:00
Cory Lynch ba7b7a9a36 Change edit_message_content to have unique IDs for different messages.
Fixes bugs of when multiple messages are being edited simultaneously.
Specifically, typeahead is no longer broken, copying messages to clipboard
is less buggy, and resizing is no longer
broken when multiple messages are being edited.
2017-04-28 12:15:34 -07:00
Cory Lynch 81a575e4d5 Add cleanup for resize listeners on message editing.
I changed the watch_manual_resize function to return the listener
functions it creates, and then these are used to remove the event
listeners before the edit box is hidden.
2017-04-28 12:15:34 -07:00
Cory Lynch f9d1bff167 Fix textarea resize for editing messages.
Reusing code from the main compose_message component so that resizing now
behaves correctly. This means that when the user tries to resize vertically,
the autoresize code is disabled, and the textbox reverts to manual resizing.
Fixes #4573
2017-04-28 12:15:34 -07:00
Brock Whittaker dcc2b3a900 left-sidebar: Restructure <a> to cover the <li>.
This restructures the <a> tag to be clickable essentially anywhere
within the <li> tags, unlike before where due to it being “inline”, you
had to hover over the text in particular.
2017-04-28 09:56:15 -07:00
Brock Whittaker e7ac6710e9 Resize <li> text and align icons.
This resizes the text of the line items to be 5% larger and aligns
the #global_filters icons to be centered vertically.
2017-04-28 09:56:15 -07:00
Steve Howell 0ced7cfc55 Make newly subscribed streams appear active.
When you subscribe to a stream, we now set a newly_subscribed
flag on the object, and we return true during the is_active()
call.

This solves the problem that immediately after you subscribe, you
don't have any messages in the stream, so it would appear active
by our old criteria.

This is still something of a workaround, as once you reload, the
stream will become inactive again, unless other messages come in.

A more permanent solution here would be to have the backend
indicate newly subscribed streams to us (apart from the initial
event), but we may not really need that in practice.
2017-04-28 07:40:25 -07:00
Steve Howell f9b3ff8f68 Change argument type for stream_data.is_active().
The function now takes a "sub" object instead of a stream
name.
2017-04-28 07:39:52 -07:00
Brock Whittaker 7afbc9ddd6 Redesign login and registration pages.
This completes a major redesign of the Zulip login and registration
pages, making them look much more slick and modern.

Major features include:
* Display of the realm name, description and icon on the login page
  and registration pages in the subdomains case.
* Much slicker looking buttons and input fields.
* A new overall style for the exterior of these portico pages.
2017-04-26 18:04:05 -07:00
Brock Whittaker 6e512dddcb left-sidebar: Make <li> height and icon size consistent.
This makes the height of the list-items all 24px and changes
the home icon to be a slightly larger 16px instead of 14px which
looked visually smaller than the other icons.
2017-04-26 17:13:03 -07:00
Cory Lynch 088d881159 compose: Improve ordering in streams typeahead.
The new logic has 4 tiers of priority:
* Whether a match is found in the name, start of description, middle
of description, etc.
* Importance to the user / activity -- more specifically, the order
used in the left sidebar. This means pinned streams first, active
streams, then inactive streams.
* Subscriber count: How big is the stream?  Bigger is better.
* Alphabetical ordering is a final tiebreak.

Fixes #4508.
2017-04-26 12:46:14 -07:00
Brock Whittaker 2fce6a4dc3 message-feed: Fix message drag uncaught errors.
There is a mechanism to prevent a user from "clicking" on a message
if they drag over it, to allow people to copy message contents without
triggering the compose box to open.

In the case that a user would start dragging from outside a message
and finish dragging within a message, data on where the cursor started
at is missing.

This is fixed by checking if start data exists and if it doesn't, we
just throw a drag distance of Infinity which will tell the program to
not count the action as a "click" on the message. This now does not
have an uncaught error because it instead validates "start" as existing
before attempting to access its properties.
2017-04-26 12:31:14 -07:00
Tim Abbott 5d7aa4fae7 hashchange: Fix buggy narrowing to wrong message.
Due to a past refactoring, the from_reload argument to do_hashchange
changed from having true/undefined as the possible values to
true/false instead.  The check that sets the from_reload and
first_unread_from_server narrow options was thus incorreclty treating
from_reload of false the same as a from_reload of undefined.

As a result, if the browser had been loaded with a
page_params.initial_narrow_pointer (aka via the background reload code
path), then for the duration of that browser session, every time one
narrowed via a hashchange rather than an explicit click handler (which
apparently includes clicking on a PM thread in the left sidebar), we'd
end up narrowing with a then_select_id of the that initial narrow
pointer, not the correct first unread message.

The fix is simply changing the check for truthiness, not undefined, in
do_hashchange.
2017-04-26 12:07:56 -07:00
Umair Khan f4a9651346 reload: Garbage collect previously preserved state.
This fixes a minor local storage data leak.

Fixes: #4545.
2017-04-26 09:14:46 -07:00
Umair Khan 58a82e7c55 localstorage: Allow regex based delete. 2017-04-26 09:11:44 -07:00
Aditya Bansal e961d6a834 Clean account-settings.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal 6f49579e65 Clean actions_popover_content.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal acef0b1f32 Clean bot_avatar_row.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal ae2585ac8d Clean admin_user_list.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal af880b8bab Clean ui-settings.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal 73cd6948de Clean realm-filter-settings-admin.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal d5bb128f56 Clean notification-settings.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal 338c2d618a Clean display-settings.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal a2d0976002 Clean deactivation-user-modal.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Aditya Bansal 4219bec14f Clean auth-methods-settings-admin.handlebars to use 4 space indents. 2017-04-26 00:16:22 -07:00
Tim Abbott b43385ec34 Shrink max display width of topics.
This fixes an issue with topic names overlapping in the left sidebar.
While we're doing that, it makes sense to shrink the maximum size of
the topic input box, to discourage sending with topics that will be
cut off.
2017-04-25 17:51:47 -07:00
Brock Whittaker 3d64d190c1 Change right sidebar unread counts to be rounded.
This changes the right sidebar unread count styling to match the left
sidebar styling — in that they all now should have a 4px border radius
on the edges of the unread count blocks.
2017-04-25 17:47:36 -07:00
Brock Whittaker c506a92d05 left-sidebar: Restyle to have new look.
This restyles the color swatches to either be locks or hashes,
and changes the notifications to be rounded rather than squared.
2017-04-25 17:47:36 -07:00
digi0ps 8fb9d2bff3 settings: Redesign settings/administration panel buttons.
This redesigns all the ugly bold-colored buttons in the settings and
administration pages.
2017-04-25 16:33:59 -07:00
Cory Lynch 0d9b77c8b7 composebox_typeahead.js: Add typeahead cancelling for '# '.
If somebody types '# ', then close the typeahead dialog and
don't autocomplete. Relevant node tests were also added.

Fixes #4505.
2017-04-25 15:55:23 -07:00
digi0ps 1cc9cb969b sidebar: Make topic name width consistent. 2017-04-25 11:58:33 -07:00
digi0ps eb852ef19e sidebar: Move chevron in the stream list further from the scrollbar.
Previously, the chevrons were too close to the scrollbar. This commit
fixes that by moving it farther from the scrollbar.
2017-04-25 11:58:33 -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
Steve Howell ca2aea8d01 Extract stream_create.js.
This new modules handles the UI to create streams.  It mostly moves
code from subs.js.

It introduces an API around what used to be called meta.stream_created:

    reset_created_stream()
    set_name()
    get_name()

It only partially moves new_stream_clicked().
2017-04-25 09:57:32 -07:00
Cynthia Lin ef2ff9f9a0 integrations: Remove deprecated Stash integration. 2017-04-24 22:35:23 -07:00
Harshit Bansal 6cb03ea78e frontend: Add UI necessary to change emoji set.
Note that this code is disabled until the infrastructure for the
feature can be finished.

Tweaked by tabbott to use slightly cleaner names for the various sets.
2017-04-24 22:31:30 -07:00
Brock Whittaker ba51c077be Add assets for portico signin pages.
This adds some of the required assets for the portico signin pages such
as logos and validation signals.
2017-04-24 16:19:18 -07:00
wangjames 744f4aa663 Fix modals dependency cycle.
This commit forces the files that create modals to create their own
modal closing function instead of creating all of them in the modals
file. These functions are then passed to the modals.close object. This
is intended to remove modals.js's dependencies on these other files.
2017-04-24 14:30:02 -07:00
Steve Howell c999bdf823 compose: Distinguish get_message_type() from composing().
We now only call compose_state.composing() in a boolean context,
where we simply care whether or not the compose box is open.  The
function now also returns true/false.

Callers who need to know the actual message type (e.g. "stream" or
"private") now call compose_state.get_message_type().
2017-04-24 12:42:06 -07:00
Steve Howell d938afaedc Extract narrow.narrow_to_next_topic().
This borrows some code from a PR from Mahim Goyal.
2017-04-22 11:46:47 -07:00
Shayan Toqraee 534c951ec4 Add rtl.js library for detecting direction of text.
This comes complete with some documentation and node tests, and is a
key step towards implementing RTL support in Zulip.
2017-04-22 11:25:54 -07:00
Steve Howell ddbe877909 Add narrow.stream_topic(). 2017-04-21 21:59:22 -07:00
Steve Howell 6ddbf12376 Add topic_generator.get_next_topic(). 2017-04-21 21:59:22 -07:00
Steve Howell 079885770b Add unread.topic_has_any_unread(). 2017-04-21 21:59:22 -07:00
Steve Howell 4871b491f3 Add Dict.is_empty(). 2017-04-21 21:59:22 -07:00
Steve Howell b27180a645 Have next_topic() return stream/topic objects.
We now use "map" to have our inner generator of topics be
mapped to objects with both the stream and topic.  Thanks to
Mahim Goyal for helping with this design.
2017-04-21 21:59:22 -07:00
Steve Howell d332df8cc6 Add topic_generator.map(). 2017-04-21 21:59:22 -07:00
Tim Abbott f4a4c23380 KaTeX: Fix path to KaTeX bundle in production. 2017-04-21 14:56:19 -07:00
Tim Abbott 7d8d9c1bf9 Fix message-edit animations being displayed after sending.
This fixes a regression in 3041480600
that would cause anything rendered on the backend differently than on
the frontend to experience this animation.

We actually only want to do the animation when the message content was
changed in a way that generates an edit history event, i.e. a
user-facing edit, not in cases where we're either transparently
swapping in post-backend-rendering content (e.g. with link previews)
or cases where there's a discrepancy between the exact HTML from the
frontend and backend markdown processes (e.g. mentions).
2017-04-21 11:46:35 -07:00
Steve Howell cc6c0104c8 Refine compose box behavior for topic narrows.
The comments that were added in the code for this commit explain
the cases here, but essentially for topics, we need to decide
among a few possible behaviors with regard to composing:

- Leave it closed.
- Cancel the compose.
- Leave the compose box as it was before.
- Fill in the new topic.

Before this commit, we were cancelling compose in all cases (or
leaving it closed).

Now we leave it alone in some cases where there is already content.
And we fill in the topic when the stream was correct and the topic
was empty.

Fixes #3300
2017-04-20 16:15:07 -07:00
Tim Abbott b3c8562bd9 css: Remove use of under-specified 'thin' borders.
This was causing buggy behavior in our emoji reactions when zoomed to
200%.
2017-04-20 15:07:26 -07:00
Tim Abbott f3c36147d9 /me: Fix alignment of name with non-/me messages. 2017-04-20 14:58:22 -07:00
Brock Whittaker 83d51b2bdb Hide status message on edit.
When editing a /me, the status message element should be hidden.
2017-04-20 14:36:17 -07:00
Brock Whittaker 323ff6edca /me: Fix presentation and markup for /me statuses.
This fixes the /me elements to be display inline-block and inline
rather than display block with top and left properties.

This also fixes an unrelated issue with emoji reactions not being
able to be clicked on with /me messages.

Fixes: #4218.
2017-04-20 14:36:17 -07:00
Joshua Pan 728594c74a activity.js: Stop opening compose box in user search.
This prevents compose box from opening when you
just press enter with an empty search field in
user search.

Fixes #4376.
2017-04-19 22:18:08 -07:00
Brock Whittaker 3041480600 message-edit: Fade in message on update.
When a message update comes back from the server and replaces an
old message, it should fade in. There are two components to the fade:

1. The message fades in from opacity: 0 =>  1.
2. The "edited" text will transform from X: -10 => X: 0.
2017-04-19 22:14:58 -07:00
Steve Howell c7a9a02667 Consolidate code for narrow/compose interactions.
This commit extracts the method compose_actions.on_narrow()
to handle changing the compose box (as appropriate) after
any narrowing action.

This change should be mostly non-user-facing, but it's not
exactly a trivial extraction.

For the case where the user already had content in their
compose box, we continue to leave the compose box alone,
but we now update compose fading 150+ lines later in
narrow.activate().

Likewise, for cases where we cancel composing, this will
also happen later in the function.

Finally, for PM narrows, where we auto-open the compose box, we
no longer call compose.cancel() before calling compose.start(),
because either a) the compose box would have not been open
in the first place or b) the start() function can handle
clearing the old fields.
2017-04-19 10:06:00 -07:00
Tim Abbott 326cf9a73e stream_list: Add divider before dormant streams in list.
Fixes #4309.
2017-04-19 09:18:29 -07:00
Steve Howell 7962710132 Remove 40-streams criterion for flagging dormant streams.
Before this change, we would move "dormant" streams to the bottom
of your stream sidebar, but only if you had 40+ streams.

Now we do this in all cases to be more consistent.

This commit also changes the redraw strategy when we remove rows.
Before this change, we were doing incremental updates, but now we
call build_stream_list to do a complete rebuild.  This was partly
motivated by adding the new divider, which would have complicated
the incrememental approach when you removed the last remaining
dormant stream.
2017-04-19 09:18:18 -07:00
Steve Howell 9591b3a95b Extract stream_sort.js. 2017-04-19 09:16:37 -07:00
Joshua Pan 4fb450d4a9 hotkey.js: Add reactions popover navigation.
Fixes #4197.
2017-04-18 23:25:45 -07:00
Joshua Pan a7327422a8 reaction.js: Create reaction_navigate(). 2017-04-19 06:17:15 +00:00
Joshua Pan abda711c66 reaction.js: Extract reaction_show_list functions.
This creates get_emoji_at_index() and
find_index_for_emoji() functions, which search for
emojis and indices in reactions_show_list. Update
maybe_select_emoji with newly created functions.
2017-04-19 06:17:15 +00:00
Joshua Pan e075c84ca5 reaction.js: Maintain reaction_show_list.
This updates reaction_show_list whenever the popover
gets opened and whenever the search filter for reactions
gets used.
2017-04-19 06:17:15 +00:00
Joshua Pan cd28ea6d07 reaction.js: Update toggle_reaction().
Created get_selected_emoji() function.
toggle_reaction() now doesn't require emoji_name
and automatically looks for a selected_emoji
if possible.
2017-04-19 06:16:30 +00:00
Tim Abbott 540bfce83f reactions: Use perfectScrollbar for emoji reactions scrollbar.
This fixed the fact that the scrollbar for this popover was super ugly
on Linux, while also ensuring that we have a consistent 6 emoji per
row in the popover (an important detail for the arrow hotkeys).
2017-04-18 22:58:11 -07:00
Joshua Pan c6d0e49cdf Add tabindex to reaction popover content handlebars. 2017-04-18 22:31:08 -07:00
Steve Howell 70b7d4c00b Extract compose_state.js.
This is mostly just moving methods out of compose.js.

The variable `is_composing_message`, which isn't a boolean, has
been renamed to `message_type`, and there are new functions
set_message_type() and get_message_type() that wrap it.

This commit removes some shims related to the global variable
`compose_state`; now, `compose_state` is a typical global
variable with a 1:1 relationship with the module by the same
name.

The new module has 100% line coverage, most of it coming
via the tests on compose_actions.js.  (The methods here are
super simple, so it's a good thing that the tests are somewhat
integrated with a higher layer.)
2017-04-18 12:26:58 -07:00
Tejas Kasetty 7e4155cd42 update_emojis: Handle the case involving deletion of realm emoji. 2017-04-18 12:18:52 -07:00
Tejas Kasetty d227a8e35c compose: Re-render emoji picker when realm_emoji is added/deleted.
* reset the emoji popover in case of an event
regarding update of realm_emoji.
* test-node-with-js: Add dependency - popovers module;
In dispath.js to support popovers object.
2017-04-18 12:18:52 -07:00
Tejas Kasetty b7aa81f122 compose: Render the emoji picker only once.
* Whenever the emoji picker is opened a call is made to render
  the emoji's. This rendering happend everytime the emoji picker
  was opened. Thus, resulting in duplicates of emoji's getting
  appended in the emoji picker over multiple open and close.

* This commit, is a fix to render the emoji's only once when the
  emoji picker is opened for the first time. Further calls just
  toggles the emoji picker showing the already rendered emoji's.
  This enhances the performance of Emoji picker considerably
  because there is no overhead of making a request to get the emoji's
  from the server, each time the emoji picker is opened.

* Other changes -- on closing the emoji picker, the compose box
  remains in focus.

Fixes: #4300.
See Also: #3952.
2017-04-18 12:18:52 -07:00