"(" and "↓" share the same e.which, but only "(" has a non-zero
charCode. This commit will start checking for non-zero charCodes
for directional keys.
(imported from commit bcb8c3c5ef2c13708fd04cca5f4d8b0f65beaa84)
1) When you send a message, restore the focus to the composebox, targeted at the same recipient
2) If the composebox is completely empty and you press up or down, have that close the composebox and take the appropriate action
3) If you started the compose via a reply option (r, enter, click), don't refocus the composebox if the cursor has changed.
(imported from commit 84545e49d06959eb62e7fd2b22e1387383df6d1d)
I tried to remove the line of code that removes the old
subjects as part of rebuilding the new ones, but that line
of code is still needed in places.
(imported from commit 97621553c267a79f33d34537a67101464bdac434)
Previously, we would only collapse the old subject list if
the new narrow had a stream operator.
(imported from commit 664f984d932d0968a9b901f2a09272e11138843d)
Before this fix, you could expand a stream, and then any
subjects that already had a zero count could not be
incremented when new messages came in, until you rebuilt
the subject list again.
(imported from commit 98c95e201f6ec745d7c857da6f42495c8bf88ee0)
(I also introduced a couple local variables that would have
made this and similar problems a bit more convenient to debug.)
(imported from commit 6793c16ffb17514fd9b5a069d384d2c74dac6111)
If you clicked on the unread counts span inside the right sidebar
links, e.target would not be the link itself but instead the count
span inside the link, so the extraction of the user's email address
was incorrect.
(imported from commit 559d93622078e4d909f60de794df3f039ea7e5f2)
The message_viewport_info() function encapsulates our logic
around the compose box and other elements blocking the viewport,
so viewport.js seems like a more logical home for it. It also
makes ui.js, one of our largest modules, a little bit smaller.
(imported from commit 7838668b28175e161b87a6d7a8124b73012f0ff3)
The core simplification here is that zephyr.js no longer has:
* the global home_unread_messages
* the function unread_in_current_view() [which used the global]
The logic that used to be in zephyr is now in its proper home
of unread.js, which has these changes:
* the structure returned from unread.get_counts() includes
a new member called unread_in_current_view
* there's a helper function unread.num_unread_current_messages()
Deprecating zephyr.unread_in_current_view() affected two callers:
* notifications.update_title_count()
* notifications_bar.update()
The above functions used to call back to zephyr to get counts, but
there was no nice way to enforce that they were getting counts
at the right time in the code flow, because they depended on
functions like process_visible_unread_messages() to orchestrate
updating internal unread counts before pushing out counts to the DOM.
Now both of those function take a parameter with the unread count,
and we then had to change all of their callers appropriately. This
went hand in hand with another goal, which is that we want all the
unread-counts logic to funnel though basically one place, which
is zephyr.update_unread_counts(). So now that function always
calls notifications_bar.update() [NEW] as well as calling into
the modules unread.js, stream_list.js, and notifications.js [OLD].
Adding the call to notifications_bar.update() in update_unread_counts()
made it so that some other places in the code no longer needed to call
notifications_bar.update(), so you'll see some lines of code
removed. There are also cases where notifications.update_title_count()
was called redundantly, since the callers were already reaching
update_unread_counts() via other calls.
Finally, in ui.resizehandler, you'll see a simple case where the call
to notifications_bar.update() is preceded by an explicit call
to unread.get_counts().
(imported from commit ce84b9c8076c1f9bb20a61209913f0cb0dae098c)
Because of spacing issues in the right sidebar, the unread counts
appear to the left of the person's name, not the right.
It's kinda awesome that this is only 20 lines of code.
(imported from commit f5a4ea27bc4cd2e8157746ce7524a600b638930b)
We are moving back to a barnowl-ish scrolling algorithm for
the arrow keys, where when you have a message selected toward
the bottom of the screen, hitting down arrow and up arrow
effectively puts the originally selected message at the center
of the screen. In order to avoid unnecessary scrolls, we
are making it so that you can move the pointer closer to the
edges.
(imported from commit c08233d6d2034a04469b8f424b39d94a230cafe0)
I removed references to the following:
on_custom
custom_message
current_message
show_custom_message()
clear_customer_message()
(They were not being used anywhere.) Also, show() does not
receive a msg parameter any more.
(imported from commit 8ec347b40fc9fa582317d68e85c98258cf3fba2f)
We could get into this situation when someone is doing a search and
someone else edits a message while the results are still loading.
(imported from commit 99e371fd75c7ae7dc98a0c03bc434e434da44b94)
`current_msg_list.get(id)` and `rows.get(id,
current_msg_list.table_name)` are not interchangable in terms of
checking for whether we have a message. The former checks whether
the message is in the current message list while the latter checks
whether the message is in the current message list and currently
rendered. `message_edit.end` only operates on rendered messages.
(imported from commit 203ee612bfd0aa94571dde9b601e948b3c6f6cbb)
Previously, if you didn't have a message that someone else had edited
in your message list, you would get an exception because we weren't
checking whether we actually had the message or not.
(imported from commit 33a5c6e7fe95b5397a32df5c7b5f6714d71e1e5f)
When determining if desktop notifications are enabled, we can check whether
there is a "window.bridge" element.
Now when it comes time to actually send out notifications, we can just test
again for the existence of "window.bridge" and if so, shunt the data over
it.
(imported from commit 8104c91ea9da7bc485c86a3c21edc88905d2f47b)
Before this fix, the code would restrict the pointer to be above
either the 1/2 mark or 2/3 mark of the page, depending on your
scrolling direction. This fix makes it so that the system leaves
your scroll and pointer alone when between the 1/5 mark and 4/5
mark. This means the user can read more messages on the screen
at a time before getting paginated.
(imported from commit 98f6319bf63181dd331e037ac20a0c15518725ea)
When you make a call to set_message_position(), you already
know that the pointer is gonna be onscreen, so set the flag
to suppress scroll pointer updates. This should be faster and
also avoid future confusing bugs where recenter_view() and
keep_pointer_in_view() run for the same event.
(Both callers to recenter_view pass in the selected message,
and then the calls to set_message_position() set the scrollTop
so that the selected message shows onscreen.)
(imported from commit f1a6f189b7899b280a6316ea7eb03f015d3d4ae3)
This also changes the color for the blink effect when you
get private messages. For simplicity sake, we use the
same color for private messages and mentions.
(imported from commit 46b0f7af1dccefe575004e7676990e5c854a3dcc)
Previously it could return an array or boolean, and this inconsistent
interface had several latent bugs where consumers of the API only
considered it returning one or the other type.
This also fixes a specific bug a user triggered by being narrowed to
nothing (/#narrow) and clicking in the compose box.
(imported from commit 64ca2a37a9f288066f89b0ddec6638e010704eb0)
Re-focuses on the compose box after a send, under these conditions:
1) narrowed to stream+subject -or- responding to PM/huddle
2) compose was initiated by clicking on a message or hitting "r"/"enter"
3) cursor has not moved since you've started the composition
Additionally, if you are thus narrowed, we will move your cursor when you've sent
a message to that message, assuming that such a message initially appears visible.
(imported from commit 373c858081694e6fc9994639340a847d66edb566)
This change fixes the barnowl scrolling so that the ratios of
1/5, 1/2, and 2/3 are all relative to the visible viewport.
The core part of the fix is that we need to call
ui.message_viewport_info() to get the correct offsets for
the top/height of the actually visible viewport Because
this function is fairly expensive, I didn't want the
helper functions needlessly re-calling it. I could
have passed the helper functions the structure, but at
that point it was simpler to inline their functionality.
(imported from commit fb10d99313d568e85acfa70703c4651466acbc21)
Now that this functionality is accessible from the right sidebar, we
don't really need it here.
(imported from commit 34eaef4e1200f9fc673a681f0be87d8008033e83)
Currently, this is accessed by clicking anywhere in the sidebar region
other than the text of the person's name itself, which does the
existing narrow behaviour. Later we can make it do something clever
with hovering pulling out the popover or something, but that's
potentially a significant design project I think this is good enough
to be useful.
(imported from commit a2cc5dc851661117a6d438ca48a1ce7585d4eb63)
We had a couple places where autoscroll would
mysteriously midway through scrolling, and it
was because scrolling generates mousemove
events.
(imported from commit 666e5e5af81fdcc5cc56c314d1264dbec970c067)
Treat "mentioned" messages like "starred" messages for narrowing.
Lots of ugly copy/paste here. There might be opportunity for
some cleanup in places.
(imported from commit e7629890d42643c0000e1cc85422b2a0690f2cc4)
The bug we experienced here was that if you loaded the page in a
narrowed view, and then un-narrowed before the first block of messages
for the home view arrived via load_old_messages, then
narrow.deactivate() would re-select ID -1 in home_msg_list. This ends
up calling recenter_view() on the message, which in turn tries to
access the message with message id -1, which fails.
We do sometimes re-select a message ID in order to recenter the view
properly when we prepend messages to a message list, so we can't make
this always a nop; instead we add a check for id -1 in the
message_selected.zephyr event handler.
(imported from commit 66f84a586e59d99aaf0e4ba2cda9fe597b033145)
There was an off-by-one error in how we determine when
the message list was scrolled all the way to the bottom,
and this undermined our handlers for page down and scrolling
to get the pointer all the way to the bottom.
(imported from commit f80d11582b40726246e69c817a502b311081c730)
This reverts commit 13fb245f86ab84b1d2faea9d2a1f2145cd4aa907.
(Waseem wanted to hold off on adding more hot keys.)
(imported from commit 97c25ffa01fd7058fc90a278887d85b7d82a268a)
Re-focuses on the compose box after a send, but only if
the compose-box was opened by responding to the message
at the cursor (by hitting "r", enter, or clicking on the message)
(imported from commit 8e7560c8ea31397b57b2bc3e2e7d9dd996226a6f)
The reply-to autoscroll was using a flag that was redundant
to suppress_scroll_pointer_update and then updating it prematurely,
which caused the pointer to move when you clicked on a message to
reply to it. Now the pointer goes to the message you replied to.
(imported from commit e2f49fd6bd0da9a3f4b58c0eb08192ef0ee9abf0)
Now that we sometimes call message_edit.end() twice, we need to check
if we've already cleaned it up.
(imported from commit 4e0efa14ba78df0a86b2ae97b99fa1be6197df88)
The main point of this fix is to move some more scroll-related code
into viewport.js, but it also fixes a bug where the size of #main_div
was not accurately representing the full height of the message list.
Making the calculation more accurate narrows the window where we
do pointer adjustements on mousewheel moves.
(imported from commit 5d821f459284c4dbd5ff8056001e54caf4355f1d)
Fix min-height before doing the calculation of how much a
replied-to message is being covered by the compose box. This
change also removes an outdated call to slideDown.
(imported from commit e5a3f35bbacff16dffae62c9e9f6bbc7978a13c1)
The logic for this already existed, but start() was getting called
twice, once from compose.set_mode and once from the click handler, and
the result was the focus always being in the stream input box.
(imported from commit 9a832a118856b5705524975a4412b7e6e547ef5c)
This parallels clicking on a stream name, which narrows you to that
stream. This also gives you a discoverable way to narrow to PMs with a
particular person.
(imported from commit 6c706f0643f6a8ec20ac38360153227ec2f645ae)
This sets up the keys t and b to anchor your pointer to the top
and bottom of the viewport. It empowers keyboard users who
are otherwise at the mercy of Barnowl recentering, but of
course it doesn't affect users who don't want to opt in.
(imported from commit 13fb245f86ab84b1d2faea9d2a1f2145cd4aa907)
The functional change here is that our code to stop
autoscrolling on certain events, particularly mousemove,
now only runs during system initiated autoscroll events.
If the user had been replying to a message, then the feature
to stop autoscroll was too aggressive.
This patch also starts to put more scrolling-related code
into viewport.js, which will hopefully prevent some code
duplication and give us a single place to control things like
stopping animated scrolls.
(imported from commit e7d5946b0ac7fcfda2eff1d0e2b58a78b44ecc1a)
We also record the historical edits to the message in this JSON format:
[{"prev_content": "new test message 14", "timestamp": 1369157249},
{"prev_content": "new test message 13", "timestamp": 1369157118}]
but we don't actually do anything with the information as of yet.
(imported from commit 2d5ca449b87b33ad035ab0e076a22e150c8e7267)
* Modify the narrow icon in FontAwesome to make it better align to the pixel grid and display well on Windows+Chrome.
* Move the message controls to the right
* Hide the message info icon until the message is hovered / selected
* Switch the star to a gray version
* Increase the size of the gravatar
* Adjust the spacing
* Add the right-side message pointer
* Fix private message background colors and mention colors
* Modify star count test to account for new stars
* Bug fixes for stream subscription messages and other miscellanea.
(imported from commit 3d3d9de7e03f3658c5c78b492051b2b7f795487d)
This goes back to only scrolling by the size of the new
message, and it avoids scrolling in certain use cases.
(imported from commit f9e6380b779bb21283ba889715712b6b51633838)
Previously, we were referencing the mixpanel objects only once, at
page load time, which meant that there was a race between metrics.js
loading and mixpanel completely loading. Mixpanel starts with stub
methods and then replaces them once it fully loads, asynchronously.
If metrics.js ran before mixpanel loaded, we'd end up wrapping the
stub methods instead of the real versions. Adding a layer of
indirection ensures that we always get the right method.
(imported from commit 6a8cfbf249168443956895b7a7e29bf7bb4222aa)
This reverts commit 87226d857845c6f16cb3bc0d6ab5bb748aca5987.
This meant that if for some reason there's a server error or network
failure trying to send in your edit, your changes are silently lost.
(imported from commit 2b5d19716fef1565b061a2b6c7cecc54f183b6f3)
Currently, some browsers don't seem to be sending metrics information
to mixpanel. This commit will make said browsers noisy, but should
help debug what's going on.
(imported from commit c5050f66d985eb76e38117b2668594fedfc10702)
Use tab_bar_underpadding to find out the top of viewport
that we can view. Also, eliminate effective_page_size().
(imported from commit 0e2d777790552e77d635989e496f3446cefccb1e)
This will make it automatically work if we add new tab
bar like things. The current version of ui.message_viewport_info()
is slightly broken; that's a separate fix.
(imported from commit fa1906b738433223831250e3191dfd8e87d67daf)
Most of the model logic pertaining to unread counts had been in
zephyr.js, along with a couple global variables. Now the code
is encapsulated in unread.js. It was a pretty straightforward
extraction with some minor method name changes. Also, a small
bit of the logic had also been in stream_list.js.
Conflicts:
tools/jslint/check-all.js
(imported from commit f0abdd48f26ab20c5beaef203479eb5a70dacfff)
Set the background behind "Private messages" to green whenever
a user's unread count goes up for private messages. Remove
the background after 3s. Advanced browsers will fade the
green in and out over 6s (3s up, 3s down).
(imported from commit 80ed9661d9eec1d697f3259854037d7e145615cd)
The only known outstanding bug with this is that it doesn't properly
handle the updating of a message's highlighting/presence in a narrowed
view (e.g. in theory, a message should disappear if it is edited such
that its subject doesn't match your narrow or it no longer matches
your search). I think I'll just open a trac ticket about that once
this is merged, since it's a little hairy to deal with and kinda a
marginal use case.
Also it's not pretty, but that should be easy to tweak once we get the
framework merged.
Conflicts:
tools/jslint/check-all.js
(imported from commit 2d0e3a440bcd885546bd8e28aff97bf379649950)
Currently the interface for editing messages is limited to a
command-line API tool; it's great for testing with e.g.:
./api/examples/edit-message --message=348135 --content="test $(date +%s)" --site=http://localhost:9991 --subject="test"
The next commit will add a user interface for actually doing the editing.
(imported from commit bdd408cec2946f31c2292e44f724f96ed5938791)
Specifically:
* Leave the avatar image as inline and round it.
* Move timestamp to the left column.
* Replace the "Info" link with a permanent info sign.
* Move the pointer bar to the left.
* Remove borders
* Change selection background colors, and PM colors.
* Introduce the "narrowing" icon into our FontAwesome set.
* Modify the tests to account for the new "narrowing" icon and fixed a bug in star-finding.
* Clean up CSS and add a more prominent color to private messages
(imported from commit 8a8d6de8acccc52c0d16f5d1ce31aabdc72c88c8)