Commit Graph

58 Commits

Author SHA1 Message Date
Vinit Singh 86073588be dependencies: Upgrade jquery-autosize 1.17.7 to autosize 4.0.2.
The API for the autosize library changed upstream, so several changes
had to be made to relevant js files for a successful upgrade.

Resolves #12695.
2019-07-18 14:33:16 -07:00
Mohit Gupta 6ec40cf9a0 search: Don't mark messages as read in search narrow.
Don't mark unread messages as read while searching.
This behavior will be extended to other narrows later.

Fixes: #12556.
2019-07-17 17:58:20 -07:00
Rishi Gupta 99ea5f4e32 popovers: Remove a few entries from stream popover.
These options are pretty low-value, since clicking the stream does the
narrow, and it's likely that almost nobody sends messages via these
buttons.
2019-03-06 17:36:06 -08:00
Tim Abbott 309aef4c27 compose: Fix "You need to scroll" notifications for large messages.
When you just sent a large message, our logic for "you need to scroll"
notifications did not correctly take into account the height of the
compose box.  This was easily reproduced when sending very long
messages.  The correct solution requires a bit of math to compute what
the visible area will look like after the compose box is closed.

This should be the final fix to #11138.
2019-02-05 13:17:10 -08:00
Steve Howell 01d9a3b02c quote/reply: Leave message intact for IE/Chrome.
We had a bug where if you started typing a message
and then used quote/reply (after the fact), we
would overwrite the user's original message.

The bug was kind of subtle--the internal call
to "respond" to the message would select the message
text, and then `smart_insert` would replace the
selection, unless it was Firefox.

Note that we now also allow you to cross-post
replies, which is a plausible scenario, although
possibly unintentional at times, too.  I'm erring
on the side of giving the user control here, but
I'll add a warning in the next commit.  Our compose
fade feature should also prevent unintentional
mixes here, too.
2019-01-23 10:57:40 -08:00
Steve Howell 664ee8d017 quote/reply: Dedup some logic with replace_content().
We often need to go to the server to get raw content.
The exceptions are messages for which we've already
fetched the raw content for some other reason (maybe
a previous quote-and-reply) or which are locally echoed.

Whether we can get the raw content locally or from
the server, the replace_content() logic is the same.
2019-01-23 10:57:40 -08:00
Steve Howell 4b2181ffa2 Rename util.get_topic -> get_message_topic().
The specific name will help us when we fully cut
over to "topic" on message objects.
2018-12-29 11:38:39 -08:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Steve Howell 35b904b184 subject -> topic: Fix subject in opts.
It's kinda difficult to track down all the interactions
with the opts that go through compose_actions.start(),
but I think I got everything.
2018-12-16 11:26:18 -08:00
Steve Howell d7aa5fcc38 compose: Remove obsolete references to replying_to_message.
The `replying_to_message` field was used in some
early versions of compose fade, but it has no more
use in the current code.

The drafts implementation didn't really make any sense,
anyway, as we were claiming to reply to the same
message we were drafting.
2018-12-16 11:26:02 -08:00
Steve Howell d7c2577ffb subject -> topic: Rename compose fields.
The stream/topic edit areas now have these ids:

        #stream_message_recipient_stream
        #stream_message_recipient_topic

They are pretty verbose, but being able to grep
for these without noise does have some value.
2018-12-09 21:28:45 -08:00
Rohitt Vashishtha ee3b4f3ee9 hotkeys: Map `CTRL + .` to narrow to compose box target.
Also adds relevant tests and documentation. We currently
do not narrow to a new topic, and instead just narrow to
the stream. Similarly, we do not narrow to a PM if any of
the recipients are invalid.
2018-12-04 13:58:00 -08:00
Steve Howell 68d81cb25b subject -> topic: Fix respond_to_message(). 2018-11-16 11:11:40 -08:00
Tim Abbott 86801d350a compose: Store raw_content after fetching it for quoting.
This is a nice performance optimization for the rare case where the
user does quote-and-reply on a message, aborts the compose, and then
re-does the quote-and-reply.
2018-11-14 23:55:26 -08:00
Marco Burstein f37e4df471 compose: Check if `raw_content` is present when quoting.
If `raw_content` is already present for the selected message, there is
no need to make a request to the server.
2018-11-14 23:52:08 -08:00
Steve Howell b615f0df4d subject -> topic: Fix stream/subject in comments. 2018-11-14 23:24:06 -08:00
Rohitt Vashishtha d7a0bd4a6c subject-to-topic: Add topics to compose_state.js. 2018-11-14 23:24:06 -08:00
Marco Burstein 207d7a8ee6 compose: Use a placeholder when quoting and replying.
Use the placeholder `[Quoting…]` when quoting and replying before the
quote has been added to the message. Also, add tests to the
`compose_actions` Node tests for the new behavior.

Fix #10705.
2018-11-07 09:56:38 -08:00
Rohitt Vashishtha 38cddf7d54 compose_actions: Use people.get_mention_syntax in reply_with_mention. 2018-10-13 16:42:50 -07:00
Steve Howell eb676e8e50 Add more space between compose box and selected message.
When we nudge up the feed to prevent the compose box
from obscuring it, we now have 20 pixels of separation
instead of 5.  Before this fix, it was hard for users
to know whether they had any messages being covered.
2018-08-29 14:26:48 -07:00
Steve Howell 9f3b71b0b8 Adjust the message feed for long messages.
We now have a callback for whenever the compose
box gets autosized by our old vendored version
of the autosize widget.  It calls code to
scroll up the message feed if we are newly
covering it.
2018-08-28 13:50:19 -07:00
Steve Howell c7ab3884c6 refactor: Extract reload_state module.
This is part of work to break some of our
nastier circular dependencies in preparation
for our es6 migration.

This commit should facilitate loading leaf-like
modules such as people.js before all of the things
that reload.js depends on.
2018-08-04 13:55:02 +00:00
Steve Howell bec40af614 Remove redundant narrow_state.get_current_filter().
We now use narrow_state.filter() everywhere.  The
two functions did the same thing, and I slightly
prefer the concise name, which was already in use
in lots of places.
2018-07-10 14:20:24 +05:30
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Shubham Dhama 80a2d5bc59 eslint: Enable `conditionalAssign` config of no-trailing-spaces rule. 2018-06-11 07:51:24 -04:00
Shubham Dhama cc03f9fb8f eslint: Enable space-infix-ops rule.
More about rule at  https://eslint.org/docs/rules/space-infix-ops
2018-06-05 00:47:35 +05:30
Shubham Dhama c6738889a9 eslint: Add and enable `space-unary-ops` rule.
Info about rule at https://eslint.org/docs/rules/space-unary-ops.
2018-06-05 00:47:35 +05:30
Shubham Padia 6ea6f5e0af search: Do not open compose box if invalid recipient present in `pm-with`.
If atleast one of the private_message_recipients is invalid, compose
box will not be opened.
Thanks to Aastha Gupta <aastha.gupta4104@gmail.com> for some preliminary
work on this.
2018-05-28 10:45:42 -07:00
Tim Abbott 7ab8a8e820 js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration.
90% of these changes are just fixes for indentation errors that have
snuck into the codebase over the years; the others are more
significant reformatting to make eslint happy (that are not otherwise
actually improvements).

The one area that we do not attempt to work on here is the
"switch/case" indentation.
2018-05-06 16:25:02 -07:00
Tim Abbott a0fcc6ceb5 compose: Don't auto-scroll very tall messages on click.
This fixes an issue where with very tall messages (more than about a
screen in height), one would end up scrolled to the bottom of the
message if you clicked on it, which usually felt annoying.

Fixes #8941.
2018-04-27 14:19:58 -07:00
Tim Abbott b12368aec5 compose: Fix fading when topic changes on re-narrow.
Now that we're changing the topic on re-narrow more frequently, we
need to ensure that we update the compose_fade state when we do so.
2018-04-05 15:21:02 -07:00
Tim Abbott 5a5b4730f1 compose_actions: Keep the compose box open on topic change.
This tweak to our compose on-topic-narrow logic may help make it a bit
easier to do quick replies without needing to re-open compose.  I'm
not 100% confident this actually makes Zulip better, but it's worth
testing and getting some feedback.

Fixes #6473.
2018-04-05 15:17:40 -07:00
Tim Abbott b9acdd947a compose_state: Re-fade message list when switching topics.
For a non-empty compose box, we previously considered closing the
compose box when switching topic narrows with content in the compose
box; now we leave it open unconditionally.

Part of #6473.
2018-04-05 15:17:40 -07:00
Shubham Padia 6262460773 refactor: Rename mark_message(s)_as_read to notify_server_message(s)_read.
Fixes #8965.
Mark_message(s)_as_read is used in marking a message as having been
read by the browser, rename it to notify_server_message(s)_read to
avoid any confusion.
2018-04-05 09:54:48 -07:00
Balaji2198 15d42f86f1 left sidebar: Fix "Compose" in stream actions popover prefills topic.
Fixes #8824.
2018-04-01 16:24:15 -07:00
Anurag Sharma 1227857de6 hotkeys: Replace C with x for composing PM.
Pressing the 'x' key can now be used to compose a PM.
Pressing the 'C' key displays a modal that shows a deprecation notice.

Fixes #6548.
2018-04-01 16:13:05 -07:00
Balaji2198 6ffe2cc815 compose: Fix "New Topic" button behaviour auto-populates the current topic.
Previously, Clicking a "New Topic" in a topic narrow auto-populates
the current topic.

Fixes #8608.
2018-03-16 12:01:24 -07:00
Aastha Gupta dc60b3a44b compose: Don't clear compose box on narrow if it matches compose.
If we're entering a topic narrow, and the compose topic is the same as
narrowed topic, then leave the compose box open.

This is important if you open compose in a topic narrow, click on a
narrow, and then use the back button to return to that original
narrow.  Before this change, we'd close the compose box for no reason.

Fixes #6510.
2018-03-11 21:25:23 -07:00
Steve Howell 3a1bf04a56 compose: Add pills for typing in PM recipients.
@brockwhittaker wrote the original prototype for having
pills in the recipient box when users compose PMs (either
1:1 or huddle).  The prototype was test deloyed on our
main realm for several weeks.

This commit includes all the original CSS and HTML from
the prototype.

After some things changed with the codebase after the initial
test deployment, I made the following changes:

    * In prior commits I refactored out a module called
      `user_pill.js` that implemented some common functions
      against a more streamlined version of `input_pill.js`,
      and this commit largely integrates with that.

    * I made changes in a prior commit to handle Zephyr
      semantics (emails don't get validated) and tested
      this commit with zephyr.

    * I fixed a reload bug by extracting code out to
      `compose_pm_pill.js` and re-ordering some
      calls to `initialize`.

There are still two flaws related to un-pill-ified text in the
input:

    * We could be more aggressive about trying to pill-ify
      emails when you blur or tab away.

    * We only look at the pills when you send the message,
      instead of complaining about the un-pill-ified text.
      (Some folks may consider that a feature, but it's
      probably surprising to others.)
2018-03-07 15:53:11 -08:00
Shubham Dhama dcac002213 compose: Use insert_syntax_and_focus to insert text in compose textarea.
Use compose_ui.insert_syntax_and_focus() when we need to insert text
inline-ly followed by the focus to compose textarea because it does
this job more smartly(it take cares of spaces).
2018-03-01 08:00:42 -08:00
Abhigyan Khaund a75f0aa594 hotkeys: Add "p" to narrow to next unread PM thread.
This works simimlar to the "n" key for next topics.

This commit does a few things:

    * It wires up the hotkey to an existing function
      that could change narrows.
    * It adds documentation.
    * It adds logic to make sure the compose box does
      not open.

@showell helped a bit with the wording of comments here.

Fixes #4874
2018-02-27 07:20:31 -05:00
Balaji2198 f49d9d016f hotkeys: Add '>' as a hotkey for quote and reply to message.
Tweaked by tabbott to fix a few minor issues.

Fixes #8146.
2018-02-02 17:37:53 -08:00
Marco Burstein e9d7161418 compose: Warn users when posting to the #announce stream.
Currently, users are warned when mentioning @all and @everyone, but not
when posting on the #announce stream. Confirm with users that they want
to send their message on #announce if over 60 people are going to be
notified.

Fixes #6928.
2017-12-20 07:36:50 -05:00
Shreyansh Dwivedi 5b49259722 compose box:Add a reply button. Fixes #5578 2017-12-15 14:23:24 -05:00
cPhost 8d0ccd29fe narrow_state: Make set_compose_defaults return opts. 2017-12-03 14:01:19 -08:00
Tommy Ip 6e22847548 refactor: new message content -> compose textarea. 2017-11-28 12:53:40 -08:00
Tommy Ip c0c58f9761 refactor: s/send-status/compose-send-status. 2017-11-27 21:35:14 -08:00
Rhea Parekh 1d826ae201 composebox: Warn when linked to private streams.
Fix issue #6860
2017-11-27 07:41:59 -08:00
Joshua Pan ac64ee355d compose_actions.js: Allow compose to empty narrow.
This allows r/enter hotkeys to compose to
an empty narrow (no messages).

Fixes #4500.
2017-06-27 14:06:59 -04:00
Harshit Bansal 6615f2f2e8 common.js: Migrate `common.js` module to use IIFE module style.
This module was exposing its functions as globals. This PR fixes
it use the IIFE module style that we use in our other modules.
2017-06-22 19:06:32 -04:00