Commit Graph

828 Commits

Author SHA1 Message Date
Reid Barton 389a52de6e Fix test for adding to top or bottom of zhome/zfilt
It's possible for selected_message_id to not exist in zhome. For
instance, when you open the page to a narrowed URL, there is a race
between loading the narrowed messages and loading all your
messages. If the narrowed message request completes first, it will
update selected_message_id to your initial_pointer if the latter
happens to be among the narrowed messages. Even if it is not, you can
select a message by clicking on it before the zhome request finishes.

Then the old code would never add that selected_message_id to the
zhome table, so it wouldn't show up in the Home view or if you
re-narrowed.

I'm pretty sure there are still cases where the selected_message_id
might be outside the range of messages in zhome, in which case adding
to zhome might put old messages at the bottom. I observed this twice
on staging but was unable to reproduce it consistently.

(imported from commit 162feff3090f8806cc67140db0cfabb6e965aece)
2013-01-14 10:33:51 -05:00
Waseem Daher d9e50117be Frontend for invitations.
(imported from commit 8afab7cc5a4a5c14b605f1b27b48036c9414f7d0)
2013-01-14 10:25:26 -05:00
Jeff Arnold 3c8b30d043 Revert "Autocomplete @names in the compose box"
This reverts commit d60d1693e77bdd045a1bd20491c6d6efed918b39.

(imported from commit 796036e146eaf917b74dc0bac01e92aa6a682d16)
2013-01-11 13:49:23 -05:00
Jeff Arnold 09a6dc6c42 Autocomplete @names in the compose box
(imported from commit d60d1693e77bdd045a1bd20491c6d6efed918b39)
2013-01-11 13:00:34 -05:00
Jeff Arnold 279ded6072 Notify when we see our username or our name plus punctuation
(imported from commit 158c78de264ef31f61670694764d025a773ae840)
2013-01-11 13:00:34 -05:00
Waseem Daher e3e8d9b939 Revert recent set of floating_recipient_bar changes.
We suspect that these seem to be causing a regression where scrolling
in narrowed views gets really sluggish, but we haven't totally been
able to figure out why since it's challenging to reproduce locally.
(It currently manifests itself on staging but not prod.)

So for now we'll back them out. Here's the full set of things:
Revert "Cause update_floating_recipient_bar to get called less frequently."
This reverts commit a6c1518c4001a2dde44d7b512236795da3ccd351.

Revert "Remove double-scroll in un-narrowing code."
This reverts commit 3dde6c27ffa1e8afa1a084b1b2baee3bc0512962.

Revert "Reset our scroll position if we change our hash to "#"."
This reverts commit 925b44d770c96dafaabebc9e0114f9a3b8f53c4d.

Revert "Properly update floating subject bar when you are at top of page."
This reverts commit 6633cc8a81aedcbb31b30d7c1f27816f8808c700.

(imported from commit a273730581cef30c33bedf701659ee084434f8ad)
2013-01-11 10:58:04 -05:00
Waseem Daher 66af2da9ed Cause update_floating_recipient_bar to get called less frequently.
Putting update_floating_recipient_bar in the old location caused it to
be called on every single keypress, which is unnecessarily
expensive. Instead, just call it once when we think we might actually
need it: after initiating a narrow.

(imported from commit a6c1518c4001a2dde44d7b512236795da3ccd351)
2013-01-10 14:19:29 -05:00
Jeff Arnold 97e8fb893b Fire a notification for an @name match anywhere in the msg content
(imported from commit 1b6932b1b1094af6f0de2346ca721805e264490d)
2013-01-10 13:44:06 -05:00
Waseem Daher 7796940c72 Remove double-scroll in un-narrowing code.
select_message_by_id with then_scroll: true already recenter_views
on the selected message; no need to also call scroll_to_selected.

(imported from commit 3dde6c27ffa1e8afa1a084b1b2baee3bc0512962)
2013-01-10 11:38:50 -05:00
Waseem Daher a9112155da Reset our scroll position if we change our hash to "#".
Changing the hash to "#" causes Chrome to jump to the top of the page
on Mac OS X. This commit doesn't actually fix any bug, but it
is necessary for my *next* commit, where otherwise you'd have to
ensure that the scroll code came *after* the hashchange code.

(imported from commit 925b44d770c96dafaabebc9e0114f9a3b8f53c4d)
2013-01-10 11:37:44 -05:00
Waseem Daher 1141bfa888 Properly update floating subject bar when you are at top of page.
There's this very edge-case issue which is: if you go to the top of
the page and narrow to something other than the top message, the
floating subject bar does not update.

Why? Well, the way that the narrowing code works is that it sets up
narrowing and then calls
  select_message_by_id(target_id, {then_scroll: true});
so that our selected message is in the view.

This in turn calls select_message, which calls recenter_view as
appropriate. This usually causes a scroll action, which in turn causes
the floating recipient bar to be updated.

But when we're at the top of the page, recenter_view doesn't need
to scroll at all! So the bar remains un-updated. Here we explicitly
update it to guard against that case.

This fixes Trac #651.

(imported from commit 6633cc8a81aedcbb31b30d7c1f27816f8808c700)
2013-01-10 10:59:03 -05:00
Jeff Arnold 5d5c490613 Disable speaking-at-me notifications for mit.edu
(imported from commit 194c5241311b46f26ecb0b2bb2201b1a7af7b520)
2013-01-09 23:05:02 -05:00
Waseem Daher c206930711 Fade in when you narrow, in an attempt to make it more visually obvious.
I don't view this as a complete solution to
Trac #466 - Make the fact that you are narrowed more apparent,
but it's a start.

(I think a real solution would have to give you something that
helps you make the determination of "Is this view narrowed?"
when you come back to your computer, and this animation does not
help you do that.)

(imported from commit eb3646f3f3a4e25a43266e9146308633fd997eb2)
2013-01-09 21:46:08 -05:00
Waseem Daher 9fb6edfb96 Rearrange code for clarity.
This commit just moves around some lines so that the code that
hides the main view and shows the filtered view, or vice versa,
are together so that it's easier to reason about the sequence
of things that's happening.

(imported from commit 7e99f45293c0e1a4cdfa1a08f41f8c770c370d6c)
2013-01-09 21:46:08 -05:00
Waseem Daher a629f7edf6 Remove dead reference to 'show_all_messages'.
This used to be a button that let us un-narrow, I guess.
A git grep for it after this commit turns up no actual
references to it.

(imported from commit 05acb4bb40da1b032f548c511fbae5b2b20874a8)
2013-01-09 21:46:08 -05:00
Waseem Daher 3a585505a4 Remove the narrow-view 'shadow' pointer.
And change the color to a more thematically appropriate blue.

The shadow pointer is sort of confusing; we should really provide some
different sort of indication that your pointer is potentially moving
on narrow-and-unnarrow. (I think my fade-in-fade-out later in this
commit series is a not-bad first crack at this.)

Resolves Trac #472 - Dual pointers in narrowed view can be confusing

(imported from commit 2450517d99de85ade1c0e98c5510b59e70282451)
2013-01-09 21:46:08 -05:00
Jeff Arnold 7709e21a24 Notify the user when someone is speaking at them
(imported from commit 662ea67b2cf210bfd327ae2db6f924e4424d6d50)
2013-01-09 20:18:39 -05:00
Waseem Daher 10db1b30f1 Use cached selector for $(window).
Mostly for consistency with the rest of the code around here.

(imported from commit 87539fea96286e1563624efd2a4800df88f2199c)
2013-01-09 15:30:48 -05:00
Waseem Daher 96e66d4c5f Always make sure main_div stretches to the bottom of the page.
If you narrow to a view that only has one or two message, sometimes
the grey box gets cut off and doesn't go to the bottom of the
page. This fixes that.

(imported from commit 55724d03aa30922d91bd33fab4447d889be78889)
2013-01-09 15:30:48 -05:00
Waseem Daher fad7d0a7cb Always show the floating recipient bar.
The initial rationale for hiding the floating recipient bar
was that it duplicated information that was in the "narrowbar".
Now that this no longer exists, let's *always* show the
floating recipient bar.

(Yes, there is some duplication of this information in the
search area, but I think the situation is fundamentally
different now and would basically like to see it everywhere.)

(imported from commit 6fd4506c2f48caade9496139e580e6550252ce8c)
2013-01-08 16:43:50 -05:00
Keegan McAllister 83a0d82d8f Don't retry or display connection error if we send bad narrow operators
Alternatively the server could return a successful result with an empty list of
messages.  But I prefer the solution in this commit, because it would allow us
in the future to warn the user about the problem.  It does allow users to
determine if a given stream exists, but we haven't tried to hide that
information so far.

(imported from commit a91e12c90b12d3c870c0b637c3f1d6d3cef88491)
2013-01-08 12:18:31 -05:00
Keegan McAllister 952296bb3d Hide search.update_button_visibility focus override argument from exports
(imported from commit 98201f7c833f9fc4a1c1d6ecdff033e08c28dd5c)
2013-01-08 12:18:31 -05:00
Keegan McAllister 6dea25fd9f Add narrow.by for syntactic convenience
(imported from commit 51300b93a078d54e5111e6bb16ecd9ecbcc295d2)
2013-01-08 12:18:31 -05:00
Keegan McAllister 3af2bf345a Reinstate server-side narrow filtering
(imported from commit 40f63324a8dff404b504b06bddf303b8c1ad5780)
2013-01-08 12:18:31 -05:00
Keegan McAllister 3455e37160 Get rid of is:pm alias for is:private-message
It's cleaner if the filtering code recognizes only one value.
We can add this back in by converting in the parser.

(imported from commit 453b7b01e094955c6d66be63b5d997cc56b50a35)
2013-01-08 12:18:31 -05:00
Keegan McAllister dbc4798594 Be consistent about when we display search buttons
Show the buttons iff

    - the search input is focused,
    - the search input has non-empty contents, or
    - we are narrowed.

(imported from commit f5c98471a2db4ab522160960dd1271471a9db555)
2013-01-08 12:18:31 -05:00
Keegan McAllister 60f2d06736 search: Factor out show_buttons / hide_buttons
(imported from commit 776f066129e8cf4e298ae90fdd4f62341b36dcae)
2013-01-08 12:18:30 -05:00
Keegan McAllister f3e4b3bc31 search: Simplify event handler setup
(imported from commit b14c4bafb09fa5919e03aac24e968329778a01d6)
2013-01-08 12:18:30 -05:00
Keegan McAllister ddf75b64f7 Un-narrow whenever we clear the search box
(imported from commit 15533579bfbae1644cc76b33348c3cd21a829713)
2013-01-08 12:18:30 -05:00
Keegan McAllister 4ddaf5a2ae Use case-insensitive matching for all narrow operators
We don't require that the parsed form be lower case; that's handled by
narrow.activate.  However we unparse as lower case, in order to give the user a
hint that matching is not case sensitive.

(imported from commit 2882b440deb59a049b095db7a13cfc18e047caec)
2013-01-08 12:18:30 -05:00
Keegan McAllister 3619480673 Handle narrowing operators typed into the search box
(imported from commit 6f758091e2953d00d6a331210aa774b72ba889d5)
2013-01-08 12:18:30 -05:00
Keegan McAllister d2705ab913 Add narrow.describe
(imported from commit df123384754701108fe7597710cb0cf46cb86caf)
2013-01-08 12:18:30 -05:00
Keegan McAllister 6d50e233ec Add narrow.parse
(imported from commit 2275d02c2aee411d07645f7c3d81fdff7d188607)
2013-01-08 12:18:30 -05:00
Keegan McAllister 121ba29abe Simplify searchbox_sorter
(imported from commit cce3d2fd2e56801b43c668c849ef4664edc32a6c)
2013-01-08 12:18:30 -05:00
Keegan McAllister 1fcc7a6185 Rework render_object_in_parts to use switch/case
And rename fields for conciseness.

(imported from commit 77d89085f0786ecdcbb2897e3d171c930b44137a)
2013-01-08 12:18:30 -05:00
Keegan McAllister e202638184 Rework narrow_or_search_for_term to use switch/case
(imported from commit a1296e79d9f6414113a475e407fbaccb54eadb14)
2013-01-08 12:18:30 -05:00
Keegan McAllister 5ee6a9ebca Rename narrow.show_all_messages to narrow.deactivate
(imported from commit 927374756e112abc1042b16caa315af8c1f0baec)
2013-01-08 12:18:29 -05:00
Keegan McAllister ba7ffcead4 narrow: Remove some unnecessary helpers
(imported from commit 307dfec262648bc1fc79d2fb46f8950c7a2f1e2e)
2013-01-08 12:18:29 -05:00
Keegan McAllister 3c9b9227f8 Get rid of the narrowbar
(imported from commit 53335b8177561d4b103659a51704d6b2ce7ec367)
2013-01-08 12:18:29 -05:00
Keegan McAllister d4d4ea7a8d Display narrowing operators in the search bar
(imported from commit d801128c5b961360939c9e3f3f6f89c8602f987b)
2013-01-08 12:18:29 -05:00
Keegan McAllister 38ff2d9993 Use operators to express narrowing internally
This breaks server-side filtering, for the time being.

(imported from commit 58ec2d7aa593e1c71f835b186535a038faa63239)
2013-01-08 12:18:29 -05:00
Jeff Arnold 78506acd20 Do not send the browser back on backspace when send button focused
Fixes Trac #585

(imported from commit 2b5a02db66cc09ae41da7e6921a31a14c49cf811)
2013-01-08 12:00:57 -05:00
Jeff Arnold dbb63cb524 Don't continuously bug user if they dismiss the notifications box
Fixes Trac #514

(imported from commit 445af7cf458118be0394491aebbd9996817b08a4)
2013-01-08 11:04:16 -05:00
Waseem Daher 40a8ee48a5 Make stream_list only contain lowercase stream names.
(imported from commit 350f1b20987206c1e910fcc5c2926bd6e96baaeb)
2013-01-07 17:36:37 -05:00
Waseem Daher baba72e3b8 Cause case to be respected when adding a subscription.
And have its colorpicker work.

(imported from commit 998c54153518bb94b7ce41e073078675767694c0)
2013-01-07 17:36:03 -05:00
Waseem Daher 5501558fa7 Only request background color for stream messages.
subs.get_color is expecting a string, and so if you do this on
a PM, it breaks.

(imported from commit acf6d51b84d7bbbe643466f1f72f90a8f6cf16f6)
2013-01-07 17:34:27 -05:00
Tyler Hallada b6e1024b69 Display composebox again upon server errors
Also removed .show()s for the alert on does-not-exist and not-subscribed, where
a blank error would display. This should fix the underlying issue with #166:
that hiding the composebox before send_message() was called would hide server
errors.

(imported from commit a8a50cdf82ddf1d15f1e405432ff3bbfdb7a491a)
2013-01-07 17:03:34 -05:00
Zev Benjamin 9b3e4a8bed Don't focus the new stream box after sucessfully subscribing or unsubscribing
If you have a lot of subscriptions that you're trying to modify,
jumping back up to the top of the page is very disruptive.  We still
show the success message, which has the effect of scrolling the page
and is thus surprising, but that's better than the user completely
losing their place.

We do need a story for informing users about failures to subscribe or
unsubscribe, though.  We currently jump back to the top so they can
see the error, but that's not optimal.

(imported from commit 48d938ddc47f286a72e2147f4459b91ca5684e36)
2013-01-07 13:48:19 -05:00
Zev Benjamin 42bf93fb07 Add expandable settings panel for subscription entries
(imported from commit 3c07dcac7ec8086d417c2898a307ee67fc286704)
2013-01-07 13:48:19 -05:00
Zev Benjamin e1a3765644 Give each subscription an id for easier DOM manipulation
(imported from commit 976744174d06abf8bde651ca815d8fe17b8e64ff)
2013-01-07 13:48:19 -05:00