We did this to check if you sent a message that would progress the
tutorial. Since the tutorial is getting overhauled we don't need this
anymore.
(imported from commit 25ee55ab034fff42a220ddd7b222b3f7459af3a1)
* This makes bugdown.convert take a `message` parameter. Properties
for parsed mentions are added to the message object by the `Pattern`
for use in do_send_messages.
* Refactor repeated markdown rendering code into `Message` model methods.
(imported from commit 4f0ed5570104c0210f984b6de21e9048e2b53fa0)
After fixing the high numbers of database queries earlier in this
branch, I found that sending 500 RabbitMQ messages for a bulk change
in subscriptions was consuming more than half the time for these (and
then we'd end up with 500 events in a queue). To handle this, we
create a "user X subscribed to these N streams" event, rather than
sending one event for each individual subscription.
(imported from commit 44a34a9fab9b67e9f0da6fee53335d8c5030392b)
These contain timerender spans with unique IDs. If this string is cached
and re-used in a narrowed view, there are elements with duplicate IDs,
and only one of them is updated at midnight.
(imported from commit 29469fb5f0d8a9b7fe7988849d2936c49d4a038d)
As of f69d01b and e4a9f80, timerender only deals with the date part.
Since the time does not change when the friendly dates are updated,
just append the time outside of the span.timerender.
(imported from commit 18ec93550782c6fa8447ebc608f95da79d28dc8d)
Trac #1403.
This shows the 5 most recent subjects, as well as any others with unread messages. This
requires tracking all subjects and filtering at display time, rather than filtering when
building the subject list.
(imported from commit 8bda7d50e6785a6e70abea4b3af4d03a16d076d3)
(The file-input widgets that come with browsers are ugly and
nonstandard across browsers, so it is a common technique to
have your own button that controls the file upload, and it
delegates to a hidden copy of the browser file-input widget.
We also allow you to clear the file.)
(imported from commit b55ef655e75746330dc3cc396cb908670e5019cc)
The add-bots form used to have a landscape alignment, as it was
integrated into the same HTML table that showed your existing bots.
This became unwieldy once we allowed users to upload avatars.
(imported from commit 246a35be77ce1679d595271e6911dc339a6813ab)
Caveats:
- Since Chrome has trouble using W3C Notification when it's not
initiated by a user gesture, we try to use webkitNotification first.
- FF doesn't allow iconUrl to be of a different origin, so it won't display
our gravatars
(imported from commit c4f99ce6927a0d203d9f220d50b06737779bd7f8)
As does the hotkey "i". It's somewhat less appropriate because it's all actions,
but it's where our "info" menu used to be, and we can workshop a better one. "a"
feels weird to me, but maybe it's just me.
You can also hover on the .message_content to see a popover with extra message details
This is for Trac #1334.
(imported from commit f8fbf70c8502370a78159e24f3cf9589fb9d384f)
Previously, we'd highlighted the top of the block. The theory here is
that it will make things less visually cluttered/noisy, which should
improve readability.
(imported from commit f94ec6b8e55aef9c2413718aea23b1124f5308e7)
This allows us to do some nice styling on the final message in a group
(in this commit series, this leads to some gently rounded corners.)
(imported from commit 86e7e8586dd4ee3cd8d4ce3be43fd2abab3f1d16)
Showing a user's bots in alphabetical order leads to a mildly
confusing experience when we append a new bot to the end of the
table, but then you hit refresh, and the new bot goes to a different
position. Since any given user is unlikely to have zillions of
bots, I don't think we need alphabetical order to help them find
old bots.
(imported from commit 4f19dbd7a016e7d867e88248190849dcd52c6d71)
Since in the future we might want requests to add subscriptions to
include things like colors, in_home_view, etc., we're changing the
data format for the add_subscriptions API call to pass each stream as
a dictionary, giving a convenient place to put any added options.
The manual step required here is updating the API version in AFS
available for use with the zephyr_mirror.py system.
(imported from commit 364960cca582a0658f0d334668822045c001b92c)
This way we can return properties of the streams other than just their
names in future versions of the API without breaking old clients.
The manual step required is to deploy the updated version of
sync-public-streams on zmirror.humbughq.com when we deploy this code
to prod.
(imported from commit 42b86d8daa5729f52c9961dd912c5776a25ab0b4)
Previously, we were only checking whether the message was sent by you
for PMs, not for streams that you marked as notifiable.
(imported from commit 668e102e885aa347cceff376c1873c1c62aff997)
Previously, if you were narrowed when we reloaded you, you'd be
kicked out to the home view.
(imported from commit c00f1b92c9a4f559998463e141a402b69873fd56)
Some browsers don't support desktop notifications. Some people haven't allowed permissions
for humbug to have desktop notifications. This is a poor man's attempt at desktop notifications.
We are adding the bootstrap-notify package (http://nijikokun.github.io/bootstrap-notify/)
Resolves Trac #1336.
(imported from commit 6a54f7d1875e765dabd32d94ada8ebe4474a3d71)
I noticed in our server logs that some users were sending
update_onboarding_steps requests to the server every time they sent a
message -- because they hadn't finished the onboarding process.
(imported from commit 8e1751a3344149f386022d96e7893e687d6631e8)
This reverts commit fec64815c879f9704847795cc163e2b517b4190d.
We've decided this experiment didn't work out.
(imported from commit 04f38e15c8ef19fbaa022a06bbcca3b0c67ec5ad)
This reverts commit 74fb298c711e61ae98c210d0ed11c875ce6ba591.
We've decided this experiment didn't work out.
(imported from commit 8acd3a030b692f9397155a20a9f89e63ed6a6cf7)
If you click on "Streams" from the gear menu, we want to focus the
textbox to create a new stream. But if the Streams page is brought up
programmatically (e.g. to jump to a specific stream's settings), this
commit makes it not focus the textbox.
(imported from commit 900bdafb701180eac1d284120a91ea2a84d7177b)
The sidebar link now uses a one-time event handler for a custom event,
subs_page_loaded.zephyr. If the streams page is already open, we can't
rely on the event so we expand the stream in question immediately.
(imported from commit 3c22e1791d238a3be4a73edcfb5456e392cee608)
Get data directly from the main user list, rather than maintaining a
separate list just for autocomplete.
Fixes trac #1362 -- Does not depend on historical messages, so
will do the correct autocomplete after a single reload.
(imported from commit 6b35a709dba3384530082e8cfacf0151f9e0eb26)
I don't love the default reloading message, but I'm not sure how to
tell the user why we need to reload in several cases.
(imported from commit 5f2eecdb0d83f31bd60673b247e8aac8f08ce20f)
This is a pure refactoring. We set messages.sent_by_me inside
add_message_metadata(), which gets called early in a message's
lifetime.
(imported from commit 2f6270f92ecdf0e4a64401030f86d89a8fb7be2e)
This updates desktop notifications to use avatar_url from the
server (in case users have uploaded their own avatar). It
also removes the unneeded stamp parameter from the URL, and
it unifies URL handling with message_list.
(imported from commit 6bb43a25c01cc3d26f30fc167780a477d1c5d023)
Trigger a repaint only on the messages that change fade state,
rather than repainting all messages.
(imported from commit d3a225448c004a4b467e51ceb97fda06a7a6f04b)
This should substantially improve narrowing performance, while still
delivering enough messages that one should only need to contact the
server again if the user scrolls up a significant distance.
(imported from commit 2b0af0e5b9d3a449e7f195a87d57d517b47f0b3a)
This change backs off from the always-open-compose-box paradigm,
so that when a user "closes" the compose box, they can no longer
type text, attach files, etc., and instead, they have buttons
to reopen the compose box.
(This change does not affect the feature that when you're in reply
mode, the compose box stays open.)
(imported from commit 32305d5b35f457a83f126a2265defdd98e885a2b)
Disable the hotkeys that act on the current message, except Enter
immediately shows the cursor without moving it.
(imported from commit 74fb298c711e61ae98c210d0ed11c875ce6ba591)
Hopefully this time with fewer stack overflows. It sets the flag
that will break the cycle *before* triggering another focus event.
(imported from commit 5e3ed74f1eeab8a18e36525ae7c8f1f1c756eb58)
Some versions of IE (specifically on Windows Media Center PC, it
seems) lack a console object. For such browsers, we just black hole
any output we would have sent to the console.
(imported from commit 30151c60a68a47990bf8f9be4476b716352befab)
When a user sends a message, it should be considered to be "read"
by that same user, but all that logic is handled on the back end
now, so we can remove some of the front end code related to
saying that a message is unread.
(imported from commit e4263f86c666882db42d7ae3d399196803d700cd)
This cleans up most of our blocks of code that assume in any narrow
that the only operators present are the ones of interest and that they
always appear in the expected order.
(imported from commit 038707aefbe125b0c14f823fa93472fd40302e20)
This is essentially a bug fix. It was pretty clear that the
original author intended to stop polling once the gravatar was
updated, but they checked for the updated flag before the callback
completed, instead of inside the success callback, so it wouldn't
stop polling regardless of the update.
(imported from commit 7998c6890a26a008810b8a6d8e7998a53c6e175d)
Before, sidebar_li, used in rebuilding the streams list
during a sort, was set to some HTML rendered from a template.
Now it's set to a jquery object that is updated when the DOM is
updated.
This resolves Trac #1310
(imported from commit ba96d9da4deebf2f674f2c093e81b3f0032a3fe4)
This change makes it so we now keep track of full stream information
for both subscribed and unsubscribed streams in our frontend. Previously,
any unsubscribed streams had no associated data.
(imported from commit c445b19abe11c43c710c264fffcf3af5097deb6c)
This seems to only happen with Firefox for some reason. We've had
similar issues with other ajax endpoints, so this is probably not the
long-term solution, but I'd like to get this traceback fixed now.
(imported from commit aa552fb56882ae2c73e352c7baf9532a88c5cf0a)
Don't show an error banner for any uncaught JS exception, as often the app
will continue to work fine, and there's no way to dismiss it other than
reloading the page.
Also, don't show a transient "could not connect to humbug" error if
the check-for-messages-in-narrow request fails.
(imported from commit 2c634ba088b58c17fa5b2e3353b0589d40b8e357)
It makes the stream and subject sometimes not auto-fill when replying.
This reverts commit 86603aefbbcd5f766b0c397583483810948046de.
(imported from commit 934e991566fa7a082ab8e2ba661ec973bce46b85)
Treat shift-space like page-up. Let the browser handle
shift-page-up, shift-escape, and similar keystrokes.
(imported from commit 31d5c5eb1dd4af7228c5e7794fb4cffc4bd8e88b)
I extracted get_event_name(), which should help isolate
the problem of identifying keys from the specific mechanics of
dispatching actions for given keystroke events.
(imported from commit 058c0749016dc17cce554788e10ccb32438e9dfe)
ce4e860a introduced CSS `.alert{display:none;}` because alerts are
always included in `/signup/` and shown by JS. Use a new `.alert-hidden`
class for this purpose to avoid breaking other pages.
(imported from commit 199ba35dd3356bd4093aac2a54181331b3993ee8)
This, in effect, reverts ff0c27ccb177ddc69a31bf8997d31e7cfb5b78b5.
The rationale here is that actually we look pretty good with the
browser's own zoom/font-size-resize in Chrome and Firefox, and it's
better to let the browser handle these kinds of changes than us.
(imported from commit 5949b57bdaf20d4fdf2bbd7ed89d1285a8b8e453)
"(" 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)
The geometry used by within_viewport() is a little off to
begin with, but we don't want to check it at all in this
situation, because if the last messages falls out of the
viewport, we still want to scroll. The relevant thing
to check is that available_space_for_scroll exceeds zero.
(imported from commit a0a6f0d23db2eab8d9f22fc9ad523031cf7f7ec2)
The prior code was subtracting out the compose box from the
calculation of available_place_for_scroll, which didn't make
sense when the compose box is at the bottom of the screen
and you're scrolling the current message up. You could see
the symptom pretty clearly by seeing autoscroll stop exactly
the height of the compose box from the top.
(imported from commit cfceb85c8be80cca957ac4a3ad0bbf0de7425c48)
This fixes a pretty subtle bug where the window-focus handler
wasn't updating the unread counts in the title, but it was
hard to notice, because as soon as you moved the mouse, the
problem fixed itself.
Apart from fixing the bug, this patch eliminates the expensive
mouseover handler, which is a big win.
The fix to the window-focus involved some unrelated cleanup. I
decoupled update_title_count() from received_messages(), as the
former method will probably live somewhere else soon.
Also, in order to get window-focus to update the title count,
I went pretty deep in the stack and added a call to
update_title_count() inside of update_unread_counts(). This
fixes window-focus as well as restoring that behavior to
code paths that were calling received_messages().
You'll see that call to update_title_count() is now adjacent
to the call to update_dom_with_unread_counts(), which is
fairly sensible, but then are calls to similar methods like
notifications.received_messages() that happen higher up in
the call chain, which seems kind of inconsistent to me. I
also don't like the fact that you have to go through a
mostly model-based function to get to view-based stuff, so
there are some refactorings coming.
(imported from commit 2261450f205f1aa81d30194b371a1c5ac6a7bdec)
I renamed set_count_internal to update_count_in_dom, because "internal"
was redundant in terms of saying the function was private, and it misled
me into thinking it was internal-only in impact, but it actually updates
the DOM.
I also removed the synchronous callback functions, since they both
led to simply hiding the count_span and clearing the text of the
value_span.
(imported from commit dea27d6414dc1b33818b24662f8246d687530b71)
This allows us to load our own code before most dependencies are
loaded. Our compiled Handlebars files still need the Handlebars
runtime, so we can't move all of our minified code before
dependencies yet.
(imported from commit e2d0fa13f05a08fc3c2519790f7382e5eef6eca2)
The problem is that if you load a browser window in a stream narrow,
add_message_metadata will be called for the messages in the narrowed
view before it is called for the messages going into the main view
(thus inserting them into all_msg_list), resulting in duplicate
copies of messages.
This would be mostly OK except that we call
process_message_for_recent_subjects inside add_message_metadata, and
that function assumes it is only called once on each message
(otherwise it'll double-count the message).
(imported from commit a3e7f85874100cd93a6d07684605da04d9cc80c7)
Created a function message_viewport_info() to return more accurate
effective viewport info and called it from process_visible_unread_messages().
Also killed off a tiny bit of dead code in process_visible_unread_messages().
(imported from commit 985fcf2fb447dbf1026e2de37574c255a9bd6196)
Whenever we get a narrowing event, it's possible for new messages
to appear visible, and we need to call process_visible_unread_messages().
This has been a bug, but it's mostly obscured by the fact that we
call process_visible_unread_messages() as part of focus/scrolling
events.
(imported from commit b9447977f8e2272d45865ca67b436cacafd58a03)
This works fine on prod, but after a new install-server, the closure
compiler complains about a side-effect-free for loop init.
(imported from commit aa0e4d788abe4c819d4d912d6a526fab4f676675)
This removes the large "New stream message" and "New private message"
from the left sidebar. It also makes the default action when clicking
inside the composebox the same as the "New stream message" button used to
do (instead of replying to the stream-subject pair at the current cursor).
(imported from commit 316f03a35b781aca4c42555f74b99c4332ff42de)
This refactoring basically splits off two functions from update_unread_counts(),
which then becomes a simple three-liner.
The function get_unread_counts() is extracted, and it's purely functional
computation. It paves the way for a more pull-based approach to getting "unread"
counts, where other parts of the program can just call it to get values as
needed without worrying about side effects. It is staying in zephyr.js for
now.
The other function is stream_list.update_dom_with_unread_counts(), which
has a new home in stream_list.js. It handles all the DOM manipulation
aspect of unread counts in the left pane, mostly by delegating to smaller
functions within stream_list. Some of those smaller functions can now
be turned into private methods FWIW, but I'm not sure it's worth the
trouble.
(imported from commit 799f9ebbaed8d530829a4741ef14be04bd8abf5a)
This is a prefactoring to eventually eliminate the home_unread_messages
global variable. More commits to follow.
In order to set up process_loaded_for_unread() not to modify
global variable to get its job done, we want to pull it out of
add_messages(), so that add_messages() doesn't have to pass back
state to the 9 different places in the codebase where it's called.
There are only 2 places where process_loaded_for_unread() get
called after this commit.
In order to facilitate pulling up process_loaded_for_unread(), I
made it so that the contract for add_messages() was to accept
already-hydrated messages. This way I could hydrate the messages
before calling process_loaded_for_unread() without have to
worry about double-caching them in add_messages. This will
slightly improve performance, but it was mostly done for code
clarity.
(imported from commit ad5aaad5b1f22c31647370f4c9dcb5f89d7d99a7)
This was a workaround for a number of other bugs we had, but at this
point just serves to make debugging more difficult.
(imported from commit 6662b7854c265bd8016f6c8ce75a095731211a45)
We really should not be storing bot API keys in the DOM and should
require some sort of additional authentication before showing them,
but this seems reasonable for a first pass.
(imported from commit c7d75aa52e21894bf53917457e771c18de38bbcc)
The idea here being: if there's only one line, it discourages
me from writing a long message (and also makes me think that
enter will send).
(imported from commit 424d8d305d1965ce3199ce3227dac94b395945bc)
This commit takes control of keyboard-based pagination away
from the browser, so that we can use the effective viewport
size as the amount to page, as well as keeping a little bit
of overlap from page to page. There had been issues with
pagination for a while, but the introduction of the always-open
composebox particularly aggravated the situation.
(imported from commit 45b9b7d5a6b322230c9d55e1be0b763dbce06e2e)