This way if you refer to "trac #253" in the subject, it's super
convenient to get from your recipient bar to the ticket.
A note on performance: this part of rendering for 1000 messages takes
about 3.5ms for messages with 1 match; this is small compared to the
overall time for to_dict_uncached for that many message objects, so I
think this is OK for now.
(imported from commit 5bdc2b8415d7599d59eb554739f545c485b78d5a)
Renamed show, hide and clear to show_box, hide_box, and clear_box,
to make it a little more obvious what each one does and make them
greppable.
Also, hide and clear weren't being used by any other modules, so
these functions are no longer exported.
This resolves Trac ticket #1503.
(imported from commit 904d596ef5b8dc2154dc01ed7c9c99a54dc9b31e)
From Trac ticket #1503:
All of the calls to compose.set_mode() should be calling compose.start()
instead. Nearly all are impossible to trigger while already composing,
and by calling compose.set_mode() they just do the stuff in set_mode()
twice. The only case where this would change behavior, that I can see,
is if you press C, Shift-Tab to unfocus the compose box without
dismissing it and then press c (or vice versa). I think it's okay if we
clear the input fields in that unlikely case.
(imported from commit ba7f181ec9d1df90a443b0a754462a3a201dcabb)
Previously we were checking for webkit before checking for
$('<audio>') support, but that cuts out non-webkit browsers that support
the basics of the HTML5 audio api.
Now we actually run the feature test in order to enable it, and only
check for webkit when enabling webkit-specific desktop notifications
(imported from commit 851eed86af167d0530f7e1793e2ca1f9b4cdd71d)
For completions, since we have no representation of categories, users
might expect lexical ordering.
(imported from commit d2e27dd4d8452df6ac48d44551802d7e65519115)
It would show the recipient bar unfaded over a faded message when
narrowed to a stream.
(imported from commit 576e7bd7bdf1fbb3f241f1ba8cd1548c4546257d)
Previous code iteratively called set_user_status() once for each user;
which in turn was rerendering the user sidebar, also once for each user.
I changed the API a bit by replacing activity.set_user_status() with
activity.set_user_statuses(), plural, that takes an object and updates
all the user statuses in one go before rendering.
(imported from commit 1111c9029264f892f25e76d2e5e5ff996dcbc7ca)
This will hopefully fix some lagginess when logging in on the Hacker
School realm, especially on Firefox, as the user presence rows are
populated (previously requiring hundreds of template renders).
(imported from commit 67e2d7f91ad62d8d7a2e212ee7c7121bd73f010b)
Fix a minor bug where if you return to the home view with a recipient
filled out, it would be unfaded.
(imported from commit d81d974dcb054c63d8a5dd5afec7b072c99d4e3f)
Previously we had fancy logic to determine where to focus, but immediately
clobbered any focus choice we made and forced the stream selection to be in focus.
We also incorrectly determined what to focus in the case of clicking the new PM
button when in a stream narrow.
(imported from commit 01e2cec8eca068ee1d45d3cfb21607b981d5034e)
Unlike the other cases where we do this sort of offset calculation,
we're working with a message which is not msg_list.selected_id() --
which means that this message might not actually be rendered at all.
Correct for this by just letting then_select_offset stay undefined in
that case.
(imported from commit ebb8a23bf34c52f9495aa88ceca8eb4458d50be1)
When it's not offering any other suggestions, suggesting what
you've typed is unnecessary and confusing and it should just
hide completely instead.
Trac #1476
(imported from commit ff69bb53c661e0a3a193dbddde6e7a4ff8b10031)
This seems to have been somehow introduced in the refactoring to move
the popovers into their own file
(36ad3c61e4d7eb05751f9b886d15edceab656d71).
(imported from commit f5f58844a9c2da4b4433489be1772263f3aba350)
This fix also cleans up the search operators so that @-mentions
and Private messages have a more similar naming convention.
(imported from commit fb1a2119aab5aa9e179c6e321a8d2ef2e90290cf)
This scrolling behavior is driving me crazy on staging.
Reverting until we come up with a better alternative.
This reverts commit 41954fecd9efb43820ed1ccb5210283c17752f51.
(imported from commit 2db602cf51ca734b00ec1bd454c39204468fa024)
This is one case I forgot from the last commit. For example, if the
message actions popover is open, and you open the user sidebar popover,
the message actions popover should close. It now does.
(imported from commit a241634cb1aabf8883cf95ebd5b8ba96f5ed9908)
A cleaner, more general solution would be nice but this fixes at least
the most obvious cases for now.
(imported from commit fc7260e25a4f2172eee74af9c2d9384898947ad3)
Previously the viewport.scrollTop() command that we ran in this case
would actually scroll far off the bottom of the site; it only did
something that looked reasonable because bottom_whitespace was small
and thus the scroll was truncated.
This version scrolls to 10% of the viewport away from the top. We may
need to tweak that to instead be a fixed number of pixels or something.
(imported from commit 0176bf6e3662dfa24887f41b110b429bd8054cb0)
Previously the code to save/restore the scroll position when toggling
a stream in/out of the home view would only work if you were currently
not in the home tab -- because you used to only be able to do this
from other pages.
(imported from commit 4002a3980dfd87dabd570abee3ebc63417a78cc5)
Previously, we had some ugly complicated logic through which we
attempted to keep the selected message on screen when prepending
messages, but we didn't actually preserve the scroll position -- the
selected message would jump on the screen. This fixes that, by just
saving/restoring the scroll position of the selected message.
This perhaps makes our model/view split even less clear, but at least
it's correct.
(imported from commit 0a01450bbbcdf1b45c891d0570c9fcfb11769315)
message_list.prepend() now actually only rerenders the new messages
when prepending using the where="top" functionality (previously it
would erroneously just adjust the message database and then wait for
message_list.append() to call _maybe_rerender(), determine that things
are awry, and rerender the whole message list).
(imported from commit c64b7b540a4f5332ad792de0fad9f20750e6db1c)
This has two benefits:
(1) Users can scroll their last message to near the top of the screen,
which decreases how often one needs to scroll down to track current
messages.
(2) It makes scrolling bugs near the bottom of the screen a lot easier
to find, because scrolling down too far isn't blocked by being unable
to scroll messages off the screen.
We should probably later convert this to some formula that varies
dynamically based on the height of the last message.
(imported from commit 41954fecd9efb43820ed1ccb5210283c17752f51)
It turns out that this code tries to place the initial pointer 1/7
from the top; the only reason something reasonable happened
historically is that bottom_whitespace was only 40% of the screen, so
the pointer message ends up landing in the center anyway.
(imported from commit 56d4c2acd018d9a87551c82a43c214c6d80bfb90)
Previously we incorrectly would sometimes trigger autoscroll when
messages arrived via get_old_messages (i.e. we loaded some historical
messages from the server). This resulted in some confusing and
erroneous scrolling behavior.
I kinda hate the fact that we need to pass these values all the way
through the rendering process, but fundamentally there's no other way
for _render to find out, and pushing the autoscrolling higher up in
the stack is hard since we don't return anything like the block of new
messages.
(imported from commit c5ed27f1b21691a21c68ed7e09cff8e3e4a75e76)
This is purely cosmetic, and just puts some similar functions
together in a way that JS lint won't complain about calling a
function before it was defined.
(imported from commit 8a5a81ae5b7ca7dbaa60147ae4f32f50b1cbbf3a)
This reduces roundtrips hopefully and will provide a friendlier error
message than what would otherwise be produced by Django.
(imported from commit 034aeef00043e3bf059583770f6c08c4f73ceeb5)
Fixes the JS traceback "'null' is not an object" introduced in b67e52d.
Testing: Receive a message when narrowed to a different subject, with
the window focused.
(imported from commit 54b9e7924a2bf66ba5cc9799fc3687a084496465)
Fixes the JS traceback "Selected message id not in MessageList"
introduced by b67e52d
Testing:
* Narrow to a subject and send a PM
* Narrow to a PM recipient and send a stream message
* Narrow to a subject and send a stream message to a different subject
(imported from commit 1171c3f97813dc7db891042906762be8afb2a1b5)
This reverts commit f8fbf70c8502370a78159e24f3cf9589fb9d384f, since
we're waiting on some Firefox and no-hover fixes.
(imported from commit 6b13f5bb9d907303ab311afd7da584bc06538c91)
(The dead code made sense in the very early phases of sketching out
the feature, but it's no longer executed.)
(imported from commit 464145f227ddb25f0554bbbade0b0e3e0e399bc3)
This is slightly inconsistent, but keeps the unread count from decreasing
when narrowing and un-narrowing.
(imported from commit 185e8653c31a312c166e784b335ae7ae7e9b78e9)
I tried 30px at first, but I think a slightly bigger avatar helps
fill out the table a bit. It should be easier to tweek these in
CSS now, although Allen agrees with me that the tabular display
may be short lived when we add edit/delete features.
(imported from commit b4d69cddf63fa122374e20731a5755e7dec86304)
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)