Commit Graph

1510 Commits

Author SHA1 Message Date
Zev Benjamin dc82d60c13 Remove no longer true comment
(imported from commit d06ce85ff76a8c9bd5691c004e9a77182ac295dd)
2013-05-09 10:35:46 -04:00
Waseem Daher 4892895d6b Additional always-visible-composebox fixups.
* Start a compose when we do a file upload
* Restore the "Formatting" and "Feedback" links.
* Dismiss composebox error messages when we defocus composebox

Realistically, the "correct" way to do this is not to have to
explicitly manage the composebox's state, as we do now -- it should
just be 100% visible and ready to send any time you click 'send'; it
shouldn't need to have first been composebox.start()ed.

(imported from commit 7f1725c229ed968a9b5500b25d600306173182a0)
2013-05-09 10:35:46 -04:00
Steve Howell cee31a4f4e Fix unescaped angle brackets in search typeahead.
This was a pretty recent regression in the logic for
highlighting search typeaheads.

(imported from commit ba226f9cc7d6b09744ea07ef516fee280f23e048)
2013-05-09 10:35:46 -04:00
Steve Howell 58c1110635 Put streams lower in typeaheads and kill off some dead code related to search
(imported from commit c7d50f44a4de6cc5049e51ef4b671cc49902c466)
2013-05-09 10:35:46 -04:00
Steve Howell 77d2d669de Fix highlighting for stream typeahead in compose box.
Recently the typeahead for streams in the compose box was modified so
that streams only matched queries when the query was a prefix to the
stream.  When that change was made, the old highlighting behavior
had been mistakenly left in place.  This commit fixes the highlighting.

(imported from commit b7ec33daba46978df58eb91306686a4f1a57c7fa)
2013-05-09 10:35:46 -04:00
Waseem Daher 328da1fa07 Assorted always-open-composebox fixes.
* Properly resize compose area when we cancel out of it.
* Re-enable clicking on 'reply' in popover.

(The issue with the latter is that clicking on "Reply" started
a reply and then bubbled up and triggered our code that canceled
a reply because you clicked out of the composebox.)

(imported from commit 25d0ea58b72d2ee246217baf3eb9cac58fc858f5)
2013-05-09 10:35:46 -04:00
Waseem Daher 9384870ffa Always-open composebox.
Really, the "correct" way to do this is to undo "scrolltheworld", and
then just have a compose div that always lives underneath the message
list div. (This will also allow us to deal much more reasonably with
the whole "Is the composebox in focus" thing.)

In the interest of prototyping something more rapidly, though, we
adopt the somewhat more hackish approach, with the understanding that
much of it will probably be simplified later.

(imported from commit e2754be155c522b6dac28e7b84c62bd2030217c8)
2013-05-09 10:35:46 -04:00
Steve Howell 96100bb42a Highlight search typeaheads for streams
(imported from commit e8725fe8c4f4985d46e48fdab5003e3e9def9bd1)
2013-05-09 10:35:46 -04:00
Steve Howell 667a47755e Highlight search typeaheads for senders
(imported from commit 80e16d47507b0c23103aa1e574961cc5e29cac6e)
2013-05-09 10:35:46 -04:00
Steve Howell e47b98df38 Highlight search typeaheads for private messages
(imported from commit e3c5525255c70e507f33f24fc305d4a268c87e42)
2013-05-09 10:35:46 -04:00
Steve Howell 8a8e7c22f1 Don't try to rebuild subjects for an unsubscribed stream.
(imported from commit 2fea180bd5c989cb9aac843c837200acb10ddbc6)
2013-05-09 10:35:45 -04:00
Steve Howell 64ba2864bc Match names w/prefix and turn off highlighting.
(imported from commit 4ebc4aba5d05173ad6b8176d47fdf062e23c1441)
2013-05-09 10:35:45 -04:00
Steve Howell 0f75cbd30f Match any word in stream for typeahead queries
(imported from commit bd6ee91ae880c7fb3dd118cd2f024820ced73466)
2013-05-09 10:35:45 -04:00
Steve Howell de8106d923 Refine search (sort people by # of pms, limit streams to prefix-only).
Also minor configuration changes and no need to clone list.

(imported from commit 9f9c7259ed479fc29cd66fe260d9d81017e5f48f)
2013-05-09 10:35:45 -04:00
Steve Howell 0164d9f757 Search typeahead has more suggestions and sorting.
(imported from commit 5386be57e7f0b820e1a9cbd166c9c43e5e72215b)
2013-05-09 10:35:45 -04:00
Zev Benjamin 26ea7e0897 Build the recent subjects list on demand
We previously kept the lists in the DOM for all streams and updated
them all when new messages arrived.  This was very expensive for
large numbers of streams, so we now just build the subject lists on
demand.

(imported from commit 937ad4322ce2014200aeae8645f79875f6af576e)
2013-05-07 11:47:13 -04:00
Zev Benjamin 8702d37028 Do narrow-related side-bar manipulation in event handlers
This commit also fixes a bug where "starred messages" wouldn't get
bolded when you narrowed to starred messages.  However, it also
introduces a regression where subjects aren't highlighted correctly
on load to a narrow which will be fixed shortly.

(imported from commit 411575d92762e41d04c1baf126c0ab1dfb4225a5)
2013-05-07 11:47:13 -04:00
Zev Benjamin ca95167da1 Move several initialization calls to after we've set up event handlers.
This will matter shortly as hashchange.initialize can call
narrow.activate(), which fires an event handler.

Really, I have no idea why we have these initialize() methods anyway
and we don't just do initialization on document.ready.

(imported from commit 3a6a80e1426b03439b95cae3f142a4b1c43125e9)
2013-05-07 11:47:13 -04:00
Zev Benjamin 43829b4288 Fire an event on narrow and unnarrow
(imported from commit f3e5e5435ea425c4d3887b43824e53a1c817fa6f)
2013-05-07 11:47:13 -04:00
Zev Benjamin beba14a86c Only call add_message_metadata once when receiving messages in a narrowed view
We memoize add_message_metadata by checking if the message is already
in the all_msg_list.  Therefore, we need to add messages to that
message list before we add it to the narrowed_msg_list.

(imported from commit 4346179376ef6f982162c02c6152a0d294bfb2c0)
2013-05-07 11:47:12 -04:00
Zev Benjamin 96129b1cf0 Speed up string comparison for sorting
The String.localeCompare function is really slow, at least partially
because it creates a locale-aware collator object each time.  So now,
when we can, we create and cache a locale-aware collator object.
However, this is not supported on most browsers, so we fall back to a
non-locale-aware comparison.  This is not ideal, but for now we are
mostly working with English-speaking customers.

(imported from commit 51aa02e3b9fe4a0ef0cb084874fe26e91c57f65e)
2013-05-07 11:47:12 -04:00
Leo Franchi 5e70253bf9 Only remove a filter when unsubscribing if subscribed
Addionally, print out a blueslip error instead of dying
if a stream id is accessed when there is no stream to get

(imported from commit 0d6466ca79312a4fb9a235f313303ac5246afb35)
2013-05-06 13:52:35 -04:00
Leo Franchi 57d5bcf1f8 Only update unread counts if you're subscribed to that stream
(imported from commit 100047ad6ca1818cdf1c19dfafd0b2e06d95e380)
2013-05-06 13:52:30 -04:00
Leo Franchi 0da2f51ddb Calculate presence information with delta between server timestamp
(imported from commit b4b367ed620878e6d01287cb1aaae0730c7475c8)
2013-05-06 13:52:23 -04:00
Luke Faraone 6bc2d21b87 Make audible notifications a tunable.
This decouples from Chrome notifications, which gives us cross-platform
support in at least modern browsers.

We log this action so its replayable in our message logs.

This implements the model change indicated by the previous schema commit.

(imported from commit b21213cdde54f43670bbb0bf1f607147fc732b38)
2013-05-03 15:08:49 -07:00
Luke Faraone 734b91c8d4 Play a sound when you recieve a desktop notification in the app.
We test if the user supports sound in their browser, then determine which
sort of sound their browser supports.

When, whenever we show a desktop notification we also play a sound.

(imported from commit dae41e70a6e4f6ed60ffedaac546d77baee52675)
2013-05-03 15:08:48 -07:00
Steve Howell 6304a30257 Handle multiple casings of same subject in subject list. (#1227)
(imported from commit f1f675cd96a6d26c5b039d8f41c9373bc365cb45)
2013-05-03 14:28:23 -04:00
Tim Abbott 54ae352e83 Fix narrowing to a stream/subject pair when not subscribed.
(imported from commit 0ea2893dc6026df5316dd927f7d740c74dc2c02e)
2013-05-03 11:40:06 -04:00
Luke Faraone b77ca230ab Fix JS lint error in composebox_typeahead.js
(imported from commit a0008e895e439b37658d31449587d20763e52aa7)
2013-05-03 08:20:45 -07:00
Leo Franchi 9362731e4d Mark messages behind pointer as read when moving pointer
(imported from commit 7e1d3d7124aec239a8fdd24da4aab682a41ff435)
2013-05-03 11:14:47 -04:00
Leo Franchi 33eef54c5b Re-send unread message counts if XHR fails
(imported from commit 062e76ca7db177540ed4e9ab0d331b9ecc2ee5f1)
2013-05-03 11:14:46 -04:00
Steve Howell fa5a7fbf0b Force prefix match on stream typeahead in compose box.
(Also allow up to 3 matches.)

(imported from commit 88d707cedc88ab55685e6b03dbd7c87caa05057d)
2013-05-03 10:12:43 -04:00
Tim Abbott 6b85eaf16f Only mark messages in all_msg_list as unread.
(imported from commit 8c76ee8be918beeea44e70cba702fa45abff2297)
2013-05-02 15:35:46 -04:00
Tim Abbott f6fb62ca93 Fix narrowing to stream names that don't exist.
(imported from commit 2d0ff1ffdf32eef6df56d6e9ab00c9c6e4e7ee6a)
2013-05-02 15:35:46 -04:00
Tim Abbott 03fe751005 Clarify confusing narrow-by-stream selection of active stream.
(imported from commit a90059ed62c47ac03bca0fa306adeca3ce577d43)
2013-05-02 15:35:46 -04:00
Tim Abbott 525a20de2e parse_narrow: Handle malformed narrow URLs gracefully.
Since they can't be parsed, probably the best thing to do is to send
the user to the home tab; we could add in showing an error message but
then we'd need a way to clear the error message -- better to just have
this work.

(imported from commit 67c0475ff06eb0431621eef60b9c50287a158232)
2013-05-02 15:35:46 -04:00
Tim Abbott 2c9c5f6093 Clean up code duplication when calling add_narrow_filter.
(imported from commit da397f015427e7c5b01fa1e89ba119ff87cda168)
2013-05-02 15:35:46 -04:00
Tim Abbott e7d04ff60f Fix encoding of narrows with '.' in the URIs.
(imported from commit fa624c0f810817b8093aeb4e3fb4329cad4cf9fb)
2013-05-02 15:35:45 -04:00
Steve Howell c02540bfa6 Show lock icon in compose box for invite-only streams (811)
(imported from commit c563fa605d850f39c3b3f0ae9530700f1d1b6e73)
2013-05-02 13:39:34 -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 3b6713d545 Improve message_range's running time
We also now check that start != -1, as that is probably a mistake.

(imported from commit 7065ed40150fda7b373d137129c0944a8fa03fc1)
2013-05-02 12:03:18 -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 16cd33f756 Only pick a new color if the new subscription doesn't already have one
(imported from commit 7ccba8ab3ee52e81a8e553a43dce4c8bfc17f1fc)
2013-05-02 12:03:18 -04:00
Zev Benjamin 419f49c8be Cache the available colors instead of recomputing it each time we pick a new one
Since we pick a new color every time we add a new subscription and
recomputing the available colors was linear in the number of
subscriptions, we were doing quadratic work on page load.

(imported from commit 647ff3cb82f405755711da47701f005e7bc0023e)
2013-05-02 12:03:18 -04:00
Zev Benjamin 54bd4516ed Only update recent subjects after all messages in a batch have been processed
We were previously doing this on every message.  Because
update_recent_subjects is linear in the number of streams in the
sidebar, this became very slow when we enabled the streams sidebar
for the MIT realm.

(imported from commit 95cd71d83bbcc08cc6c5c79ca567b5d6b9b17173)
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
Zev Benjamin ec3c0fffb7 Remove no longer true comment
(imported from commit 84c4e6bfbf16460efe5703e1a4213383a27fbe79)
2013-05-02 12:03:17 -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
Zev Benjamin e1c8d2f50f Return match_subject and match_content from messages_in_narrow()
This fixes a bug where if you were narrowed to a search and received
a new message that belonged in that search, the message would appear
to have an empty subject and content.

(imported from commit fe1dbf584d3659d57c5b70c7eb45cb22bbc9732f)
2013-05-01 21:52:04 -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 9f0fc7c031 blueslip: Include window.location.href in error reports.
This can be useful for debugging what sort of narrow is happening in
addition to the URI decoding bug we're currently experiencing.

(imported from commit 0cb55fec4ac1afa986c747eb79236b4300c9e636)
2013-05-01 16:10:35 -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
Zev Benjamin c08a86aeb9 Use server-highlighted subject and content when narrowed to a search
(imported from commit 0579193da040db77f9c7937d3714cb9ffeaf7ed8)
2013-04-30 11:40:27 -04:00
Zev Benjamin 8b3e800bf5 Use the filter on MessageLists when adding messages
(imported from commit c9070e5413352aef612b4763c35a4c72f4ecb852)
2013-04-26 17:45:25 -04:00
Zev Benjamin 8474675076 Attach Filters to MessageLists
This should allow us to stop special-casing the narrowed message list
as much.

(imported from commit 1eb7216fbd8aa16b796c239a189d6ce0008344f9)
2013-04-26 17:45:25 -04:00
Zev Benjamin 4f4e982ed1 Don't do narrows with search operators on the client
(imported from commit 98e6a06f5c10a384e6295b3281d23a061ecdecab)
2013-04-26 17:45:25 -04:00
Zev Benjamin 3b8b8a7d4e Fix 'in' search operator
(imported from commit b42c9ef8d00c92ea117f124b933791478098c5b7)
2013-04-26 17:39:08 -04:00
Zev Benjamin c5c0a2ab45 Canonicalize Filter operators early
(imported from commit c251fab94970c127708c1b40b25e57d4afeb7ce9)
2013-04-26 17:39:08 -04:00
Zev Benjamin 0c15db4aff First steps towards making narrow.js more object-oriented
There's still a lot to do here.  For example, the external code
should probably go through the new Filter object directly instead of
indirectly through the narrow module.

(imported from commit 22dcd31cdebd51453f1658af52a4432b2fe7a4cb)
2013-04-26 17:39:08 -04:00
Zev Benjamin 6cdc3f67df Only fetch an extra message in get_old_messages if a narrow isn't specified
In the case where we're getting old messages for a narrowed view, the
anchor message id might not actually be in the result set so there's
no reason to fetch an extra message.

(imported from commit e610d1f2cb95be3ff9fce6dc95e40c560bc5bf84)
2013-04-26 17:39:08 -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
Waseem Daher ccc5363f3c Make text-underneath-compose-box all nicely line up together.
(imported from commit d4676d95ccad18f65a29447647581b41d53dfa9a)
2013-04-24 17:49:45 -04:00
Michael McCanna ce1389dc35 Remove double subscription when "creating" stream
When you create a stream that you'd previously created (then unsubscribed from),
it was possible to end up in the subscribers list twice. Once came from loading
the subscribers list from the backend, and once came from a bit of mark_subscribed
logic that only gets called if you've subscribed to that stream at least once before
in the current session.

resolves trac #1196

(imported from commit e47ff139a9c25b1b8689ea6795dfad96ae8d2591)
2013-04-24 16:21:14 -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
Tim Abbott 1c57956bf6 Avoid an unnecessary load_old_messages call on page load.
Previously, our check for whether we needed to call load_old_messages
a second time on page load to get up to the present caused us to
basically always do such a call.

(imported from commit b599041e8c0853b4c8c9ab2def6679142302523e)
2013-04-24 10:44:56 -04:00
Waseem Daher 5f28cf8e02 Restore tutorial's ability to see what you send.
The internal format of 'message' had changed, so prior to this commit,
the tutorial was receiving (a) internally inconsistent, and (b)
not-what-it-expected versions of the message.

(imported from commit 233b934e6b600bd59125d133fdf7443fd8f6bbf8)
2013-04-24 10:35:25 -04:00
Waseem Daher eab43f28f4 Properly compute the name of our tutorial stream server-side.
It's subtle, but the slice was in the wrong place and wasn't
actually truncating the stream name at all, so the client and
server disagreed about where the tutorial messages should go.

(It might be the case that we should accept the tutorial stream
name from the client directly, rather than computing it in two
places.)

(imported from commit 8273223f182e8ad36eaea1cbf75e1426fcfdfbab)
2013-04-24 10:32:30 -04:00
Waseem Daher c05c391c31 Use '===' instead of '==' to make the linter happy.
(imported from commit 6fee035ab4531d64ece6a49501f275c64e0f2265)
2013-04-24 10:32:30 -04:00
Waseem Daher 5951c7eb00 Don't send tutorial timeout message if we're no longer running.
If the system was waiting for you to reply and you replied 'exit', the
tutorial would stop -- but our thing that was waiting for you to reply
would continue waiting. It would eventually timeout and send you the
heartbroken "I didn't hear from you so I stopped waiting" message.

Chances are, you were unsubscribed so you didn't see it, but we
should still just not send it.

(imported from commit 694e442bc29b32efd59f08b4b8b5f573768aea21)
2013-04-24 10:28:33 -04:00
Jeff Arnold a251b12ec7 Don't trigger two events when our app changes the hash
(imported from commit c17a82b043c10927de149b105c6ceea5175b6f4f)
2013-04-23 16:13:26 -04: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 0c657f6fc5 Process collapsing every time we show new content
(imported from commit 21899206e9012023d3fec08f3990474fa38047e7)
2013-04-23 16:13:26 -04:00
Jeff Arnold 1cf946969d Fix name of hashchange.zephyr event in changehash
tabbott noticed this mistake during some pair programming

(imported from commit 3b5885f50929e3ed0062eef4e5f3aba0a14d52bc)
2013-04-23 16:13:26 -04:00
Tim Abbott c4e4b481bd Increase the threshhold for triggering collapsing./
(imported from commit c09b5ac43b4521bcbb2ab3feb5334fc9cf9ba1a5)
2013-04-23 16:13:26 -04:00
Jeff Arnold 3f68ff3ac3 Don't collapse messages that would only be collapsed by a small amount
(imported from commit 2cdd1ef1c731c7e6ac122f431ccf91d41d8f9234)
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
Michael McCanna bd00e2609e add mouse movement as a trigger to stop autoscroll
(imported from commit 746bab4983d8267e5c37c0232f04e2c8f9f06e2d)
2013-04-23 13:23:07 -04:00
Tim Abbott 71203a996a Fix autoscrolling on new messages.
This was apparently broken by the final revision of our fix to the
autoscrolling+narrow bugs, because it attempted to use jquery's
animation queues to restrict which animations were stopped, and this
doesn't seem to work.

(imported from commit cf97f9f56dc5a16d1aa0322b5e6ec432a76d3be2)
2013-04-23 12:54:59 -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
Zev Benjamin 41e2bd3f40 blueslip: Fix BlueslipError definition
This fixes a problem where normal exceptions weren't triggering
blueslip.

(imported from commit 1cc0f8bcf0676eb2aa34ebd74d93af29251c5823)
2013-04-22 16:04:51 -04:00
Tim Abbott 26b0eb341e Fade around new recipient when restoring a draft.
(imported from commit 7888ae124bfba150b354ba27cb12c99364b43263)
2013-04-22 11:14:56 -04:00
Jessica McKellar de902be108 Add client support for restoring a message draft.
(imported from commit 64da07d4f9a7ba8e1548271f98e455ecd202da4a)
2013-04-22 11:14:03 -04:00
Tim Abbott 679c409ca3 Rename message content option to compose.start to content.
(imported from commit 4d609e6f6915af4474955b054d834efaba4327b9)
2013-04-22 11:14:03 -04:00
Tim Abbott bc60be9ad5 Clean up the send_message processing of the message recipient.
(imported from commit 1e6d7783901743650cfb759b3136ae1de0f2989e)
2013-04-22 11:14:03 -04:00
Tim Abbott de5038f4d7 Store the recipient stream name in message.stream.
Previously we were using message.display_recipient everywhere, which
is actually pretty confusing.

(imported from commit a58471172e28c039af8e290362e54b6660543924)
2013-04-22 11:14:03 -04:00
Tim Abbott 6e00c9ca3d util: Compare recipient streams by name, not recipient id.
This is more consistent with how we compare subjects etc., and can be
used for comparing the subjects of a potential future message that
doesn't have a recipient id yet.

(imported from commit 93251c62dc74b3f12c6140b12fc8d6c756d35f37)
2013-04-22 11:14:03 -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
Leo Franchi 1d930e8c43 Show paste file name when pasting
(imported from commit 8648ef26085f5f01fbc1ddf85b2de1ad1bab2967)
2013-04-19 18:04:50 -04:00
Leo Franchi 80e8e7b21e Allow dropping of raw text and urls without showing an error
Don't show an error if we can't handle the drop contents, since it may
just be empty rather than being a browser unsupported issue

(imported from commit 986495b4a94f4afacf75ffb35ea507d86c369b2f)
2013-04-19 18:04:50 -04: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 13f5d30d83 Revert "Don't collapse messages that would only be collapsed by a small amount"
This reverts commit 56e8df87d3eae62080962474eae23ab75f009819.

(imported from commit 15d71ab73d269eaa3d8a2f52c5781290ee183627)
2013-04-18 21:45:34 -04:00
Jeff Arnold 955f1febdf Revert "Increase the threshhold for triggering collapsing./"
This reverts commit cd1dac8b4726cef82eb2dc957fc7edced298fa9c.

(imported from commit 6ddaad88d3d2b402ef162e5b9a7e450238feb5fd)
2013-04-18 21:45:13 -04:00
Tim Abbott 3811bcc025 Increase the threshhold for triggering collapsing./
(imported from commit cd1dac8b4726cef82eb2dc957fc7edced298fa9c)
2013-04-18 15:39:45 -04:00
Jeff Arnold cce1213320 Don't collapse messages that would only be collapsed by a small amount
(imported from commit 56e8df87d3eae62080962474eae23ab75f009819)
2013-04-18 13:17:22 -04:00
Luke Faraone ea7965d9bb Rework API documentation to cover all supported calls.
We now generate our API documentation page based off of JSON source.

(imported from commit 0e8a91ef4278684dbcad89cad39a1977672245fc)
2013-04-18 09:57:56 -07: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 1bd5f788b3 subs: remove redundant call to add_sub after create_sub.
(imported from commit ad47d9e9964a850892baeff17d3c94cfedbc9f0f)
2013-04-17 13:27:48 -04:00
Jessica McKellar 3e9e8eec1b tutorial: move script creation down the file to appease the linter.
(imported from commit 77b2b18874a19b39ec0a60c3c25b8459b50ce9ee)
2013-04-17 13:27:48 -04:00
Jessica McKellar 7d389d8c13 tutorial: fix broken pipelining of asynchronous requests.
Some functions invoked by the make_script framework weren't returning
their Deferreds. I noticed this as the hello stream not getting picked
correctly because loading your real subs hadn't completed yet.

(imported from commit fac3fa36b77585bd5c03bf8fbaec052fe397a481)
2013-04-17 13:27:48 -04:00
Jessica McKellar e15dd90bd9 tutorial: don't recommend saying hi on a tutorial stream.
Now we don't unsub you from it until after we've picked the hello
stream.

(imported from commit b1489007e972af7713804ba5ff98764a6393a0b6)
2013-04-17 13:27:48 -04:00
Jessica McKellar 750b8326d7 subs: fix incorrect stream_info re-initialization.
Using [] doesn't cause incorrect behavior, but it's a mismatch with
how stream_info is initially declared and gives you a confusing
representation at the console.

(imported from commit c03d9e6a29ff990659f41ee478f631a019a5ac25)
2013-04-17 13:27:48 -04:00
Jessica McKellar 6b4196a74a tutorial: fix race that could cause you to not see the goodbye message.
(imported from commit 52afce208890dbd863fc1661729e4351160d09ac)
2013-04-17 13:27:47 -04:00
Jessica McKellar 3945335e6e tutorial: don't let punctuation get in the way of exiting.
(imported from commit 7b97f382684bd2ddb92fc3efa6e1a635c4662aef)
2013-04-17 13:27:47 -04:00
Jessica McKellar a76977f57f tutorial: don't let the tutorial recommend saying hi on a non-existent stream.
Previously we added some names to your subs to use them as examples
during the tutorial. We no longer do that, but the tutorial could pick
a name from that list to recommend that you say hi on, even if you
aren't subbed.

Don't do that, and instead try to pick a stream that is in turn:
* your company name
* a probably-good stream name like social
* a stream that is hopefully not an alert stream like nagios
* eventually give up and pick anything

(imported from commit ec20c7722ea95b025dec62bcf47e33c62d1a8029)
2013-04-17 13:27:47 -04:00
Jessica McKellar bb315d4033 tutorial: remove CUSTOMER18 customer18stream1 hack.
(imported from commit b333fe10bf22aa5471b672fd51b2426191f259bf)
2013-04-17 13:27:47 -04:00
Jessica McKellar ac4385e410 tutorial: don't start the tutorial until you're subbed to the tutorial stream.
Also handle the case of subscribing failing.

This race could cause you to not see initial traffic from the tutorial bot.

(imported from commit 395a2968555e20a4dbc106dfa9d5790e9f102a3e)
2013-04-17 13:27:47 -04:00
Jessica McKellar 1c437cb0ff tutorial: return the $.ajax Deferred from the subscription requests.
(imported from commit d9154b00720b6055077e4f0e7f92313d121032b4)
2013-04-17 13:27:47 -04:00
Jessica McKellar 6a0c1f66d8 tutorial: factor setting tutorial status into a function.
(imported from commit 3ec355e3bcad25bbe8dceb9a1fdb9e8cce5156ca)
2013-04-17 13:27:47 -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
Tim Abbott 82da2bec10 Add trailing bookend with current subscribed status in some narrows.
This is basically just the logical extension of the previous commit
for the case where the last thing we did was subscribe or unsubscribe.

This even magically updates when you subscribe or unsubscribe from
another window :).

(imported from commit 2399329d11bf66aa0b614a21d2b3cf4035452279)
2013-04-12 15:43:41 -04:00
Tim Abbott bad18f6971 Display heading on boundary between historical and non-historical.
(imported from commit b1669725d5a10ae086d04d0aa03341bcb0b8b858)
2013-04-12 15:43:41 -04:00
Tim Abbott 738ed84b5d Call load_old_messages on all narrows, empty or not.
This is required to get historical messages that might be within the
message ID range of your home view.

I think we could avoid calling load_old_messages on every narrow by
tracking when the user last subscribed to each stream, and if the user
subscribed before the first message in the current home view message
window (aka the messages used for the fast-path narrowing), don't call
load_old_messages.  This would happen almost every time.  But it would
require a schema change to do this.

We also remove the load_more_messages call from hashchange.initialize.
It is no longer required now that we're calling load_old_messages on
each narrow anyway.

(imported from commit 1c78c183e61392429592ae89d566315be7be8999)
2013-04-12 15:43:41 -04:00
Tim Abbott c56b0074e4 Fix visiting the app via a narrowed URL.
(imported from commit 1946f2b8f3ffba0729e4ad975aeac1887a0ed437)
2013-04-12 15:43:41 -04:00
Tim Abbott 6ca1cf8978 Rerender the message list when receiving out-of-order messages.
This should fix the problems we've been having with out-of-order
message deliveries, and is also an important prerequisite for showing
historical messages.

(imported from commit 77a18a526bf8ec4f1f70b776ac8b7e189d00bcf4)
2013-04-12 15:43:41 -04:00
Tim Abbott 13317c08b0 message_list: Remove ignored last argument to _render.
(imported from commit 95c1a40028d3cf40943cf195be9d288153e4e574)
2013-04-12 15:43:41 -04:00
Tim Abbott ca4baa01e0 load_old_messages: Clean up for_narrow parameter.
(imported from commit 1be9959ec3998371f24f9d11a9aa87e59d85aabf)
2013-04-12 15:43:41 -04:00
Tim Abbott 12416bb128 add_messages: Remove unused opts argument.
(imported from commit 5805348c39ec0db54b6bc6939ce2d85b4896500c)
2013-04-12 15:43:41 -04:00
Leo Franchi ecdb2acf79 Chop subjects to max of 5 regardless of timestamp of incoming messages
(imported from commit a58cd25d9c129729e0eb42ae090f4c715b5e20fe)
2013-04-12 12:47:41 -04:00
Leo Franchi f6984e4d23 Sort subjects properly
(imported from commit e2cb3d3c7e6dd3de09ffcfc6622e524fc4b7ff7d)
2013-04-12 12:28:04 -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
Leo Franchi 302cfcd48c Send client information for initial presence and process time differential
(imported from commit 99a51b7cc8b6c51c4e82757a984d07603b2980e3)
2013-04-12 09:11:40 -04:00
Leo Franchi 5d4b2305fe Send presence updates when a new user logs in for the first time, and when returning from inactive
This commit will incorrectly list past-online users as active, a shortcoming that is
addressed in the next commit

(imported from commit b018767df686f88c0ca939c067c573e4d7cea357)
2013-04-12 09:11:40 -04:00
Keegan McAllister ea3ce9c835 Accept any password with at least 6 characters
(imported from commit c6a7d7772820cee49eaaaa6c726a7f194a96e7f8)
2013-04-10 18:05:02 -04:00
Keegan McAllister af25f8a5f1 Add password strength checks to password reset
(imported from commit 3723d2bfa6012c3d4cef2199c5efd3530e9e6d2b)
2013-04-10 18:05:02 -04:00
Keegan McAllister 0962f7399d signup: Rename validation method
Otherwise it applies to all password-type <input>s, which is not necessarily
what we want.

(imported from commit da2bb86961f4ff1dcc48e89e51abac6dbea79548)
2013-04-10 18:05:02 -04:00
Keegan McAllister 01a20d9c56 signup: Don't display password validation message immediately
We now have the bar color to indicate (for most users) whether the password is
valid, so revert to the default validation behavior and don't validate before
the first blur.

(imported from commit 5c2f6e05a8796033942a2af62f244b61459ff1bb)
2013-04-10 18:05:02 -04:00
Keegan McAllister 1211061f6a Color the password strength bar red or green
(imported from commit 6b3fa7d3565a7e4f61a952fc26e1e9e564d894f9)
2013-04-10 18:05:02 -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
Keegan McAllister 07bb220194 Add a password strength check on the signup page
(imported from commit a44101485e49fd7a7951bda05ba10a021b6d3ee0)
2013-04-10 18:05:00 -04:00
Keegan McAllister 447dc0029a signup: Fix and clean up validation highlighting
Fixes #1154.

(imported from commit f50a3cb24d66e09b768e4e0702308c1c7f2c51d9)
2013-04-10 18:04:59 -04:00
Keegan McAllister c65f9b548f signup: Remove error / success class setting for send_confirm
Also seems to have no effect.

(imported from commit 2e2f913ee0f0f3b0620153bde68b8179ebb781a5)
2013-04-10 18:04:59 -04:00
Keegan McAllister 498ac0ed52 signup: Remove validation-failed class
It seems to have no effect and does not appear anywhere else in our repository
or in jquery.validate.min.js.

(imported from commit c4d2f730f3b680e15af17cefee34f6930e64ade0)
2013-04-10 18:04:59 -04:00
Keegan McAllister 63d739ef17 signup: Rename forms
(imported from commit cd7e90aa56da4982b627af757f8c4684f5103bc2)
2013-04-10 18:04:59 -04:00
Jessica McKellar 19d93ba970 invites: correctly focus on the email textarea once the modal is visible.
(imported from commit 97aa226f892b726e7456184a0d671e4f51079d3d)
2013-04-10 16:58:17 -04:00
Jessica McKellar 8ed1229328 invites: clear e-mails before showing modal.
Otherwise, if you get an error those e-mails are still around the next
time you try to invite someone.

(imported from commit b521a74f4d6c0d67271f804221f519d1aa7551ff)
2013-04-10 16:58:17 -04:00
Jessica McKellar 69753f228c hotkeys: fix assumptions that message lists are non-empty.
This fixes user-visible browser errors caused by trying to use the id
of messages in an empty message list.

One error could be triggered by trying to go to the end of your feed
with the End key during a reload.

Another could be triggered by trying to narrow to a stream or subject
using hotkeys while in an empty narrow.

(imported from commit a0e5456fd3b475aecac6eddd7104772baaf3aeb8)
2013-04-10 16:36:11 -04:00
Zev Benjamin f6a6a6b220 Add per-stream desktop notifications
(imported from commit b4a0576847b3aec1495f017ca9805febe80c9275)
2013-04-10 16:11:27 -04:00
Zev Benjamin b8a5ba56b9 Make check-box subscription settings' HTML more generic
(imported from commit 58c02449245bd03eedab1ee6eabebdbd972d1678)
2013-04-10 16:11:27 -04:00
Zev Benjamin 3424bbd8d7 Reduce client-side code duplication in setting stream properties
(imported from commit 879384fea499a2d30104d2bc1d96f16dbd867532)
2013-04-10 16:11:27 -04:00
Zev Benjamin a2010871e3 Make subscription properties less free-form
(imported from commit eda607c2abfa51d2dadddc7b9ecba3e2d0b5be4d)
2013-04-10 16:11:27 -04:00
Tim Abbott da8fa73a92 Fix duplicate narrow.deactivate() call via hashchange on Chrome.
I noticed that on chrome, calling narrow.deactivate() actually ended
up calling itself recursively due to the hashchange code not correctly
handling the fact that in Chrome if you set

window.location.hash = '#';

and then read out the value, you get '' back out.

(imported from commit 9b5047fbe0e2ac1846e5325d066c72306634c523)
2013-04-10 11:02:35 -04:00
Tim Abbott 55f606b417 Fix scrolling bug when unnarrowing after receiving a message.
What was happening is that if you un-narrowed immediately after
receiving a message (e.g. because you just sent it), the autoscroll
animation from the zfilt table would still be running after you return
to the home view, resulting in the viewport being scrolled to an
apparently random point in the home view (even though the pointer was
still in the right place).

This cancels the autoscroll animations whenever you do one of:
(1) hashchange (e.g. to go to the settings page)
(2) select a message (covers narrowing/unnarrowing as well as keyboard hotkeys)
(3) mousewheel scroll
since those are basically the cases where we set the viewport
scrolltop directly.

Arguably this should instead be something where we somehow detect
which scroll events are triggered by what and cancel for any scroll
event not from the animation or rererendering, but that seems hard.

(imported from commit f776021303404c87b36241c733b3d1bcb083163b)
2013-04-10 11:02:32 -04:00