Commit Graph

4291 Commits

Author SHA1 Message Date
Steve Howell c5d95a2db8 stream list: Rename method to scroll_stream_into_view.
The old name was scroll_to_active_stream, but it can be used
when pinning a stream, so "active" isn't necessarily accurate.
2017-08-11 13:01:39 -07:00
Steve Howell 9201137059 Fix scrolling glitches when zooming out to streams.
If you go into "more topics" for a stream with many topics,
and then scroll down, and then zoom out again with "All
streams", we make sure the active stream is still in view.
2017-08-11 13:01:39 -07:00
Steve Howell 9dd78c803c Make auto-scrolling less aggressive.
We have code that can automatically scroll an element into "view"
in its container.  We use this for stream sidebar rows inside the
stream list.

Generally the stream sidebar rows are small enough to fit into
the container, and the prior algorithm worked correctly for that
scenario.

If you have lots of topics, however, and a short screen, the
algorithm was being too aggressive.  For example, if the top
wasn't showing, it would scroll the top into view, but at the
cost of scrolling the bottom out of view.

This fix makes the general scrolling algorithm more tame.

Part of the user-facing problem is that the element we pass
into the scrolling code for the stream sidebar rows is bigger
than the part of the row that actually should be shown on
screen.  Nevertheless, it makes sense here to make the general
algorithm more robust.
2017-08-11 13:01:39 -07:00
Steve Howell c11c5c3795 Extract stream_list.scroll_delta() and add tests. 2017-08-11 13:01:39 -07:00
Steve Howell 5608dc0add Fix bug with topic edits on read messages.
If you read a message, then got a topic edit for it, we were
adding the message to our data structure of unread stream/topic
messages.

Now we guard against this in unread.update_unread_topics. I
no longer expose an update() method in unread_topic_counter,
since we really want to do the unread check at a higher level
to keep other data structures consistent.
2017-08-10 14:36:18 -04:00
Jack Zhang 93c1790d91 integration.js: Invoke adjust_font_sizing on all re-renders. 2017-08-10 10:21:53 -07:00
Jack Zhang c8c27ddcc7 Extract adjust_font_sizing into top level of integrations.js module. 2017-08-10 10:21:53 -07:00
Jack Zhang ffe14e339d Extract /integrations code from landing-page into separate bundle. 2017-08-10 10:21:53 -07:00
Jack Zhang 48e0c2565b Increase individual integration subpage sidearea width.
All category labels are kept to one line of text.
2017-08-10 10:21:53 -07:00
Jack Zhang feb52eb777 Decrease create-your-own integration tile font size on mobile. 2017-08-10 10:21:53 -07:00
Jack Zhang b85d3e28ce portico: Update display text for integrations categories dropdown.
Category 'All' -> text 'Filter by category'; icon chevron right when
the dropdown is closed, icon chevron down when the dropdown is open

All other categories -> text CATEGORIES[state.category]; icon chevron down
2017-08-10 10:21:53 -07:00
Jack Zhang 10bef65f00 i18n: Import localstorage module into translations.
localstorage.supported() breaks on portico pages, where
the localstorage variable is not exposed globally.

This change is coupled with this commit:
94a1070979 (diff-a15e4886338acf8091c948c25f47caaa)
2017-08-10 10:21:53 -07:00
Jack Zhang fc6c2b321b portico: Reimplement /apps routes using pushState. 2017-08-10 10:21:53 -07:00
Jack Zhang b255949501 Show integration categories on integration sub-pages. 2017-08-10 10:21:53 -07:00
Jack Zhang 0e41ace321 Hide deprecated integrations with legacy tag. 2017-08-10 10:21:53 -07:00
Jack Zhang 3e04062da1 Show name of integration in mobile single-integration view. 2017-08-10 10:21:53 -07:00
Jack Zhang d3cc201332 Refactor /integrations state, routing, and rendering logic.
A large portion of the diff for landing-page.js is due to refactoring the
contents of integrations_search into top level UI update functions.

State flows as follows: dispatch(action) -> render(state) -> update UI

Routes now use pushState instead of hashes.

On transition between categories scrolling position is fixed,
and on transition between catalog and integration sub-pages the page
scrolls to the top.
2017-08-10 10:21:53 -07:00
Jack Zhang c0328de03d portico: Load INTEGRATIONS and CATEGORIES page data. 2017-08-10 10:21:53 -07:00
Jack Zhang 5a87f90b24 landing-page: Replace detect_path with path_parts.
path_parts returns an array of all location.pathname's `chunks`,
the strings within the path, split by slash.
2017-08-10 10:21:53 -07:00
Jack Zhang cc54fe2e30 Move integrations dropdown click handler into integration_events. 2017-08-10 10:21:53 -07:00
Jack Zhang 63ad7b6769 Rename /integrations/doc API endpoint as /integrations/doc-html. 2017-08-10 10:21:53 -07:00
Brock Whittaker 00c44379e3 Replace Doctor on Demand logo with new logo.
This updates the logo for Doctor on Demand.
2017-08-10 10:19:44 -07:00
Vaida Plankyte 9548d4635a frontend: Remove IDs from alt value of inline images. 2017-08-10 09:43:43 -07:00
Brock Whittaker 41f395caf1 your-account: Change "no changes made" error to success.
This changes the alert error "Error changing settings: No new data
supplied" to "No changes made" as a success bar.
2017-08-09 19:46:43 -07:00
Brock Whittaker 4b4283550f lightbox: Fix incorrectly displayed avatar image.
The lightbox "v" shortcut should not show a user's avatar,
so this limits the scope of images it can choose to ones inside
of the `.message_content` div.
2017-08-09 14:33:00 -07:00
Brock Whittaker 2b45c17dbc /features/: Fix wave position.
On some monitors it appears as though there's a slight gap between
the bottom of the wave and the top of the section below. This moves
the wave down a pixel to ensure the gap disappears.

Fixes: #6064.
2017-08-09 13:52:22 -07:00
Steve Howell 9cad3a009f Add topic server history, but behind a feature flag.
You can now see full topic history if you set the flag
`feature_flags.use_server_topic_history` to `true`.
2017-08-08 17:07:09 -04:00
Steve Howell 3b88e592d0 Add topic_data.get_server_history().
This isn't connected to anything yet, but you can now get
all the historical topics for a stream by calling
topic_data.get_server_history().
2017-08-08 17:07:09 -04:00
Brock Whittaker 7d80e0c78c portico: Fix #registration padding.
This fixes the registration padding to not be really large. It was an
issue of margin + padding instead of using margin for both where the
result would be max(margin1, margin2).
2017-08-08 13:21:48 -07:00
Brock Whittaker 6a406e2b70 portico: Fix tables to be striped again.
This fixes tables to be in more of a compartment and striped again
(which they lost due toe the light grey background).
2017-08-08 13:21:48 -07:00
Brock Whittaker 9f2017c1aa portico: Unify with smaller box shadows.
This unifies components with smaller, more consistent box shadows.
2017-08-08 13:21:48 -07:00
Brock Whittaker 3d4198c681 Replace `String.prototype.startsWith` with `indexOf`.
This replaces the `startsWith` string prototype method with `indexOf`
because no versions of Internet Explorer support this feature, and
it really is not difficult to just use `indexOf` instead and check
whether the starting index of the full string is 0.
2017-08-08 12:06:32 -07:00
Brock Whittaker be33266f83 Make 4xx and 5xx pages full screen.
This makes the 4xx and 5xx pages full screen by changing the
`.error_page` div to be fixed and full screen height.
2017-08-08 11:58:22 -07:00
Greg Price 8ccd8a7d27 settings: Wait for i18n setup before rendering settings nav.
Much like the parent commit and 038a2c769, but this time for the
"Settings"/"Organization" nav at the upper-left of the settings overlay.
2017-08-07 18:22:51 -07:00
Greg Price ee3ead2744 ui: Wait for i18n setup before rendering hotkeys help.
Much like 038a2c769, but for the three tabs at the top of the
`?` help overlay for keyboard shortcuts.
2017-08-07 18:22:51 -07:00
Greg Price 8ab213e3e4 locale: Update Japanese strings. 2017-08-07 16:58:10 -07:00
Jack Zhang c69b5d7d65 hotkey: Add support for hotspots on enter. 2017-08-05 18:32:37 -07:00
Jack Zhang 04fda9e51f hotspots: Decrease default hotspot icon z-index to 100.
This keeps hotspot icons positioned at the front of the message
viewport but behind sidebars (i.e. the left sidebar has a z-index
of 103). Hotspots associated with elements outside of the message
viewport should be individually adjusted at the bottom of hotspots.css.
2017-08-05 18:32:37 -07:00
Jack Zhang 1e40665e51 hotspots: Debounce hotspot placement on UI updates by 10ms.
A small delay to ensure that the event (i.e. a click) has completed
and the UI has updated before hotspot icon and popover placement
is recomputed.
2017-08-05 18:32:37 -07:00
Jack Zhang 5ce0db9f43 hotspots: Add friendly whale illustration to popover. 2017-08-05 18:32:37 -07:00
Jack Zhang bbe8f73c23 popovers: Reimplement compute_placement.
compute_placement utilizes the dimensions of the viewport, viewport location of
an element, and dimensions of an element to determine if a popover will fit
horizontally and/or veritically given its orientation. The default placement
is now viewport_center, which displays the popover, without an arrow, in the
fixed center of the viewport.

This should be particularly useful for hotspots on mobile or large popovers
that contain a lot of content. The property hotspot.location.popover can be
optionally set to fix the orientation of a popover (most likely to
VIEWPORT_CENTER).
2017-08-05 18:32:37 -07:00
Vaida Plankyte ca19cb6900 frontend: Fix stream-creation aria-label assignment. 2017-08-05 18:11:27 -07:00
Vaida Plankyte ee23e6f118 frontend: Fix default_language_modal aria-hidden assignment. 2017-08-05 18:11:27 -07:00
Brock Whittaker 4321f1f2b4 /help/: Remove "| User Documentation" string in narrow windows.
This responsively moves the header so that it doesn’t push the login,
registration nav options to the next row.
2017-08-05 17:57:07 -07:00
Brock Whittaker ef3131c77b help: Change .header nav to be on top of page elements.
WARNING: This change affects all portico pages, but it looks better.
This makes the nav sit on top and have a subtle box shadow.
2017-08-05 17:57:03 -07:00
Brock Whittaker 22eb102a8e help: Change .markdown .content to be white. 2017-08-05 17:57:02 -07:00
Brock Whittaker 3f550a940b help: Impose a max width for the .markdown .content. 2017-08-05 17:57:00 -07:00
Tim Abbott c657db77e8 lightbox_canvas: Fix use of unsupported const. 2017-08-05 16:47:11 -07:00
Brock Whittaker e22920bef6 Fix lightbox zoom issues.
This fixes the lightbox zoom issues that occurred on some browsers
due to the units of `deltaY` being in lines rathern than pixels,
making it incredibly slow to zoom.
2017-08-05 15:47:34 -07:00
Steve Howell 541156792e Add /mark_all_as_read endpoint.
This change simplifies how we mark all messages as read.  It also
speeds up the backend by taking advantage of our partial index
for unread messages.  We also use a new statsd indicator.
2017-08-04 14:10:46 -07:00
Steve Howell eafd5a731a Remove dead code: messages.flags.send_force_collapse. 2017-08-04 13:31:26 -07:00
Steve Howell cc94d6179c Remove dead code: messages.flags.send_force_expand. 2017-08-04 13:31:26 -07:00
Steve Howell 437cabe34c Just use message.unread when rendering.
By the time we render messages, we will have set message.unread,
so we don't need to calculate it from flags.

We add a line to the local-echo path to make this explicit
in that code.
2017-08-04 13:31:26 -07:00
Steve Howell f81f9a26e8 Call message.set_message_booleans() in update_messages().
When we learn about updated message, a bunch of flag/boolean
fields concern us:

    starred
    mentioned
    alerted
    is_me_message

We now set booleans consistently with how we set new incoming
messages.
2017-08-04 13:31:26 -07:00
Steve Howell 187ec3a922 Set message.unread in set_message_booleans().
The sooner we make message.unread consistent with message.flags,
the better.
2017-08-04 13:31:26 -07:00
Steve Howell abe7f4cc40 Extract message_store.set_message_booleans().
We'll want to reuse this for message updates, and we'll eventually
want to bypass this for local echo.
2017-08-04 13:31:26 -07:00
Steve Howell ff54d52589 Extract message.set_read_flag().
This code adds 'read' to message.flags and sets message.unread
to false.

It's not clear that the boolean message.unread is used in any
meaningful way, but we set it to false to avoid confusion.  The
bankruptcy code was not doing this before.

Another quirk that existed before was that you could get two
'read' flags in a message when you declared bankruptcy.  It's
also plausible that this could happen if you marked a message
as read via two different ways.  It probably did not cause
user-facing bugs, but it would be confusing for troubleshooting.

Fixes #5032.
2017-08-04 13:31:26 -07:00
Steve Howell d5681556d5 Call unread.process_loaded_messages earlier when inserting.
We want to maintain the invariant that unread.js always knows
about unread messages as soon as they are loaded.
2017-08-04 13:31:26 -07:00
Steve Howell a07bd70449 Inline message_util.do_unread_count_updates(). 2017-08-04 13:31:26 -07:00
Steve Howell 7cae3fa916 Use bucketers in unread_topic_counter. 2017-08-04 13:31:26 -07:00
Steve Howell 66c2ca9a2a unread: Add make_bucketer().
This class encapsulates reverse lookups to make deletions
O(1).  It is also a bit smarter about not creating
throwaway objects, by avoiding setdefault.
2017-08-04 13:31:26 -07:00
Steve Howell 42f3b3ec00 unread: Add make_id_set().
This is a better abstraction for a set of ids, plus all the
dictionaries are kind of confusing.
2017-08-04 13:31:26 -07:00
Steve Howell 241f095213 Extract unread_ops.process_read_messages_event().
The new method borrows some code from the event loop
and unread_ops.mark_messages_as_read, and it is now
flexible about message_ids being marked as unread
even when there is no corresponding message in the
message store.  For that scenario we still want to
update our data structures, which wasn't happening
before this change.  (Generally, this was a non-issue
up until now, but it will become a bigger issue when
we start loading unread message ids from the server.)
2017-08-04 13:31:26 -07:00
Steve Howell 00a3f6b5f2 Extract process_newly_read_message(). 2017-08-04 13:31:26 -07:00
Steve Howell 8125667f90 Add unread.id_flagged_as_unread().
This function allows us to see whether unread.js thinks a message
id is unread (as opposed to looking at the message itself).  This
method is useful when we get notifications from the server that a
message has been read.  In the future, we may not actually have
a local copy of an unread message, but we'll still know that it is
unread based on page_params.  We'll want to update the data in that
case.

Going forward, we'll want to deprecate message.flags for most use
cases and just use the unread.js data structures to track unread
messages.
2017-08-04 13:31:26 -07:00
Steve Howell 5a10137ad9 Extract message_list.first_unread_message_id().
This de-duplicates code that solved the same problems using
two different phrasings.
2017-08-03 11:32:54 -07:00
Steve Howell c32b9a5d19 Remove dead code related to unread_in_current_view. 2017-08-03 11:32:54 -07:00
Steve Howell 325d7f0f57 unread: Simplify code to mark messages as read.
We now call the function mark_as_read(), and it only requires
passing in a message_id.
2017-08-03 11:32:54 -07:00
Steve Howell eac155d3b8 unread: Use reverse_lookup in unread_topic_counter. 2017-08-03 11:32:54 -07:00
Steve Howell 1927a6ca45 Simplify unread_topic_count.update().
The prior implementation was needlessly complex.  Both del() and
add() are cheap and idempotent.

With this change we no longer bother to delete a topic from a
dictionary when its last message is mark as read, since it doesn't
really help performance.  We add a line to the tests to maintain
100% line coverage.
2017-08-03 11:32:54 -07:00
Steve Howell fad4ed4e78 unread: Use reverse_lookup in unread_pm_counter.
This allows us to use simply a message_id to mark a PM as read.
2017-08-03 11:32:54 -07:00
Brock Whittaker f2b71ba12a subs: Make "All streams" link to appropriate hash.
This makes the “All streams” toggle bring the user to the hash
“streams/all” which saves their state.

Fixes: #5984.
2017-08-03 10:59:13 -07:00
Steve Howell e7cc7bba05 pm list: Avoid unnecessary id -> email conversion.
In a subsequent commit, we may have unread counts for
deactivated users.  There is no reason to fail hard on these
scenarios; if there is no list item for a user_ids_string,
updating the unread count should be a noop.
2017-08-02 09:40:47 -07:00
Steve Howell b446d96ed6 Add people.pm_lookup_key 2017-08-02 09:40:47 -07:00
Steve Howell 8a7397fef6 people.js: Explicitly sort user_ids numerically.
It's not always clear whether user_ids are strings or integers, so
we explicitly convert them to integers for sorting when creating
keys for PMs.

To keep the tests passing, this commit removes some unneeded
defensive code in message_store.js that only applies to contrived
test input.
2017-08-02 09:40:47 -07:00
Steve Howell b110f3bab3 Extract sorted_other_user_ids(). 2017-08-02 09:40:47 -07:00
Steve Howell b4c157c644 Extract unread.unread_mentions_counter.
This was extracted mostly for symmetry with the other two
counter classes in unread.js.  It's just a thin layer on top
of a Dict() object.
2017-08-02 09:40:47 -07:00
Vaida Plankyte 02d65a67af frontend: Edit confirm_continue_registration.html to be clearer.
Fixes #5707.
2017-08-02 08:51:25 -07:00
Brock Whittaker 334689ad51 Fix password reset alignment issue.
This fixes the password reset input box not lining up with the button.
2017-08-01 23:54:45 -07:00
Brock Whittaker 0b89561524 portico: Redesign the /features landing page.
This is a redesign of the features landing page from the current style
that includes the new sections in a grid format as well as some new
high-quality sections.
2017-08-01 23:39:44 -07:00
Rishi Gupta 31c011dfcc onboarding: Add picture to onboarding messages. 2017-08-01 22:47:57 -07:00
Rishi Gupta fbceba2b81 tutorial: Remove exports.start. 2017-08-01 22:38:22 -07:00
Rishi Gupta 51bc7801dd tutorial: Narrow to /is/private instead of pm-with welcome-bot.
Main reasons:
* Shouldn't be hardcoding welcome bot

* compose_actions.cancel() was not closing the compose box, for some
  reason. It was working fine before commit a few up from here ("tutorial:
  Remove rest of tutorial."), but I think possibly due to the fact that one
  had to click a button to exit the tutorial (that could be wrong, it was
  hard to pinpoint why it was working before that commit and not after.)

This code should be going away anyway once #5816 is resolved.
2017-08-01 22:38:22 -07:00
Rishi Gupta 0c665e9bbe tutorial: Remove unnecessary actions.
* .screen is no longer being changed by other parts of the tutorial
* first_run_message we don't need, since we're guaranteed to have a message.
* Changing to #home and narrow.deactivate are not needed since we're
  immediately narrowing to PM with welcome-bot.
2017-08-01 22:38:22 -07:00
Rishi Gupta 4f417700ef tutorial: Remove logic in start that is immediately undone in finale.
Setting stream colors and then setting them back, disabling and enabling
event handlers, and setting tutorial status twice.
2017-08-01 22:38:22 -07:00
Rishi Gupta 852bbfa16a tutorial: Remove tutorial_finale.
Was already orphaned, since skip is always true. This is just removing the
code.
2017-08-01 22:38:22 -07:00
Rishi Gupta 0286a41c4c tutorial: Remove is_running and defer logic. 2017-08-01 22:38:22 -07:00
Rishi Gupta 99df794f2c tutorial: Remove window resizing logic. 2017-08-01 22:38:22 -07:00
Rishi Gupta 38ad318651 tutorial: Remove fake_messages and extra current_msg_list rendering. 2017-08-01 22:38:22 -07:00
Rishi Gupta be7f6db854 tutorial: Remove rest of tutorial.
Replaces the call to welcome() in tutorial.start with finale(true), and then
iteratively removes all orphaned code.
2017-08-01 22:38:22 -07:00
Rishi Gupta e1843dd1b9 tutorial: Remove delayed messages.
These have been replaced by the initial stream messages and PMs.

The two pieces of information that exist here and not in the initial stream
messages are a link to /integrations, and a demonstration of image
uploading/pasting.

I think the current information presented is already a lot, though probably
it would be good to work in integrations somehow. Image pasting should just
be done in a separate Zulip that demonstrates the many different formatting
features.
2017-08-01 22:38:22 -07:00
Brock Whittaker 5ee0725731 Remove unnecessary comment. 2017-08-01 18:33:11 -07:00
Brock Whittaker 199a0582d7 Reduce <h3> heading margin.
This reduces the margin-top of the <h3> headings.
2017-08-01 18:32:18 -07:00
Brock Whittaker 448358bf96 /help/: Change image styling.
This changes from larger box shadows to subtle line borders.
2017-08-01 18:32:18 -07:00
Joshua Pan b7fe2fe7d8 Move maybe_get_stream_name to stream_data.js.
This also gets rid of the unnecessary set_global
in settings_org.js test, which made tests fail after
moving the code.
2017-08-01 16:19:41 -07:00
Brock Whittaker 7c63b061c1 settings: Remove intermediate hash change.
This removes an unecessary intermediate hash change when opening
up the settings page automatically on page load.

Fixes: #3634.
2017-08-01 15:38:17 -07:00
Brock Whittaker 463f69fd1b Enable scrolling on user presences on mobile.
The overflow was set to "hidden". I'm unsure of how this was even
working on desktop, but the #user-presences div certainly would
not scroll on mobile. This enables mobile scrolling.
2017-08-01 14:52:16 -07:00
Brock Whittaker 850efdebdd Add equal padding to sides of the right sidebar on mobile.
This adds equal padding to both the left and right side of the mobile
sidebar so that text and divs don’t hit the right side of the screen.
2017-08-01 14:52:16 -07:00
Brock Whittaker 17c4ef2e21 Fix settings back arrow vertical alignment.
The back arrow to get to the settings tabs on mobile was too low in
position in the header.
2017-08-01 14:48:13 -07:00
Brock Whittaker bceebb1547 Make right sidebar user search input larger.
This makes the <input> 100% in width, rather than only about 60% of the
width of the sidebar.
2017-08-01 14:48:13 -07:00