Commit Graph

116 Commits

Author SHA1 Message Date
Steve Howell 9c994265c6 Randomize stream color assignments.
This fixes trac #1357, which says that some users get annoyed
when the system keeps generating the same color for them, which
would happen if they didn't like #76ce90 and kept picking a
new color for their streams.

(imported from commit 0fdb726aad4009332cc056a5e98bb39e01ef414c)
2013-08-08 18:22:44 -04:00
Steve Howell 7d67716c21 Simplify code to generate new stream colors.
Instead of splicing up a cloned copy of stream_assignment_colors
every time somebody uses a color, we just rebuild a hash
of used_colors from our subscribed streams when we need to assign
a color, and we avoid calling into stream_color.pick_color() when
a stream already has a color.

This change has a slight functional impact in the situation where
a user unsubscribes some streams during their session, because
we weren't "reclaiming" colors before on unsubscription, but the
simple approach gets that for free.

(imported from commit adf360365bdf1ae9db99c533a0bde62d91f5dfe8)
2013-08-08 18:22:44 -04:00
Steve Howell e36fd929bc Created stream_color.js.
This is a pure refactoring that mostly just moves code from
subs.js to the new stream_color.js and updates module references
accordingly.  In order to prevent introducing some exports,
update_stream_color was given an additional "sub" parameter
and update_stream_sidebar_swatch_color was given an "id"
parameter.

Killed off unused initial_color_fetch var.

(imported from commit b7644ce67f50d31fb46f564d758d661eea776aa6)
2013-08-08 18:22:44 -04:00
Kevin Mehall 2dfcd7876d Copy only specified properties from messages to summary row fake messages.
See previous commit message for why.

(imported from commit 53241f3aab3ec48a90cd9a280a0e5ec4a19e33cd)
2013-08-08 17:54:52 -04:00
Waseem Daher 49849a214f New onboarding step: Set up an integration.
(imported from commit 2c6cc6f703e893b44b2871c9510e858743d417ad)
2013-08-08 17:23:27 -04:00
Waseem Daher 1e92b17b1a Replace "Get the app" popup with a link.
The popover had a tendency to be obnoxious and hard to close.

This fixes Trac #1661.

(imported from commit d0ad8bd5b643abd9e7add76bc029458dacbd76cf)
2013-08-08 17:23:27 -04:00
Steve Howell 71e138b1aa Suggest more topics.
Examine up to 300 topics for search suggestions.

(imported from commit 8d52dd4d857818dcf59222bfdd956ee800342894)
2013-08-08 14:53:11 -04:00
Kevin Mehall 9be559858e Summarization style improvements
(imported from commit 4029d96d60cae0c6856067a696a842c39f4248e3)
2013-08-08 13:04:01 -04:00
Kevin Mehall e03f3dabc1 Make Enter on a summary row expand it.
(imported from commit 4ad44a96a225f6cfbb7d4f62ebf7c62298dd730b)
2013-08-08 13:04:01 -04:00
Kevin Mehall 5f48eebc8a Separate hotkeys that require messages from those that don't.
Fixes the blueslip error on "i" in empty narrow.

Also removes a then-uncessary check from do_narrow_action as suggested
by acrefoot.

(imported from commit 10b1f702b535b4eef54e500ccef93b6a5280e953)
2013-08-08 13:04:01 -04:00
Kevin Mehall 2664002dec Make summary rows selectable.
We represent summary rows by the ID of their first message for
for selection purposes.

(imported from commit 9f3c4d23f6b1295b117d5197e214de983bb2cc20)
2013-08-08 13:04:01 -04:00
Steve Howell 722c1b1a43 Allow user to change their API key.
(imported from commit b7c50779d0209c6e6600b59c8760a81273fe2454)
2013-08-08 13:03:09 -04:00
Steve Howell 0b4c37ef8d Autocomplete names w/spaces in search.
See trac #1356.

(imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
2013-08-08 12:54:20 -04:00
Kevin Mehall 0b9497305f Add defensive checks against undefined messages to _is_summarized_message.
Should fix the issue with empty realms.

(imported from commit afca70ebf3b7b74ae0d0c269c72b4f8d54fc254b)
2013-08-08 12:47:23 -04:00
Tim Abbott 87f8c9333c Rename Humbug => Zulip in app screenshot filenames.
(imported from commit a1a753143e77e0efd1de727378d505815a6d44d3)
2013-08-08 10:22:32 -04:00
Kevin Mehall eb2e8a15c3 Fix "Selected message id not in MessageList" caused by summarization.
Summarized messages are not shown and cannot be selected. If
`opts.use_closest === false` and you try to select a summarized
message, we still have to use the closest instead of failing.

Eventually, we'll make summary rows selectable, but that would be
rather involved since selections are managed by ID, summaries exist only
in the DOM, and many parts of the code get the selection and expect
it to be a message.

(imported from commit 998c4f24aece84528cc9da53a47f9e4f5391702d)
2013-08-07 15:07:47 -04:00
Leo Franchi 3cd012931b Use _.has to guard against subjects called hasOwnProperty
(imported from commit d1665c8b9b9a3963cff38ed2e9b84ed87a71dfd8)
2013-08-07 15:01:12 -04:00
Scott Feeney 68251256eb Fix missing $ that broke loading in Firefox
Bug introduced in commit f5f441ab90bcdb8404e05caea3c6da81a3a6fc1e

(imported from commit 94fb90cc12ccf8e1c0ad121be25dae897516679a)
2013-08-07 14:15:34 -04:00
Jessica McKellar ccd2433345 Let the browser scroll happen before our scrolling on a (re)load.
On a page load or reload, the browser will, at an idle time, scroll to
the top of the page. We can't intercept this browser-induced scroll,
so to make sure it doesn't in interfere with our scrolling to the
correct place in your message feed, we let the browser scroll happen
before the work we do on page load.

(imported from commit f5f441ab90bcdb8404e05caea3c6da81a3a6fc1e)
2013-08-07 13:51:47 -04:00
Jessica McKellar 5b38b763d9 Move the get_old_messages success work into its own function.
We'll need to set timeouts on calling this function.

(imported from commit 02b8322ae3cd68d714c2ccf4b5bece075cc8d27f)
2013-08-07 13:51:46 -04:00
Jessica McKellar a1f760dedb ui: Move the scroll handlers into top-level functions.
We'll need to be able to invoke them in event handlers.

(imported from commit 4487f711b59af0ccbc3f94c34e99c96228942add)
2013-08-07 13:51:46 -04:00
Jessica McKellar 7347bc7213 Consolidate the multiple zephyr.js onload functions into a single
function.

It's easier to keep track of everything in one place.

(imported from commit 2ff55fd8ee7c3ff465644ad4b921bf6efa97d02c)
2013-08-07 13:51:46 -04:00
Steve Howell 8bff4779e6 Leave the pointer alone more when it's at the top.
This commit makes keep_pointer_in_view() less aggressive when
the pointer is toward the top of the screen.  If the pointer is toward
the top of the screen, then as long as it's fully on the screen, we
don't pull the rug out from under the user and change the pointer.
An important benefit of this change is that we fix trac #1608,
which was a bug where autoscrolling interacted with
keep_pointer_in_view() to push messages past the top of the screen
before they were read.

(imported from commit e39926df99bfaedd5c0757f1241887ccd9b93fab)
2013-08-07 13:49:08 -04:00
Steve Howell 990df18d07 Refactor keep_pointer_in_view().
The helper functions now return true when a message is on
screen, not when it's off screen, and the names have been
changed accordingly.  I also eliminated the at_end parameter,
which was kind of abstract, by having message_is_far_enough_up
and message_is_far_enough_down handle those details.

(imported from commit cdb1543e430f49f23eb1b3a88d9aaff95ce7ca74)
2013-08-07 13:49:07 -04:00
Kevin Mehall 2bf962469e Summarize messages that are sent while narrowed.
(imported from commit 5ab3e4a5e6c43b879c376edd935d45539ef9fbd5)
2013-08-07 10:24:03 -04:00
Kevin Mehall dbb590268e Refactor update_message_flags for multiple flags.
* Move the state into a closure to duplicate it for multiple queues
  * Use _.debounce instead of manual setTimeout fiddling
  * Have it handle manipulating the message flags

(imported from commit 938f51fd666131a3cec5901d3f3fdd39e203b462)
2013-08-07 10:24:03 -04:00
Kevin Mehall ec927416a0 Move "already read" check into process_read_messages and rename it.
Functions were supposed to check that messages were unread before
passing them to process_read_messages, but some didn't.

The `mark_messages_as_read` function was essentially that, so
take that name.

(imported from commit 2917fe30d2defb8a047ec32e1bc70d379779276b)
2013-08-07 10:24:03 -04:00
Kevin Mehall eac6463031 Implement message summarization experiment.
When you read messages in a narrow and then un-narrow, collapse
adjacent messages read in the narrow into a summary row that can
be clicked to expand those messages.

Scoped to staging with feature flags.

The implementation of this within our current MessageList is rather ugly.

(imported from commit bcb3a39d8c0c334136fe86318f18ead03f0f50bf)
2013-08-07 10:24:03 -04:00
Tim Abbott b600c9453d Rename humbug => zulip in subs.js local variables.
(imported from commit 33a3b46ebbf78bcb5cf5654f817acd2f4e7b5e9a)
2013-08-07 10:00:09 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Steve Howell 57f518c9c2 Add node JS unit tests for MessageList.
(imported from commit 486a343add91fd5037431504e1ce4a750bfa9fbf)
2013-08-07 09:25:13 -04:00
Steve Howell de252b0ee9 Remove utils.memoize().
We use _.memoize() in the one place it was called before.

(imported from commit de15a61eed47551f0f539aacba6df3303c865299)
2013-08-06 18:22:11 -04:00
Zev Benjamin 237953f656 Completely hide the "share the love" elements when the user has no invites.
(imported from commit 6fe383dbbafb5e91998b6cdd52d01d92af31badb)
2013-08-06 17:18:40 -04:00
Zev Benjamin 262fb9b14c Factor out resizing page components from the resize handler
(imported from commit 18410406f6a2401b21a9d5336a8ae14046fc0375)
2013-08-06 17:18:40 -04:00
Zev Benjamin 5e1d893509 Revert "Temporarily remove "Share the love" from DOM & JS"
This reverts commit fc7af47400f6c96161913dcc98be128c116d90c5.

(imported from commit 8f58425ec3bd95220e109eeb7be21fa449508427)
2013-08-06 17:18:40 -04:00
acrefoot 5c2599e157 Fix the click handler for User Actions on the sidebar
Adding a span for CSS reasons in the presence list indicator
broke the click handler if you clicked the presence circle directly.

(imported from commit 1aa28755d849a1f2a5a06aeb4cc27ca368730c35)
2013-08-06 17:12:27 -04:00
Zev Benjamin b92bd9fa89 Fix for _.each not short-circuiting
(imported from commit a0c732abe38e75ac7aa5b807a65d716fd938ca6a)
2013-08-06 16:15:47 -04:00
Zev Benjamin f165318338 Don't recompute getBoundingClientRect excessively
(imported from commit 442ef93f887a7ad6777432cbb5d55b15d2efaa3c)
2013-08-06 16:15:47 -04:00
Zev Benjamin 34820bbc20 Cache feed bounds calculations
(imported from commit f5ca657d2addedcd7645bc9524f95d0e4d3b5460)
2013-08-06 16:15:47 -04:00
Zev Benjamin 1c4a608b40 Use CachedValue objects for viewport height and width
(imported from commit f61cca77651b5e9a66db6c2a9749fe7a1e958fac)
2013-08-06 16:15:47 -04:00
Zev Benjamin 3ce318e9a1 Add CachedValue class to encapsulate the pattern of caching mostly static values
(imported from commit 14048847e77974cda3a6214f129492d8d373080d)
2013-08-06 16:15:47 -04:00
Zev Benjamin 07301f9aaa Use the bottom of the tab bar underpadding instead of the navbar for determining visible messages
(imported from commit c7c2e8099fcc1ac03ae663c15beb6297805dadc0)
2013-08-06 15:21:56 -04:00
Steve Howell 3aa5930191 Streamline search suggestions when query has trailing space.
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.

Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.

(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
2013-08-06 14:04:29 -04:00
Steve Howell 349039289c Set module.exports in util.js.
(imported from commit 12b81a6f9b79fe3f024f53e3185d647971952df7)
2013-08-06 14:04:29 -04:00
Scott Feeney 29b3b42ac7 Temporarily remove "Share the love" from DOM & JS
(imported from commit fc7af47400f6c96161913dcc98be128c116d90c5)
2013-08-06 10:47:42 -04:00
Scott Feeney 950d271bc3 Fix wrong pointer position on narrow
This was introduced in a71867c2435790, intended to fix #1287.

Very subtle bug. The problem was that we were attaching a click handler
to two selectors, a link, and a div that the link is inside of.

Since the link was a descendant of the other selector, clicking the link
created TWO click events, and the second click on a stream box while
already narrowed to that stream jumped you to the end.

We should be careful of this in the future — never attach an event
handler to two selectors, one of which is contained in the other.

(imported from commit f428f593280e80c90b2665d1dfbff1df8a39bd35)
2013-08-05 18:37:29 -04:00
Steve Howell 0f42feb131 Turn on always-open-compose for all realms.
(imported from commit 0a7b35a4144e5645adbfd9b8fffb78573e676ad4)
2013-08-05 18:14:57 -04:00
Tim Abbott c5b3cad534 Add the near and id search operators back to autocomplete.
These were accidentally lost in
53d08b29367c0172e483064f213538d45098279e.

(imported from commit 11813fd43b5ecb2e15ed9f3276497837b9997bee)
2013-08-05 17:59:05 -04:00
Tim Abbott 6dd049fa26 Rename zephyr.js to zulip.js.
(imported from commit e62aa374f1bf2e75cebc00d0bba4e3ade82d19f6)
2013-08-05 17:59:04 -04:00
Steve Howell 01b40f3c98 Fix compose/topic regression (trac #1648).
When you are narrowed and hit "New stream message", the topic
will autofill.  This broke during the subject-to-topic
transition.

(imported from commit a9b471884c5cdae449e02ce7aa782add4a178077)
2013-08-05 17:58:45 -04:00