Commit Graph

4172 Commits

Author SHA1 Message Date
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
Brock Whittaker d1508a6435 Add "touch-action: manipulation" for less tap delay.
This is a google recommendation to remove the 300ms tap delay on
mobile web.
2017-08-01 12:37:08 -07:00
Brock Whittaker 14254f9668 lightbox: On .player-container direct click, hide lightbox.
When a user clicks on the `.player-container` node and the click
target is actually that (and not the YT video iFrame within), then
hide the lightbox – they likely mean to exit out of the lightbox.
2017-08-01 09:25:52 -07:00
Steve Howell 7caf8edadc Extract notifications.reify_message_id().
This removes the last need for a message_id_changed event.
2017-08-01 08:59:14 -07:00
Steve Howell 3f06f28ad7 sending messages: Extract sent_messages.js.
This commit extract send_messages.js to clean up code related
to the following things:

    * sending data to /json/report_send_time
    * restarting the event loop if events don't arrive on time

The code related to /json/report changes the following ways:

    * We track the state almost completely in the new
      send_messages.js module, with other modules just
      making one-line calls.

    * We no longer send "displayed" times to the servers, since
      we were kind of lying about them anyway.

    * We now explicitly track the state of each single sent
      message in its own object.

    * We now look up data related to the messages by local_id,
      instead of message_id.  The problem with message_id was
      that is was mutable.  Now we use local_id, and we extend
      the local_id concept to messages that don't get rendered
      client side.  We no longer need to react to the
      'message_id_changed' event to change our hash key.

    * The code used to live in many places:
        * various big chunks were scattered among compose.js,
          and those were all moved or reduced to one-line
          calls into the new module
        * echo.js continues to make basically one-line calls,
          but it no longer calls compose.report_as_received(),
          nor does it set the "start" time.
        * message_util.js used to report received events, but
          only when they finally got drawn in the home view;
          this code is gone now

The code related to restarting the event loop if events don't arrive
changes as follows:

    * The timer now gets set up from within
      send_messages.message_state.report_server_ack,
      where we can easily inspect the current state of the
      possibly-still-in-flight message.

    * The code to confirm that an event was received happens now
      in server_events.js, rather than later, so that we don't
      falsely blame the event loop  for a downstream bug.  (Plus
      it's easier to just do it one place.)

This change removes a fair amount of code from our node tests.  Some
of the removal is good stuff related to us completing killing off
unnecessary code.  Other removals are more expediency-driven, and
we should make another sweep at ramping up our coverage on compose.js,
with possibly a little more mocking of the new `send_messages` code
layer, since it's now abstracted better.

There is also some minor cleanup to echo.resend_message() in this
commit.

See #5968 for a detailed breakdown of the changes.
2017-08-01 08:58:56 -07:00
Vaida Plankyte 30361f50f8 frontend: Fix elements that are not visible should not be focusable.
Fixes #5534.
2017-08-01 08:56:11 -07:00
Harshit Bansal a13535ff1f alert_words: Don't muck up rendered HTML content while munging.
Prior to this we were also performing highlighting inside HTML tags
which was wrong and causing weird behavior. Like, for example, if
someone added `emoji` as an alert word then any message containing
both emoji and alert word was rendered with a jumbo emoji.

Fixes: #4357.
2017-07-31 21:20:21 -07:00
Brock Whittaker 7eb41c5f7e Make lightbox canvas feature cross-browser compatible.
This makes the canvas zoom and pan feature cross-browser compatible in
a few ways:

1. Replace deprecated `mousewheel` event in favor of the similar and
cross-browser event `wheel`.

2. Create approximate substitute for `e.movementX` and `e.movementY`
values that are missing in Safari.
2017-07-31 17:03:31 -07:00
Brock Whittaker 8445f886d7 Add ability to pan and zoom lightbox images.
This adds the ability to pan and zoom lightbox images because they
are now converted to <canvas> elements.
2017-07-31 17:03:31 -07:00
Steve Howell 90c5b53da3 Remove send_times_log feature.
We no longer use this in development.
2017-07-31 14:57:34 -07:00
Tim Abbott a9fa1a5527 api: Migrate /json/messages_in_narrow off legacy API.
This completes the major endpoint migrations to eliminate legacy API
endpoints from Zulip.

There's a few other things that will happen naturally, so I believe
this fixes #611.
2017-07-31 13:08:06 -07:00
Tim Abbott 6a50e13156 uploads: Remove legacy /json/upload_file endpoint.
This migrates Zulip to use the equivalent API endpoint that has been
present for a while.
2017-07-31 13:08:06 -07:00
Tim Abbott 1e5aee054b settings: Migrate main settings-change code to API.
This was one of the few major remaining endpoints that were still on
the old-style legacy API.
2017-07-31 13:08:06 -07:00
Harshit Bansal 3796292913 markdown: Fix the rendering of realm filters.
A realm filter should match only after the start of a line, whitespace
or opening delimiters. But markdown was not configured to respect those
rules which was causing some weird rendering behavior. This commit fixes
the regex used for matching realm filters. On the backend we are using
regex with negative lookbehind to perform matches but since javascript
regex don't support lookbehind we are using a workaround on the frontend
using `contains_backend_only_syntax()` function which detects if a realm
filter can be rendered correctly by backend only and if so it stops the
message from getting echoed locally.

Fixes: #5154.
2017-07-31 12:42:36 -07:00
Steve Howell a4b0ca8f07 unread.js: Remove unused argument to get_counts(). 2017-07-31 09:06:29 -04:00
Steve Howell 34e452bcfd Extract unread.unread_pm_counter().
This class is mostly a thin layer over the dictionary, but it
consolidates all the logic to create lookup keys, which have
to follow the convention of being comma-separated, numerically
sorted user_ids.
2017-07-31 08:59:18 -04:00
Steve Howell 19ebf1e23b bankruptcy: Clear unread counts for mentions. 2017-07-31 08:30:46 -04:00
Steve Howell bf81782e59 Rename num_unread_for_subject -> num_unread_for_topic. 2017-07-31 08:11:18 -04:00
Steve Howell fe74e79a17 Rename subject_count -> topic_count.
This fixes all names in the JS codebase.
2017-07-31 08:04:20 -04:00
Steve Howell d1c5cef186 subject -> topic: Fix unread_topic_counter.
This changes all internal references of `subject` to be
`topic` instead.
2017-07-31 08:03:55 -04:00