Commit Graph

62 Commits

Author SHA1 Message Date
Keegan McAllister d6d34075ab Remove duplication in message validation
NB: this does change which error will be flagged if multiple conditions apply.

(imported from commit 080bf7d764f1f16ad57b365ad9aa6bc48f3cff72)
2012-11-06 17:04:10 -05:00
Keegan McAllister 366ca546e8 compose: Remove duplicated code in getters / setters
(imported from commit 3a17ef6fbcf9b8b4a31a54656152a1d37dea4fa0)
2012-11-06 17:04:10 -05:00
Keegan McAllister fcf21177fe compose.start: Reformat default opts
(imported from commit e0266265dbe81d19f3a666b2f822dffd2d8793d5)
2012-11-06 17:04:09 -05:00
Keegan McAllister 4cd5cdbcd6 Revert "Clean up how we deal with the message type tabs"
This reverts commit 429e055d3eca65af8bc0fe58481a7becf9ced66a.

There is some inconsistency between the names 'huddle' and 'personal' that is
breaking things.

(imported from commit 4c81853fca9d88d13ce8f23e2d6884c33cdc57d2)
2012-11-05 15:01:49 -05:00
Keegan McAllister 477bad9536 Clean up how we deal with the message type tabs
(imported from commit 429e055d3eca65af8bc0fe58481a7becf9ced66a)
2012-11-05 11:49:01 -05:00
Waseem Daher 765aa833bc Clean up jQuery selectors for the composebox send button.
(imported from commit 6bf7ee00f23290ae5e254b4964db3ed51527368b)
2012-10-31 16:36:22 -04:00
Waseem Daher e7e05d8617 Fix up some overzealous "instance->subject" renames.
(imported from commit f4ddcfd3749d374cc6abee3b1e7a5aacc3b83e16)
2012-10-30 16:48:00 -04:00
Zev Benjamin bdb0ac73a3 Manually validate before send
Validation was happening, but was not preventing sending.  We now
just manually call the validation function in compose.finish()
instead of relying on jquery.form's beforeSubmit option.

(imported from commit e094832bf8948f4c6f58cc0d0923bf0fd09db4b1)
2012-10-29 17:39:22 -04:00
Zev Benjamin 696a04743a Factor reload-related functionality into reload.js module
(imported from commit ef533f3416e8b406a03d28f67b45ca59523cef8e)
2012-10-29 17:38:44 -04:00
Zev Benjamin cee3f87585 Use compose.finish() instead of manually calling ajaxSubmit() in multiple places
(imported from commit 3bbe4a03171d9eace413b576ae2c7ccf99141bf1)
2012-10-29 13:58:40 -04:00
Keegan McAllister 899e6d1042 Resize the compose box on show
It doesn't work to do this immediately after we clear the contents, for some
reason.

(imported from commit b24e2464afc7a4703d4a679ab0b51ac150f1ce89)
2012-10-23 22:08:47 -04:00
Keegan McAllister af065005fc Automatically resize the compose box
(imported from commit 7e9cb632bdca47fee6ad0897a55d1d3c004c34b3)
2012-10-23 22:08:44 -04:00
Tim Abbott bf007776ce Fix selecting huddles using the mouse type-tabs.
(imported from commit 6b9981cf6d5a5aaf9d644a18cc04397f3cf0dead)
2012-10-20 10:35:39 -04:00
Zev Benjamin a80e08fbf3 Fix typo
It was preventing the right text area being focused on huddles

(imported from commit 8ebe457b4e5bce723e3afd9f396f97eeb0e97c46)
2012-10-19 17:04:28 -04:00
Zev Benjamin 9c2da407e6 Update the current composition type on toggle
This was preventing huddles from sending because clients thought they
were still sending a stream message.

(imported from commit 694b06cbc43adc9563327ebffccb7fa37aa36bac)
2012-10-19 17:00:27 -04:00
Zev Benjamin 337836ef54 Fix initial focus on new messages
(imported from commit 4553f6209362f684110b34e92fdba2046cfbb08e)
2012-10-19 16:17:29 -04:00
Zev Benjamin 9de73b5a91 Be intelligent about which input box is highlighted in compose.start()
(imported from commit 37268601d569fdb510415ebfae594804817c0e3a)
2012-10-19 16:09:13 -04:00
Zev Benjamin 1b47cd58f1 Rename compose.message -> compose.message_content to avoid confusion with new API
(imported from commit cce8baba49a4176bdb900a83006db3bf23bcd82b)
2012-10-19 15:53:05 -04:00
Zev Benjamin 08b4bd0d9c Determine whether the user is composing based on a flag instead of element visibility
The flag is set to the kind of message being composed in
start_composing() and set to false in finish_composing().

This avoids the problem where composing_message() will return true
when the animation is still running.

(imported from commit 4c2e7e1fad2e6b2123825bd51d5b24ae41bccd45)
2012-10-19 15:53:05 -04:00
Zev Benjamin 621909df6b Add custom jQuery events to the compose abstraction
(imported from commit 3ff10baafd0825ed8b7ed50a8b668080d1e9f303)
2012-10-19 15:53:05 -04:00
Zev Benjamin 7a44a3b05a Use the new compose API
(imported from commit fb91febbd5c257aea15292d8071da69a3e6b9a99)
2012-10-19 15:53:05 -04:00
Zev Benjamin 746897b36a Add a compose API for starting, canceling, and finishing messages
(imported from commit 372e1c2ae19a72bcbb989fa2be5c510a1278fc69)
2012-10-19 15:53:05 -04:00
Keegan McAllister 95f8eea14b Module pattern for subs.js
(imported from commit adfe466ea892fbfe5f13a5f346e4fd00f194c42a)
2012-10-18 15:46:58 -04:00
Keegan McAllister e7661f7b2f Module pattern for compose.js
(imported from commit 8ea9d949b793285e8722bebcef30991d06e5673e)
2012-10-18 15:11:25 -04:00
Keegan McAllister 1398641aa3 Module pattern for hotkey.js
(imported from commit 56616bc8eeaa594ca70bb92bf17a88f97027fd35)
2012-10-18 14:35:42 -04:00
Tim Abbott 461da3f742 Only check if a stream exists if we're not subscribed to it.
This should make sending twice as fast.

(imported from commit a30c6fe7f20aae65d0bfe65e76774017b2627c04)
2012-10-18 13:43:54 -04:00
Tim Abbott 247cfc5344 Fix create-and-send functionality.
(imported from commit 24452eb90e9aaeb0ad406f6c56ce412e2f410865)
2012-10-18 13:43:50 -04:00
Tim Abbott 5c50375e02 Display a message and disable compose while reloading.
(imported from commit f998d2e4053e7e2d676f7fe08ee274118dd9faba)
2012-10-17 14:59:49 -04:00
Tim Abbott 7237b4a73e Fix sending to a stream with a space in its name.
Previously if you tried to send to "a b", we actually ended up trying
to send to "a%20b", since we were url-encoding the stream name and
then not properly decoding it.

(imported from commit 307d2999bd309e47fc654ae4422ab4372edde064)
2012-10-17 14:06:00 -04:00
Tim Abbott 8a7779ad49 Tab should toggle stream/huddle even if you clicked the compose botton.
(imported from commit a705c7cd0d6067dc05da7a64f29fb3ef42838785)
2012-10-17 12:05:43 -04:00
Tim Abbott d2343813df Add 'C' hotkey to start composing a huddle.
(imported from commit 693aeba202a06465dd41e46d78491ecfe23e97f6)
2012-10-17 11:55:21 -04:00
Tim Abbott 6642a65269 Convert last few json views to use the json_success api.
(imported from commit 7a617ec7e7c8607e8ba87e7a9b8599a83b91666c)
2012-10-16 16:54:41 -04:00
Tim Abbott a859c10017 Don't redirect to a login page when responding to json messages.
Also update tests to actually check all our URLs.

(imported from commit 86de2027d140da6118e2f2f60c1c86511b16c141)
2012-10-16 16:38:39 -04:00
Tim Abbott 3e994c16b7 Rename/reorganize our urls to be more consistent.
(imported from commit ca3cc7ccd5d7da83a9c60968527378ee1118648e)
2012-10-16 15:56:06 -04:00
Zev Benjamin 24c1a2d7f1 Make compose box accessor functions also be setters
(imported from commit ab568cc2c224b8558148f158d1c9c1f89bb1eb49)
2012-10-16 15:30:09 -04:00
Zev Benjamin adf75d48e1 Make pressing escape also un-narrow
(imported from commit 17d2cc3e8074af332f98588ad201ec342476d51f)
2012-10-11 14:30:51 -04:00
Tim Abbott ac3f4393ff Rename instance to subject.
(imported from commit 6b4693da03f106448c137cf81cf9801cac44f2b8)
2012-10-10 18:01:39 -04:00
Tim Abbott 8dca315a18 Rename s/class/stream/ in code local to various js files.
(imported from commit c441f9d7d4155ff3c4b171a2a4a3db4ffbb60ac4)
2012-10-10 17:48:18 -04:00
Tim Abbott 5509419084 Rename #class* to #stream*.
(imported from commit a8f15f636f3801ba1152f1020e885240984d070e)
2012-10-10 17:48:17 -04:00
Tim Abbott 873f8fd2bb Rename class-message to stream-message.
(imported from commit fe69222bdca28bab303adca8ea8448a6aac35e40)
2012-10-10 17:48:17 -04:00
Tim Abbott 413fdeb655 Rename class_name to stream_name.
(imported from commit e610f5de5edf756ef0a71c5361fcd507adbb1605)
2012-10-10 17:48:17 -04:00
Jessica McKellar c4dd4ea06f Clear compose error messages on New Message or message type tab toggle.
Also highlight a useful input box on tab toggle.

(imported from commit e046cd077039b42069e866267038b92536a05e1b)
2012-10-10 16:59:20 -04:00
Tim Abbott 363c658896 Rename zephyr_comp to message_comp.
(imported from commit 752b669c3298dd791ba26de9fd815faa1b4e8a73)
2012-10-09 22:42:19 -04:00
Tim Abbott a62cd32107 Rename zephyr_compose* to compose*.
(imported from commit 103351bbdb7657720d7b7b9f57ee88e5957d09a4)
2012-10-09 22:41:17 -04:00
Tim Abbott 78c303e44a Rename zephyr-type-tabs to message-type-tabs.
(imported from commit 623d226209bc6cbe20721be08a271e52185ea65e)
2012-10-09 22:40:12 -04:00
Tim Abbott 864a26acd6 Rename the new_zephyr text area to new_message_content.
(imported from commit b5d09625a9c50865be7a6401e8da95efe06410fc)
2012-10-09 22:40:12 -04:00
Jessica McKellar fb62e808d7 Use an associative array for faster subscription checks.
This also helps us manage checking, case-insensitive, for
subscriptions while preserving the casing used by the class creator
for display.

It also fixes a bug where the class_list would become out of sync with
your true subscriptions, allowing you to appear to send messages to
classes to which you had unsubscribed.

(imported from commit 5e8d017bcfb27a71c52f7517733eda7b926d721b)
2012-10-09 17:28:21 -04:00
Waseem Daher 86dfc93f96 Reintroduce composebox animation.
So what's now happening here is that the outer div (which we were
previously animating) doesn't get animated at all; instead it is
simply made visible or hidden.

I *believe* this means that it always continues to take the same
amount of space in the DOM; its being added and removed seemed to
cause a slight height-of-page change which caused the scrollHandler to
fire, causing the selected message indicator to move down the page.

So now that this height is fixed, we achieve the animation instead by
animating the inner div -- the one that actually contains the
composebox elements.

(imported from commit 95b2f95d52254e3792633460f42efaac27559efe)
2012-10-09 14:25:18 -04:00
Waseem Daher 8083a149b8 Fix selected-message glitch on composewindow by removing animation.
The issue with the animation is that it removes the composebox div
when it's done -- or more relevantly, it "adds" it when the composebox
appears, which causes some DOM elements to get reshuffled slightly
which causes some jitter.

(Similar to what was happening with the email addresses earlier.)

So instead of using display:none, we play with visibility:hidden,
which causes the thing not to show up, but doesn't cause it to
lose its place in the DOM.

(imported from commit a18dbdcd1784b2b54436d48d8425d5fdc8dfbba4)
2012-10-09 14:25:18 -04:00
Jessica McKellar ad213fc810 Fix focus on create/sub buttons if you try to send to a new/unsubscribed class.
This is a regression introduced by switching from links to buttons,
which get blurred by hide_compose.

(imported from commit f5aa67cb949f3edc7f86a0ef0d7f48b43860138b)
2012-10-09 14:06:56 -04:00