Commit Graph

268 Commits

Author SHA1 Message Date
Tim Abbott 2c9c5f6093 Clean up code duplication when calling add_narrow_filter.
(imported from commit da397f015427e7c5b01fa1e89ba119ff87cda168)
2013-05-02 15:35:46 -04:00
Zev Benjamin ea55ed5ebb Use .attr() instead of .data() to access stream and subject names from the sidebar
The .data() method tries to coerce the value of the attribute into a
Javascript type, which is not what we want when the stream name looks
like a number or some other Javascript type.

(imported from commit a5f639d2ef98435cec6beacf3837fc185474a955)
2013-05-02 12:50:24 -04:00
Zev Benjamin bea819e039 Don't mark all loaded messages before the pointer as read on page load
On page load, the scroll_finished function was being called and
scroll_start_message was -1.  This caused us to mark all messages
that we loaded through the messages initially visible as read.  This
was particularly problematic because message_range iterates over all
message ids between its two arguments.

(imported from commit d93209d466797939cc9dbdbe76d25a5b20195bd2)
2013-05-02 12:03:18 -04:00
Zev Benjamin 7c672e85a9 Look up stream sidebar elements by id
Previously we were doing quadratic work in the number of streams
because we had to iterate over all <li> elements every time we added
a new one.

(imported from commit 60cb97f77d161e9d8c3072157fa9c57c58f7af52)
2013-05-02 12:03:18 -04:00
Zev Benjamin a640da16df Sort the streams side-bar only after all streams have been added
We were previously calling sort_narrow_list after each stream was was
added.  Because it is linear in the current length of the sidebar
list, we were doing quadratic work on page load.  When we enabled the
streams sidebar on the MIT realm, this became problematic because of
the number of subscriptions Zephyr users have.

(imported from commit d60ddc638f0a81fbce08eecd6671e9ea6ca38515)
2013-05-02 12:03:18 -04:00
Waseem Daher 5887d9c576 Condense messages in a fail-safe way.
Messages are now explicitly condensed by our JS, which means that if
we run into some bug where our JS doesn't run, you still see the whole
message (rather than getting a clipped message).

(As of this commit, this can happen when you, e.g. are on the
Settings page and someone sends you a message.)

(imported from commit f3bec97800ea1852c80203e73552ee545fcc7e8a)
2013-05-02 09:52:26 -04:00
Leo Franchi d0b8a2fd21 Mark messages as read when using the End key
(imported from commit b2495cb27b1362d037e786db7f108540f2ce655b)
2013-05-01 17:26:19 -04:00
Waseem Daher 435098d001 Process message condensing in narrow.activate rather than hashchange.
Previously, we were having this problem where:
* You narrow to something
* That causes message_list.js:process_collapsing to run on all of the
  elements in the view, which changes some of their sizes
* That causes the pane to scroll and either push the content up or
  down, depending (since stuff on top of where you were is now a
  different size)
* That triggers keep_pointer_in_view, which moves your pointer

Moving process_collapsing into narrow.activate doesn't obviously
fix any of this, but it does seem to mitigate the issue a bit.

In particular, we (a) process it less frequently, and (b) process it
immediately after we show the narrowed view table, which seems to
reduce the raciness of the overall experience.

This does, however, introduce a regression:
* If you receive a long message when you're on
  #settings, e.g., and then go back to Home,
  the message does not properly get a [More] appended
  to it.

(imported from commit b1440d656cc7b71eca8af736f2f7b3aa7e0cca14)
2013-05-01 16:56:03 -04:00
Tim Abbott 57c5ea365a Enable the left sidebar for the MIT realm.
(imported from commit d69eba7fd7a95dd88892706c3d36485c71831864)
2013-04-30 18:38:13 -04:00
Tim Abbott 203fc55a7c Sort the narrow list better when there are more than 40 streams.
This shouldn't have any effect in normal realms, but for realms like
mit.edu that have large numbers of inactive streams, it will sort all
the streams that have had a recent message at the top (aka those that
aren't effectively inactive).

(imported from commit 027ce258d04b6fd58705e49f769dec7e0639bb38)
2013-04-30 18:38:13 -04:00
Allen Rabinovich 6970f2deee Corrected the removal code for temporary copy div
(imported from commit 9e3963a3ce4e7039464ab3c8de5939361d7802e5)
2013-04-25 15:11:56 -07:00
Jeff Arnold 88348a8dc7 Prevent XSS vulnerability by avoiding treating message text as HTML
Addresses #1205

(imported from commit 229c65ae48d509bf3b71ed7cbfcc1fbeb60d14c5)
2013-04-25 17:33:04 -04:00
Allen Rabinovich f8397e42c2 Adding an "Attach files" button to the message composition pane.
Changes include:
   * New markup for the button in compose.html
   * A hidden file input field in compose.html
   * Added reference to the file input field in filedrop
     initialization in compose.js
   * A feature test and a click event binding for
     the "Attach files" button in ui.js
   * New paperclip icon reference in fonts.css
   * New general hidden display classes in zephyr.css
   * New composition pane button classes in zephyr.css

Fixes to the "Attach files" button commit e673bda...

Changes include:
   * Fixed the feature test for (new XMLHttpRequest).upload so
     it works in Firefox.
   * Renamed .button to .message-control-button
   * Removed stray newlines

(imported from commit c1f0834b74fd7120ec27db64ec380ffb3fa34633)
2013-04-24 08:59:13 -07:00
Jeff Arnold 0b9e509f41 If the user expanded a message, keep it expanded when we narrow
(imported from commit cbff6a8629df25b0b5b90bf6e10e9ea35e9a72ef)
2013-04-23 16:13:26 -04:00
Jeff Arnold 70e5bd4049 Automatically condense long messages
Addresses Trac #747.

(imported from commit 4ddf2d8773023805650f04924be62da2d0fe826e)
2013-04-23 16:13:26 -04:00
Tim Abbott 4e03ed0b7e Fix narrows_by_subject treatment when a private message is selected.
Previously, we were calling util.same_stream_and_subject on a pair of
messages, one of which was a private message, which is not valid.  We
should have instead been calling util.same_recipient, which checks the
message type as well.

(imported from commit bc5715807036bff1fd4f214dafad00e33678e91d)
2013-04-22 16:21:34 -04:00
Allen Rabinovich e28cef697f Switched the star icon to FontAwesome and made it bigger and green.
* renamed the 'icon-star' style to 'icon-vector-star' to keep backwards compatibility for icon-* classes
  * changed relevant styles in zephyr.css; added FontAwesome assets
  * changed relevant CSS classes in base.html, left-sidebar.html, ui.js, message.handlebars
  * added new fonts.css to start consolidating all font-based assets
  * added fonts.css to PIPELINE_CSS in settings.py under 'portico' and 'app'
  * modified the stars test suite to reflect new star icon class name.

(imported from commit 3116fcfd4b5fb4edecd457da554fea616bb7081b)
2013-04-21 17:31:50 -07:00
Jeff Arnold 7b87c201f0 Revert "Automatically condense long messages"
This reverts commit 057f08f2fcef43070b0838a600f6a89c479b4ee8.

(imported from commit ba1dbfcaeef6bc1d5befb2d59122217f532065ac)
2013-04-18 21:45:59 -04:00
Jeff Arnold 33c8368734 Automatically condense long messages
Addresses Trac #747.

(imported from commit 057f08f2fcef43070b0838a600f6a89c479b4ee8)
2013-04-18 11:29:32 -04:00
Jessica McKellar 95d0f383f2 Update star title hover when you toggle it.
(imported from commit 46f66566c1c59619e45371f3cc51ba15dc645273)
2013-04-16 14:08:31 -04:00
Leo Franchi 9130f6722f Show latest 5 subjects in sidebar when narrowed to a stream
This is a V1 of this feature. For now, the only way to expand is by narrowing
to the stream---future revisions may add a manual toggle if it is found to be
useful.

Additionally, showing per-subject unread counts will be coming in a future revision
as well.

(imported from commit fb5df0d27e928fa3b0f32b9ff2c1c508202cf7e5)
2013-04-12 11:51:09 -04:00
Keegan McAllister 966545403b Move password strength bar update into password_quality
(imported from commit 054d9487e325cff819e80fb0e1cb85f5c0db42d8)
2013-04-10 18:05:01 -04:00
Keegan McAllister 5487f794a2 settings: Clean up API key box show code
(imported from commit a8fc8c769ae11cb0bdab882ead4531ade5d2b12b)
2013-04-10 18:05:01 -04:00
Keegan McAllister f399e29fe9 settings: Hide password change controls behind a link
(imported from commit 6d0f3861ef97f45231d388378f429974e876ddbe)
2013-04-10 18:05:01 -04:00
Keegan McAllister 481f07d948 settings: Move success / failure indicator to the top
And scroll there on any error (previously, we would scroll only if we end up
submitting the form).

(imported from commit 63597c4da78ac92cd5c2314d6d174d178b1caaf3)
2013-04-10 18:05:01 -04:00
Keegan McAllister 3e31646567 Add a password strength check on the settings page
(imported from commit 68ae1732e62be076a4619b522009a76215d69757)
2013-04-10 18:05:01 -04:00
Leo Franchi 8fe82085c4 [schema][manual] Automatically subscribe users to default streams only after tutorial
(imported from commit 6511851c0aee2628bef597bf1310d6f96b0fd1d4)
2013-04-04 17:11:39 -04:00
Zev Benjamin de1f4b0be2 Remove all inline event handlers
This allows blueslip to catch exceptions from the event handlers on
these elements in addition to the other benefits that not using
inline handlers provide.

(imported from commit 2bdcb2496c6c08fa7228a20ce6164b527cf64e41)
2013-04-04 11:34:32 -04:00
Tim Abbott 200fd7ff70 Fix clicking on streams in left sidebar from subscriptions page.
We previously had 2 mechanisms for narrowing used by the left sidebar
-- the top few links used the hashchange mechanism, while the streams
links used a custom click handler.  Both were buggy -- the hashchange
one hadn't been updated to just select the first unread message,
whereas the click handler didn't change tabs.

Fixes #1141.

(imported from commit 8a8af974e78cc5c33937ac0078f04a9b5452b94a)
2013-04-03 14:15:07 -04:00
Tim Abbott 3a93c8cc90 Fix pointer jumps on unnarrowing after certain scroll events.
This appears to have been caused by our code for preventing the
viewport from being recentered if you move the pointer away from the
edge of the viewport from a position near the edge, which was being
run even when it was not triggered by a scroll event.

(imported from commit 0a4b3dcca75a6e5dbf1beb77a5249bd6a9c61341)
2013-04-03 13:38:41 -04:00
Keegan McAllister 17d5406b55 [manual] Fetch Handlebars templates using Ajax
...rather than embedding them into index.html.

This is only acceptable for dev, but the next commit adds an alternative
mechanism for prod.

There isn't actually a manual deployment step here.  However, this commit won't
work on staging / prod without the next one (since we don't serve
zephyr/static/templates in prod).

(imported from commit dce7ddfe89e07afc3a96699bb972fd124335aa05)
2013-04-02 14:43:58 -04:00
Leo Franchi 9817ef3460 Remove url encoding from data-name attribute as we match via iteration
(imported from commit 737418c430991414124daff41b62383284e86dc1)
2013-03-29 15:44:21 -04:00
Leo Franchi a8816f81c0 Comment out blueslip scroll finish error to quiet emails
A ticket is filed and this error is not fatal to the UI but rather
a warning to investigate, which we will now do

(imported from commit 3f67ec2b503e91b3921e33b89febd97790e389f1)
2013-03-29 09:38:42 -04:00
Jessica McKellar ce66bdec5b Remove unused hotkeys.in_scroll_caused_by_keypress.
(imported from commit 65223a036e72489a41130a83e4537d0ccb80b90c)
2013-03-28 17:08:25 -04:00
Jessica McKellar 3df47f2025 Do not try to recenter if you were already moving in the right direction.
Before this commit, if you try to arrow around when the selected
message is outside the pointer threshold for recentering, you get a
big jump, even if you are arrowing towards the center of the viewport.

(imported from commit 5c15d5ccccdf027a8bfa8b79bf519fccbfa971d8)
2013-03-28 17:08:25 -04:00
Jessica McKellar 3d683a93bf Add the ability to toggle a message star and save it server-side.
(imported from commit 6d9eda14cddee9ce65a85deadac57925b1864f94)
2013-03-28 16:59:59 -04:00
Leo Franchi 0a419e51d0 Fix ui.set_count not finding streams that require url encoding in sidebar
(imported from commit c363669806f56650c6aecb66f7208ea692bfd613)
2013-03-28 14:44:57 -04:00
Luke Faraone 799e2873d3 Run decodeURIComponent over stream names before comparing them.
This resolves an edge case not handled in a previous fix to trac #1050.

(imported from commit 3fc142946b01de8955e1b52d4f4ebb36e584cdeb)
2013-03-28 11:24:38 -07:00
Jessica McKellar 297bc7f09b Don't hide the floating recipient bar when scrolling.
We made this change for performance reasons that don't exist now that
we only render a small portion of your messages, and it causes a
distracting flicker when you scroll through messages slowly.

(imported from commit 33379320f6b90d93ec8beac17323b287f8bb2485)
2013-03-26 14:06:27 -04:00
Keegan McAllister 6d9aca5f1a Move "page parameters" (email, enter_sends, etc) into a single object
(imported from commit 842b2371bf6364982f1358f1cd2d91118c7fb2bf)
2013-03-26 13:50:03 -04:00
Jeff Arnold a95b1a1a23 Revert "Automatically condense long messages"
This reverts commit 27244550d5d94980d7e33d8cc7c69708427dbbec.

(imported from commit e468051b8052d244beb09ba795605d70124254dd)
2013-03-20 18:45:12 -04:00
Jeff Arnold c92d664b44 Automatically condense long messages
Addresses Trac #747.

(imported from commit 27244550d5d94980d7e33d8cc7c69708427dbbec)
2013-03-20 17:39:15 -04:00
Leo Franchi 6263c9ba1e Unify calculation of unread-count for notifications and use it in the title bar
Fixes trac #1004

(imported from commit 6f04d1d3ded198b46cc2ff1733b94b5c17beb581)
2013-03-20 10:09:40 -04:00
Leo Franchi 96041be75c Use 'undefined' instead of -1 as sentinel
(imported from commit 30cc280d89cf0c290459f9d90960cd8eaf76a22f)
2013-03-15 10:51:25 -04:00
Leo Franchi 79dfe57840 Mark all messages between start of scroll and end of scroll as read
If the user scrolls super fast, our scroll handler might not catch
the user  passing by some messages.

(imported from commit 14cebffcd1321f02443971ac5e1c922db19648ab)
2013-03-15 10:43:17 -04:00
Leo Franchi 95c9c6817f Mark messages as read as you scroll by them
(imported from commit 7e4595dcbfe900bde7f062e3fe9e2d53c71b6884)
2013-03-14 15:51:21 -04:00
Leo Franchi 7510f87eac Select first unread when narrowing by clicking on stream in sidebar
(imported from commit 557751f44e3fee61b6a55f8f8328e2f97e6adc04)
2013-03-14 15:01:13 -04:00
Tim Abbott a0d0bdb5cf Fix copy/paste in compose box.
(imported from commit 075a461136e040b7d5d752e9386d9321d76c956e)
2013-03-14 14:55:14 -04:00
Leo Franchi ff42774551 Refactor unread client handling to use 'read' flags per message
(imported from commit ca48745396e7fbac456e5eb2e7dbe4adc62b3492)
2013-03-13 14:14:45 -04:00
Waseem Daher dffde7714c Don't have the presence list occlude the "More messages" popup.
The issue, prior to this fix, is that the presence list actually
gets drawn *on top of* our "more messages" popup, which is ugly.

(Toggling the z-index on either or both of them did not seem
 necessarily to matter, but that's probably because z-index
 is subtler than I understand.)

This fixes Trac #1078.

(imported from commit a255aadb1884cf6c659085b26a36d378f680e83e)
2013-03-11 23:28:37 -04:00