Commit Graph

4521 Commits

Author SHA1 Message Date
Steve Howell b32a9444dd js: Clean up how we track default stream names.
We continue to have page_params.realm_default_streams, but
now we do lookups on whether a stream is a default stream
by using a Dict indexed by stream_id.

We are also careful to update that during live updates.

This fixes a flaw that we weren't updating the list of realms
correctly for events that remove a default stream.
2017-08-27 19:08:04 -07:00
Tim Abbott 5d974b7f57 emoji: Remove :s from emoji popover title attributes. 2017-08-27 17:34:44 -07:00
Harshit Bansal 90d8b0f520 emoji_picker: Fix the two different titles appearing for each emoji.
Fixes: #6286.
2017-08-27 17:22:44 -07:00
Harshit Bansal 923fb7be16 emoji: Fix mis-alignment of realm emoji div with other div in emoji picker.
Tweaked by tabbott to fix the CSS to not break the emoji typeahead.

Fixes: #5229.
2017-08-27 17:21:08 -07:00
Tim Abbott 36fa6fe548 css: Remove duplicate emoji height CSS. 2017-08-27 17:20:37 -07:00
Tim Abbott e68de7ac8d user popover: Don't throw an exception for deactivated target users.
Ideally, we'd fix this at the root cause, via #4322, but this will at
least suppress the exception for now.
2017-08-27 16:41:28 -07:00
Tim Abbott 3e1bf86ced hotkey: Make enter checks more strict.
This should hopefully fix an obscure traceback we were seeing.
2017-08-27 16:35:17 -07:00
Tim Abbott 478f691792 settings: Remove useless map_initialized. 2017-08-27 16:35:17 -07:00
Tim Abbott a1885c6ffb message_edit: Add debug logging for missing messages.
This is an attempt to more easily debug a traceback we've seen a few
times.  The issue likely has to do with local echo, which would be
confirmed if this reports a local-echo-style message ID.
2017-08-27 16:11:42 -07:00
Harshit Bansal cd2f41dbb1 popovers: Extend the `compute_placement()` function.
This commit extends the `compute_placement()` function in
`popovers.js` to take into account height/width of popover as well as
positioning preference. If vertical positioning is desired and the
popover fits in either 'top/bottom' positions then we don't check for
`left/right' positions. Earlier the behavior was to prefer
'left/right'positions over 'top/bottom' positions, which resulted in
the emoji picker popping incorrectly to the left.
2017-08-27 12:27:53 -07:00
Harshit Bansal f24582576a emoji_picker: Further improve emoji picker navigation.
This further improves the emoji picker by introducing two new behaviors:

1: If the cursor is at the end of the input box then pressing `right_arrow`
moves the focus down into `emoji_catalog.

2: If the currently focused emoji is the first emoji in the `emoji_catalog`
then pressing `left_arrow` moves focus back to search filter.
2017-08-27 12:04:10 -07:00
Tim Abbott eb4635804f compose: Fix previews of /me messages.
Previously, we didn't do anything special when previewing /me messages.

Fixes #2115.
2017-08-27 09:48:27 -07:00
Tim Abbott e80f93dc42 markdown: Set is_me_message in apply_markdown.
This should make the variable available to things like drafts and
previews.
2017-08-27 09:34:24 -07:00
Tim Abbott 133f005530 markdown: Remove is_me_message UserMessage flags.
This never made sense to be a flag on the UserMessage table, since
it's not per-user state.  And in fact it doesn't need to be in a
database at all, since it's easily computed from content anyway.

Fixes #1099.
2017-08-27 09:34:24 -07:00
Tim Abbott 0f1768d0d1 compose: Fix confusing variable name in preview code path.
This seems to be the root cause of the bug fixed in the last commit.
2017-08-27 09:34:06 -07:00
Tim Abbott eb6d736df3 compose: Fix local rendering of previews.
Apparently, local rendering of previews had broken sometime in the
last few months in a refactoring that resulted in us passing a string,
rather than an object, into markdown.js.
2017-08-27 09:33:52 -07:00
rht 437b2a3146 Update "MacOS" text to "macOS" 2017-08-26 09:00:42 -07:00
Vaida Plankyte a492fc80ed hello.html: Change feature images to SVGs. 2017-08-25 10:30:22 -07:00
Tim Abbott 8df7deac9d deactivation: Add some styling to make boxes smaller. 2017-08-25 00:16:35 -07:00
Tim Abbott 07a156c400 notifications: Fix desktop/sound notifications for @all.
It appears that previously, these weren't being triggered.
2017-08-24 23:56:10 -07:00
Tim Abbott a2c21543bc mentions: Fix mention state being lost after reload.
This fixes a regression introduced in
bc2069aec2, which caused @-all mentions
to not be displayed properly.

Fixes #5317.
2017-08-24 23:47:55 -07:00
Cynthia Lin 8addc9b97e message view: Maintain stream color border on @-mention messages.
Fixes #6241
2017-08-24 23:37:59 -07:00
Tim Abbott eb781de78d settings: Fix buggy use of JavaScript regular expressions.
Using weird characters when filtering options items in these various
settings pages would throw exceptions whenever they didn't form a
valid regular expression.
2017-08-24 18:32:01 -07:00
Brock Whittaker d2a4afeacf Change message click => message long-tap event on mobile.
Previously on mobile, clicking on a message would make the compose
box open, but this is a relatively finnicky event whenever scrolling
so we realistically want to open the compose box on long-tap (with
a 750ms delay) to prevent false clicks and provide a closer-to-native
experience.
2017-08-24 16:52:18 -07:00
Brock Whittaker 624f1bb151 Restyle checkboxes to be less visually abrasive.
This restyles the checkboxes to be more subtle in their rest and
unchecked state so they don't create too much visual noise on the
page.
2017-08-24 14:19:49 -07:00
Brock Whittaker 3e2e24f4cd Lighten subscriptions settings grey boxes.
This increases the luminosity of the subscriptions settings boxes
from 93% to 97%.
2017-08-24 14:19:49 -07:00
Brock Whittaker cac4aeaa5f Clean up "Stream accessibility" section.
This cleans up the "Stream accessibility" section by putting the
radio boxes in a container along with fixing the margins around
various things.
2017-08-24 14:19:49 -07:00
Brock Whittaker 74f48ed5ba Make stream creation titles more consistent in size.
This brings down the number of stream creation title sizes from
4 (!!) to 1.
2017-08-24 14:19:47 -07:00
Brock Whittaker b73f5c9770 Fix responsive issue with stream filter search.
This fixes the search input collapsing to a second line in between
1024px and 1033px width views.
2017-08-24 13:59:40 -07:00
Brock Whittaker 44636051e4 Make /help/ sidebar more discoverable on mobile/narrow.
This makes the /help/ sidebar more discoverable at windows less
than 1000px in width because it makes it stick out a bit when it
is closed with the hamburger menu at the top.

Fixes: #6038.
2017-08-24 13:38:22 -07:00
Brock Whittaker 321074856e /integrations/: Focus search bar on page load.
This focuses the search bar on initial page load.
2017-08-24 11:38:13 -07:00
Vaida Plankyte 380dd38fc7 assets: Add email illustration SVGs to assets folder. 2017-08-24 11:37:24 -07:00
Cynthia Lin 60ca87a3e1 analytics: Add link to Analytics user docs. 2017-08-23 17:34:08 -07:00
Steve Howell b215229d22 unread: Add code to set unread counts from page_params data.
This won't run in production due to the feature flag.
2017-08-23 17:25:52 -07:00
Steve Howell 540c452fc2 unread: Use a an "id_set" for unread_messages. 2017-08-23 17:25:52 -07:00
Vaida Plankyte b2c0ff68c2 frontend: Add hotkey information to title/inline text.
This should make many Zulip hotkeys significantly more discoverable.
2017-08-23 17:12:09 -07:00
Brock Whittaker a6f2a0c943 settings: Remove whitespace on left side of bot key.
The bot API key when selected in the "Your bots" panel would have
some whitespace due to the fact that the HTML markup would make
some space between the span and button.

Fixes: #6189.
2017-08-23 15:31:28 -07:00
David Taylor 2bb5013efc integrations: Add discourse integration.
The actual integration lives on the Discourse side.
2017-08-23 15:25:12 -07:00
Vaida Plankyte a7ccd313bc frontend: Add email illustrations to static/images/emails. 2017-08-23 13:45:00 -07:00
Yago González 7d5d8ac61e lint: Add rule for spacing inside Handlebars translation tags.
This commit also includes the fixes to make all Handlebars templates
compliant with the new rule.
2017-08-23 13:08:57 -07:00
Tim Abbott 57dfded339 narrow: Add some clarifying comments. 2017-08-23 12:43:11 -07:00
Brock Whittaker 9e191b235f streams: Update button styles to new styles.
This updates the old red and blue buttons for the email address
add function and for the table unsubscribe function to be the new
style of buttons.
2017-08-23 12:29:32 -07:00
Brock Whittaker 2bb5042315 Use native `.click` event over jQuery `.click` event.
For whatever reason, the clipboard doesn’t want to work if you use a
jQuery click trigger. Perhaps because the jQuery event trigger doesn’t
create a native event at all. By doing this however, it doesn’t appear
to affect any other code but does allow for the clipboard to work again.

Fixes: #6002.
2017-08-23 12:26:50 -07:00
Brock Whittaker 4617a650c0 Compact two `row.find(".alter-copied")` statements into one. 2017-08-23 12:26:50 -07:00
Tim Abbott 74c628b105 editing: Fix live update of ability to edit messages.
Previously, we didn't check the organization-level settings when
rendering a message list; instead, we only checked it when putting
messages into the message_store.  That resulted in the state being
stale in the event that the setting controlling whether one can edit
messages was changed.

We remove some node tests, because revidving the node test for their
new home in message_list_view would be more work than we probably want
to do with an upcoming release.  We basically need to be better about
exporting functions like populate_group_from_message_container and
set_topic_edit_properties, so we can do fine grained testing.

When we get around to the node tests, rather than exporting these
functions, it might make sense to create a new module with a name
like message_container.js, which would have all of these
last-second type of data manipulations on message objects.  This
would be nice to split out of message_list_view.js.  MLV is our
biggest module, and it's mostly cohesive, but it's real job
should be about assembling messages into a DOM list, which is
probably 80% of the code now.  The 20% that I'd want to consider
splitting out is actually closer in spirit to message_store.js.

Thanks to Steve Howell for helping with the node tests.
2017-08-23 12:03:35 -07:00
Brock Whittaker cf4444123a informational-overlays: Remove outline on focus.
This removes the outline that comes on focus of one of the overlay
sections.

Fixes: #6188.
2017-08-23 11:05:52 -07:00
Vaida Plankyte a7b400135d landing-page.css: Reduce width of CTA container in apps page. 2017-08-23 10:24:56 -07:00
Umair Khan f265718854 i18n: Escape settings names in settings status messages.
By default, all text is escaped in i18next. We can use '__- ' to
unescape.

Fixes #6219
2017-08-23 00:22:59 -07:00
Max Schaefer 4825b6e5ad topic_list: Remove a spurious assignment and simplify a conditional.
Variable `show_topic` was assigned in both branches of the
conditional, but the assignment in the "then" branch was useless,
since the variable wasn't subsequently read. Hence the assignment can
be dropped, leaving the "then" branch empty. The "if" statement can
then be simplified by removing the "then" branch entirely and flipping
the condition. Since `show_topic` is now only used inside the "if", it
is slightly tidier (though semantically equivalent) to move its
declaration inside.
2017-08-22 23:49:47 -07:00
Max Schaefer 34f97cfb9a tab_bar: Remove a spurious assignment.
Variable `stream` is a local variable (declared on [line
51](85c3f59292/static/js/tab_bar.js (L51))). It
is not read after this assignment, which hence becomes useless.
2017-08-22 23:49:33 -07:00
Max Schaefer bbe87231cd upload_widget: Remove a spurious argument.
This call refers to the `accept` function on [line
118](85c3f59292/static/js/upload_widget.js (L118)),
which takes no arguments (unlike the `accept` function on [line
33](85c3f59292/static/js/upload_widget.js (L33)),
which takes one argument, but isn't in scope here).
2017-08-22 23:48:55 -07:00
Brock Whittaker b4d0d09cc2 about: Add a banner to /about/ with a picture from PyCon.
This adds a PyCon banner photo of people working on sprints to the
top of the /about/ page.
2017-08-22 23:34:34 -07:00
Tim Abbott 06f8fd529d realm: Add clear error message for too-long realm name.
This fixes an exception we saw in production, as well as fixing the
form to not offer ultra-long names that we don't allow.
2017-08-22 22:04:52 -07:00
franziskagoltz 61fbf1a7e3 editing: Hide topic-edit-pencil if message editing is disabled.
This fixes a confusing bug where administrators would be offered the
convenient topic-edit pencil even if message editing was actually
disabled.

This doesn't yet fix the real-time sync issues of changing the setting
without reloading.

Fixes #5946.
2017-08-22 19:43:56 -07:00
Brock Whittaker d07281fa66 rename: Change list_rendering.js => list_render.js.
The method itself is called `list_render`, so the file should
reflect that name.
2017-08-22 17:37:36 -07:00
Brock Whittaker 25e5a10a5b unicode: Replace "×" with HTML and HEX entities.
This refactors and fixes unicode issues where entities don't display
properly due to being a special character that seems to be rendered
incorrectly in a non-deterministic way every time.
2017-08-22 16:31:53 -07:00
Harshit Bansal 1a43728b1e emoji_picker: Fix tracebacks in navigation if search results are empty.
This fixes 2 bugs:

* If you perform a search and search results are empty then if you try
  to navigate using arrow keys, page-down/page-up etc. it will give a
  traceback.
* Search for example 'a' and then navigate to the last of the search
  results using arrow keys. Now press 'tab' to go back the search box
  and restrict the search to for e.g. 'ab' and now try to navigate
  using arrow keys, page-up/page-down etc you will get a traceback.
2017-08-22 14:48:02 -07:00
Brock Whittaker 09be694ea3 Rewrite scrollbar width check to not use jQuery.
This check was going to do the wrong thing when we upgraded to jQuery 3.
2017-08-22 12:50:54 -07:00
Rishi Gupta b32fe9f2a0 features: Update screenshot and add tool to generate.
This adds a new management command that should make generating or
updating screenshots a bit easier in the future.
2017-08-22 11:32:22 -07:00
Brock Whittaker 1a9c1241af Disable ability to highlight message reactions.
This adds the `user-select: none` property to `.message_reactions`
to disable accidental highlighting or selecting of the text.
2017-08-22 11:11:40 -07:00
Max Schaefer 8aa5a02866 js: Remove a few spurious arguments. 2017-08-22 09:37:17 -07:00
Max Schaefer 4d0f304048 js: Fix two misphrased conditions. 2017-08-22 09:37:15 -07:00
Aditya Bansal 0dcbacdbc6 emoji_picker: Refactor toggle_emoji_popover to split out to functions. 2017-08-22 08:46:55 -04:00
Vishnu Ks 517d9b7594 /apps/: Detect the user OS and show the appropriate app by default. 2017-08-20 22:11:56 -07:00
Aditya Bansal e1cc0455ee emoji_picker: Fix issue with emoji tab shifting.
In this commit we basically do these things:
* Clear up section_head_offsets before pushing stuff in it so that
its size doesn't keep on growing indefinitely with time and users
opening emoji picker.
* Make use of popover element to find the correct element in DOM
to scan for section elements. This prevents us from filling stuff
twice into section_head_offsets because of presence of two
elements for '.emoji-popover-subheading' in DOM since popover
destroy is an async call.
* Using this popover element also helps in avoiding manuplation
of the DOM elements of the popover that was destroyed (Because
popover destroy is async it still maybe around). One instance of
this is associating scroll event with the right instance of
'.emoji-popover-emoji-map'.
2017-08-18 12:18:39 -04:00
Steve Howell eeb164dfc5 bug: Show the count in the bankruptcy modal.
(This was a recent regression.)
2017-08-17 23:30:41 -04:00
Vaida Plankyte 8a29f1dcf2 config_error.html: Increase container width. 2017-08-17 11:27:36 -07:00
Steve Howell 770ec92891 hotkeys: Fix "n" key to work inside a muted stream.
Normally the "n" key skips over muted streams, but if we
are currently narrowed inside a muted stream, it will now
go to the next topics within that stream.

For me the use case was that I have a stream I check up on
about once a day, and "n" would be super useful for me to
clear out unread counts while still skimming some content,
and without having to temporarily unmute the stream.
2017-08-17 09:01:49 -07:00
Tim Abbott f8b1916781 stream_sidebar_row: Rename data-name to data-stream-name.
This is for greater consistency with the rest of the codebase.
2017-08-16 18:03:44 -07:00
Tim Abbott 9271346753 stream_sidebar_row: Remove duplicate data-name attribute. 2017-08-16 18:03:44 -07:00
Tim Abbott 5e968ce30d stream_list: Use data-topic-name for topic names.
The name data-name was ambigious.
2017-08-16 18:03:44 -07:00
Tim Abbott d9dcdbbbe9 stream_popover: Use data-stream-id when building topic popovers. 2017-08-16 18:03:29 -07:00
Tim Abbott dbae28683c stream_popover: Use data-stream-id when building popover. 2017-08-16 18:03:29 -07:00
Tim Abbott c6d7cfb60b stream_popover: Fetch the current stream by data-stream-id. 2017-08-16 18:03:29 -07:00
Tim Abbott 7d9303cfe8 topic_list: Stop accessing legacy data-stream name field.
We should be using data-stream-id everywhere.
2017-08-16 18:03:28 -07:00
Tim Abbott 88e3ba9576 stream_list: Fix enter key to use data-stream-id. 2017-08-16 18:02:57 -07:00
Tim Abbott 047237e45b stream_list: Remove a reference to data-name in sidebar. 2017-08-16 18:02:56 -07:00
Tim Abbott 4acd7595cd stream_sidebar: Clean up use of ambiguously named data-id.
We prefer to specify the type of data objects wherever possible.
2017-08-16 18:02:29 -07:00
Tim Abbott 78d9fcd23a streams: Remove a reference to data-stream-name. 2017-08-16 18:02:29 -07:00
Greg Price a099e698e2 py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Tim Abbott 4b72b461e5 user_events: Fix buggy-looking logging code.
The previous logging exception looked like it sorta left off.
2017-08-16 16:23:41 -07:00
Aditya Bansal 7beeef9782 emoji_picker: Export emoji_collection and complete_emoji_catalog. 2017-08-16 19:18:26 -04:00
Aditya Bansal 406806b7df emoji_picker: Start using current emoji categories for rendering. 2017-08-16 19:18:26 -04:00
Aditya Bansal 245d571ae9 emoji.js: Refactor to make better use of initialize(). 2017-08-16 19:18:26 -04:00
Aditya Bansal 505262ca0b emoji_picker.js: Export initialize function. 2017-08-16 19:18:26 -04:00
Aditya Bansal 85fe355ba7 emoji_picker: Move click handler out from global scope.
In this commit we are moving the .emoji-popover-emoji.reaction
click handler to register_click_handlers() so as to have parity
with rest of the code design.
2017-08-16 19:18:26 -04:00
Tim Abbott 3a2a396303 zephyr: Fix tracebacks opening user info popovers. 2017-08-16 16:07:27 -07:00
Steve Howell 29c05c82f0 Fix A/D hotkeys for cycling through stream narrows.
We now use similar code for A/D hotkeys as we do for the "n"
key.

The old code was using jQuery operations that got tripped up
by our splitters between active and inactive streams.

Fixes #4569
2017-08-16 15:45:47 -07:00
Steve Howell b4590e1303 Add topic_generator.reverse_wrap_exclude().
This allows us to traverse a list backwards, cycling to the
bottom as needed.

This code is going to be used for the "A" key that cycles
upward in the stream sidebar.  It's probably overkill for
that use case, but it does give us O(1) behavior and avoids
the pitfall of accidentally mutating a list when reversing it.
2017-08-16 15:45:47 -07:00
Tim Abbott dac7cfa026 emoji picker: Fix exceptions with regex characters in emoji filter.
Previously, the Zulip webapp would throw an exception if you used a
character like "+" in your search query, since we were using regular
expressions, when really we should have been just searching for
characters.
2017-08-16 13:06:05 -07:00
Tim Abbott 7a5c6628a6 server_events: Fix formatting of server_events exception. 2017-08-16 11:59:49 -07:00
Vaida Plankyte cd1b01996e frontend: Add perfectScrollbar to invite users modal. 2017-08-16 08:23:34 -07:00
Vaida Plankyte 11d935f52a frontend: Add perfectScrollbar to right pane of manage subs overlay.
Tweaked by tabbott to use a more precise selector.
2017-08-16 08:23:34 -07:00
Vaida Plankyte 8ae263bf15 frontend: Add perfectScrollbar to left sidebar of manage subs overlay.
Tweaked by tabbott to use a more precise selector.
2017-08-16 08:23:33 -07:00
Rafid Aslam 5f7e23e8ef frontend: Add perfectScrollbars to Settings/Organization overlay.
Use perfectScrollbar on settings sidebar, since the default scrollbar
makes settings menu break when not enough vertical space available.

Add perfectScrollbar to main settings section, and reset the scrollbar
position when switching between tabs.

Also delete the z-index on `.settings-list` since it makes the
perfectScrollbar covered.

Fixes #5216.
2017-08-16 08:23:30 -07:00
Vaida Plankyte 971dc71ed6 ui.js: Create perfectScrollbar functions. 2017-08-16 08:07:28 -07:00
Vaida Plankyte d3f0d2cc9f help: Add perfectScrollbar to markdown container. 2017-08-15 21:10:14 -07:00
Brock Whittaker 83184d5c60 /about/: Merge with /authors, redesign page.
This adds the authors to the Zulip repository on GitHub from
/authors/ along with re-styling the page to fit the same
aesthetic as /for/open-source/ and other product-pages.
2017-08-15 16:09:01 -07:00
Brock Whittaker eec26c5da6 Extract "open source" feature column into its own section. 2017-08-15 15:26:46 -07:00
Tim Abbott c043d31074 portico: Fix accidental console.log statement. 2017-08-15 15:23:16 -07:00
Brock Whittaker 41dbbcf062 Change the notice text to be on the same line and grey. 2017-08-15 13:27:48 -07:00
Brock Whittaker cc8de243a5 Switch from #errors to new .alert.alert-error.
This switches to the newer style of displaying alerts.
2017-08-15 13:27:48 -07:00
Brock Whittaker dfb3d03c0b Fix broken input sizing for subdomains.
In the case of no subdomains, the input is too large because the JS
calculated size does not account for padding. The correct solution is
to do this in JS.
2017-08-15 13:27:48 -07:00
Akash Nimare eb88bd9552 portico: Point desktop app links to latest release. 2017-08-15 10:51:22 -07:00
Tim Abbott 842bf77efb unread: Convert mark_topic_as_read to use stream IDs.
This is safer in its handling of potentially renamed streams.
2017-08-15 10:40:02 -07:00
Tim Abbott f3a41ac796 unread: Convert mark_stream_as_read to use stream IDs.
The logic is simpler and more robust.
2017-08-15 10:40:02 -07:00
Steve Howell 89f9017686 Create new endpoints for marking streams/topics as read.
The new endpoints are:
    /json/mark_stream_as_read: takes stream name
    /json/mark_topic_as_read: takes stream name, topic name

The /json/flags endpoint no longer allows streams or topics
to be passed in as parameters.
2017-08-15 10:17:29 -07:00
Tim Abbott 9081f2cf44 reactions: Store the emoji codepoint in the database.
This is the first part of a larger migration to convert Zulip's
reactions storage to something based on the codepoint, not the emoji
name that the user typed in, so that we don't need to worry about
changes in the names we're using breaking the emoji storage.
2017-08-15 09:29:27 -07:00
Robert Hönig 4be814fc16 integrations: Add OpsGenie integration. 2017-08-15 08:42:19 -07:00
Steve Howell b59d7d54de tab_bar: Remove a now-irrelevant comment. 2017-08-14 17:34:55 -07:00
Steve Howell 57f17ae543 Extract top_left_corner.js.
Here are the functions in top_left_corner:

    get_global_filter_li: pure code move
    update_count_in_dom: simplifed copy of similar function in stream_list.js
    update_dom_with_unread_counts: pure code move, split out from function
       of same name in stream_list.js
    delselect_top_left_corner_items: pure code move
    handle_narrow_activated: pure code move + rename
    handle_narrow_deactivated: pure code move, split out from from function
       of smae name in stream_list.js
2017-08-14 13:03:57 -07:00
Steve Howell 0f3b565d40 Create explicit handlers for stream activate/deactivate.
Calling explicit functions ensurest that the sidebars
get activated for narrows before less important things
happen, and it also makes testing easier.
2017-08-14 13:03:57 -07:00
Steve Howell 8655fae910 Make deselect_top_left_corner_items() more accurate.
This function was actually de-selecting stream sidebar items
before.  Now we just explicitly de-select top-left items in it,
and we do stream-sidebar stuff in update_stream_sidebar_for_narrow().
2017-08-14 13:03:57 -07:00
Harshit Bansal 99d3668523 emoji_picker: Change emoji picker to be category based. 2017-08-14 12:52:35 -07:00
Steve Howell 78be1b362e Remove home icon in tab bar for non-home narrows.
This reduces clutter, particularly on mobile web.
2017-08-14 12:48:09 -07:00
Steve Howell 81708e3e2a tab_bar: Extract is_all() helper. 2017-08-14 12:48:09 -07:00
Steve Howell 274938bf5f Eliminate approximate_unread_count().
We use page_params.unread_msgs.count in the web
app instead.

Fixes #1300.
2017-08-14 12:39:00 -07:00
Tim Abbott 5f87037bf5 Fix upwards scrollback when narrowing to streams centered on old messages.
Previously, when you switched to a stream narrow with the central
message outside the range of messages cached in the browser, we would
reset the UI for loading more messages, but not actually reset the
state for whether it should be possible.

This seems to have been an oversight in refactoring back in 2014.

Fixes #6109.
2017-08-14 12:05:40 -07:00
Brock Whittaker 41f98bbdb9 Remove the slide animation from product pages. 2017-08-14 11:34:14 -07:00
Brock Whittaker 158bd23b59 left-sidebar: Style "More topics" to be more consistent.
The "More topics" link was not lined up with the topics due to a
recent change anymore; we also increase the font size slightly.

Fixes: #6090.
2017-08-14 11:33:51 -07:00
Steve Howell 612e3766ce Turn on feature_flags.user_server_topic_history.
With this flag turned on, all streams will have a "more topics"
link, and clicking that link will always fetch topics from the
server to show a complete list of topics that you have had messages
for on that stream.

Note that if you only recently joined a public stream, your list
of topics won't go back to before you joined the stream, even though
that content is searchable.  We may change that in the future, but
we will need to be careful about spamming folks who frequently
unsubscribe from streams.
2017-08-11 13:01:39 -07:00
Steve Howell 60cca43d5e Always show "more topics" link if you have server history.
Until we have an easy way to consistently determine whether a
stream has more topics than have been loaded already, we err
on the side of showing a "more topics" link.  This in some ways
leads to a more consistent experience where you can zoom in on
any stream, even one that's really new.
2017-08-11 13:01:39 -07:00
Steve Howell 24e9dbe80b Use data-stream-id for zooming topics. 2017-08-11 13:01:39 -07:00
Steve Howell 17ff7317b9 Replace #stream_sidebar_{id} with data-stream-id.
We weren't actually using #stream_sidebar_{id} anywhere, and
data-stream-id allows for more conventional idioms in future
commits.
2017-08-11 13:01:39 -07:00
Steve Howell fad024ebda Simplify stream sidebar narrows.
This fix simplifies how we re-render topic lists when we
re-narrow or zoom out from a topic list.

    * The topic_list.zoom_out() no longer gets called as
      part of re-narrowing, and we eliminate the clear_topics
      option.

    * For all situations where we narrow to a filter that does
      not have a topic, we simply call the new function
      clear_topics().

    * The stream_list code no longer calls remove_expanded_topics()
      in cases where the new narrow has a topic.  This allows us
      to optimize away scroll/flicker churn a little more easily.

As part of this, we rename maybe_activate_stream_item() to
update_stream_sidebar_for_narrow(), since the function clears
stuff as well as turning stuff on.
2017-08-11 13:01:39 -07:00
Steve Howell 2146e17709 node tests: Improve topic_list tests.
We test a little deeper now, covering rebuild (albeit mostly with
stubs) and active_stream_id.
2017-08-11 13:01:39 -07:00
Steve Howell f706efe12e Add topic_list.active_stream_id(). 2017-08-11 13:01:39 -07:00
Steve Howell 089670ac1c Extract stream_list.show_all_streams(). 2017-08-11 13:01:39 -07:00
Steve Howell d2686bdcdd Simplify maybe_activate_stream_item().
We extract get_sidebar_stream_topic_info() and just call
topic_list.rebuild() directly, which allows us to eliminate
rebuild_recent_topics().
2017-08-11 13:01:39 -07:00
Steve Howell cd4dd90641 Extract stream_list.update_top_left_corner_for_narrow().
This is mostly a pure code extraction.  It makes the call
to reset_to_unnarrowed() happen later in sequence.

The order of operations here is mostly unimportant, but
there may actually be some tiny user-facing benefit
in terms of having the logic happen more sequentially.

BEFORE:
    reset streams
    fix top left
    redraw streams

AFTER:
    fix top left
    reset streams
    redraw streams
2017-08-11 13:01:39 -07:00
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