Commit Graph

78 Commits

Author SHA1 Message Date
Steve Howell 8eb86335b9 Extract narrow_state.js.
Despite the length of this commit, it is a very straightforward
moving of code from narrow.js -> narrow_state.js, and then
everything else is just s/narrow.foo()/narrow_state.foo()/
(with a few tiny cleanups to remove some code duplication
in certain callers).

The only new functions are simple setter/getters that
encapsulate the current_filter variable:

    narrow_state.reset_current_filter()
    narrow_state.set_current_filter()
    narrow_state.get_current_filter()

We removed narrow.predicate() as part of this, since it was dead
code.

Also, we removed the shim for narrow_state.set_compose_defaults(),
and since that was the last shim, we removed shim.js from the app.
2017-04-25 09:57:32 -07:00
Yago González 8f8efb4664 frontend: Show KaTeX errors not related to syntax. 2017-04-03 17:01:50 -07:00
Yago González 34a9e1ae11 markdown: Add TeX typesetting support.
Co-authored-by: Reid Barton <rwbarton@gmail.com>

Fixes #2056.
2017-03-21 16:40:00 -07:00
Yago González 156b204015 echo: Remove impossible 'quote' 4-space-indented code block type.
Since it's not possible to manually set the language in 4-space-indented
code blocks, there's no point in checking if these blocks' type is
"quote".
2017-03-20 21:49:22 -07:00
Steve Howell 8d3d70984d Extract message_events.js. 2017-03-19 21:03:45 -07:00
Steve Howell 27f37e6378 Add hash_util.encodeHashComponent() shim. 2017-03-18 15:52:50 -07:00
Steve Howell 98a627cba8 Add message.type guard to add_subject_links(). 2017-02-26 16:18:02 -08:00
Steve Howell 01aad70910 bug fix: Fix recent regression with at-mentioning.
One of my commits from yesterday erroneously set the
"mentioned" flag on messages that weren't mentioning
the current user, so you would get the pink/salmon
background when you sent at-mentions to other people.

Now we check the user_id before setting the flag.
2017-01-23 16:42:43 -08:00
Steve Howell ee00d848b9 refactor: Eliminate use of page_params.fullname.
We now use people.my_full_name().
2017-01-21 21:45:12 -08:00
Steve Howell e10c6719d9 refactor: Use people.my_current_email() in echo.js. 2017-01-21 21:45:12 -08:00
Steve Howell 8c6dab9750 Use data-user-id for mention buttons in local echo.
The local echo code now marks up mention buttons with user ids
instead of email.  Our code in message_list_view.js deals with
either the old style or the new style of markup now to determine
which mention buttons need to be highlighted.

As part of this commit we extract mention_button_refers_to_me().
2017-01-21 21:45:12 -08:00
Steve Howell efdcfcaea2 Clean up message flag handling for mentions in echo.js.
After this change, if a user sends a message with at-mentions, the
local echo code will add the `mentioned` flag to 'message.flags`
as part of the callback to build the HTML, rather then doing it
hackily during a post-processing step.
2017-01-21 21:45:12 -08:00
Steve Howell 894282222a refactor: Move echo.userMentionHandler code.
The userMentionHandler callback now closes on `message` inside
of echo.apply_markdown().  This sets the stage for the next commit.
2017-01-21 21:45:12 -08:00
Steve Howell 2539ed0563 refactor: Have echo.apply_markdown take message as param.
The function echo.apply_markdown() actually applies markdown to
a message now, instead of simply computing markdown.  Passing
in the outer `message` object will allow us to avoid some hacky
post-processing of messages after rendering, because we can
have our parser callbacks update message on the spot in a more
atomic fashion.
2017-01-21 21:45:12 -08:00
Robert Hönig 89a64de986 De-dup "outside_viewport" notifications on different tabs.
Pass down 'local_id' through functions that handle notifications for messages
that are sent locally. If 'local_id' is undefined, the message was not sent in
the respective tab, so no "outside_viewport" notification should be displayed.
This fixes #1783.
2017-01-12 17:08:18 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Rafid Aslam 45f39be37f lint: Fix many no-unused-vars eslint rule violations.
These have been carefully audited by tabbott to ensure they are
unlikely to cause regressions.
2016-12-14 21:34:51 -08:00
AZtheAsian 9c0ebc7359 eslint: change no-else-return to error and fix violations 2016-12-02 14:43:09 -08:00
Tommy Ip b3f4feb996 eslint: change max-len from warning to error and fix violations. 2016-12-02 14:16:33 +00:00
kevv87 e6369fc29b eslint: change no-plusplus from warning to 2 and fix violations. 2016-12-01 14:27:17 -08:00
aakash-cr7 d99b17070e edit: Fix traceback when saving edits to unsent messages.
7b0c6459b4 accidentally failed to update
one of the calleers of update_private_messages, resulting in this code
path failing consistently.

Fixes #2416.
2016-12-01 10:39:43 -08:00
Arpith Siromoney 29d3019262 Switch no-loop-func eslint rule from warning to error (in .eslintrc)
The one error that needed to be fixed was in static/js/echo.js.
The function in the loop was being used by _.each(). This has been
replaced by iterating through the array using a while loop instead.
2016-11-25 14:02:44 -08:00
Tim Abbott e40e756d47 echo: Fix local echo sending a message to "yourself, ".
Previously, this would incorrectly include a user with name and email
"" in the recipients list shown in the local echo code path.

We fix this and add a test for the issue.
2016-11-14 21:43:13 -08:00
paxapy ade3bda025 markdown: Fix stream link handler in corner cases.
* Fixes handling of multiple stream links and invalid stream names.
* Fixes text regex so it handle hash sign the right way.
* Adds tests for these stream link cases.
2016-11-10 19:22:19 -08:00
Igor Tokarev 852bc6b491 bugdown: Re-enable support for italics in bugdown.
Fixes: #1103.
2016-11-10 19:14:40 -08:00
Mohsen Ibrahim 44c8e4c58c streamLinkHandler: render stream links correctly.
After adding the ability to add stream links to messages using
the following pattern '#**stream_name**' there was a problem
with rendering this using our markdown engine because '**' means
bold text so that would render just to bold text.
To solve this I had to add regular expression in marked.js to match
that pattern and when it matches I call handleStreamLinks in echo.js
which will correctly render it to HTML.

Fixes #2218.

[tweaked by tabbott to url-encode the stream name in the URL and
adding the missing "#" in the display].
2016-11-08 13:52:31 -08:00
Meena Rajan 30acb23314 bugdown: Add support for strikethrough in markdown processor.
[Tweaked to move tests to bugdown_data.json, add additional tests, and
add frontend processor support by tabbott]
2016-11-07 22:26:38 -08:00
Steve Howell 30e01306d9 Eliminate people.reify() and mostly ignore unknown users.
If I try to send a message to an unknown user (which is possible
for some types of realms), then I simply ignore them during the
send codepath, so that I don't later need to patch up their attributes.
2016-11-03 16:20:45 -07:00
Steve Howell 8acdf718bc Move process_message_for_recent_topics() to stream_data.js. 2016-10-28 13:52:25 -07:00
hackerkid bca1953aa4 Add support for !gravatar syntax in echo.js. 2016-10-20 14:40:45 -07:00
hackerkid 95b5ac1d5d Add support for !avatar syntax in echo.js. 2016-10-20 14:40:33 -07:00
Steve Howell a929c6a8ba subject/topic: Rename process_message_for_recent_subjects(). 2016-08-26 20:26:24 -07:00
Alex Wilson 2f47945981 Separate unicode emojis from named emojis. 2016-06-30 15:48:02 -07:00
Alex Wilson b040839c76 Add unicode emoji to frontend markdown parser.
Fixes 2nd half of #1011.
2016-06-30 15:48:02 -07:00
Vishnu Ks 51c86a8e2e Move get_private_message_recipient to message_store.js 2016-05-27 01:03:21 -07:00
Vishnu Ks fe4a03fd01 Move narrowed_msg_list to message_list.js. 2016-04-26 10:25:11 -07:00
Vishnu Ks 35b0af2852 Move all_msg_list to message_list.js. 2016-04-21 17:46:21 -07:00
Tim Abbott 96eb81e5d5 Add documentation of Zulip's markdown implementation. 2016-04-01 09:56:59 -07:00
Kara McNair fd66d9f703 Show 5 most recent "Private messages" when clicked.
Like the Stream Subject lists, Private messages are now shown
when the user clicks on the "Private message" link. User can drill in
to get more than 5 conversations. Selecting PMs from the user or group
PM lists on the right sidebar also opens the list & highlights the
selected conversation.

[Edited by tabbott@mit.edu to fix some small bugs.]
2015-12-15 07:52:54 -08:00
Leo Franchi f2e8929b8a Hide rerender_message and use rerender_messages() in all cases.
rerender_messages() does extra work such as making rerendering in narrows
safe, as well as updating recipient bars. That should be the only valid entry
point for rerendering individual messages

(imported from commit f91aeb2070b1056ab95e01d68a342558c2813ae8)
2014-03-04 10:47:44 -05:00
Leo Franchi 1af7a9db1f Reify skeleton person objects that local echo creates when sending out-of-realm PMs
(imported from commit c0fcdba736f1270d8c05d00546444ee539301877)
2014-03-04 10:09:40 -05:00
Leo Franchi d9bfef4848 message_list.view is a member not a function, do not try to call it
(imported from commit b1d609b5633a9ab42da7123a2d31a63d7627aeec)
2014-02-27 20:25:25 -05:00
Leo Franchi 305cf30c50 Render just one message when editing and updating
(imported from commit 5b28e96e9d410faf9b33a5b0a1b4423191e8de58)
2014-02-27 20:25:24 -05:00
Leo Franchi 9a2bf4f359 Remove blueslip debug for localecho
(imported from commit 88682c42ed398dfe7afecd7260db2aefa7d474ba)
2014-02-10 13:23:28 -05:00
Jason Michalski 0dd61e9222 Blueslip has a warn not warning function
(imported from commit 1f18331cac451c62a089f042b316278030c41965)
2014-02-04 23:08:19 -05:00
Tim Abbott 8c733fde8f Use message_store rather than all_msg_list to get messages by id.
There are 2 uses of all_msg_list previous to this commit:

(1) The contiguous block of messages to be used for constructing the
initial state of narrows.

(2) A way to look up an arbitrary message by ID that may or may not be
in the home view to check if we have it locally.

We eliminate all applications of use case (2), replacing them with
queries on message_store, since they are in fact wrong -- any messages
that are outside the contiguous time period of all_msg_list would not
appear in all_msg_list and thus would incorrectly not be returned.

(imported from commit e2e2efe919242331bbc44abc6c50b16e3ab1336e)
2014-02-03 13:32:02 -05:00
Tim Abbott 30056197a6 Move report_as_received to compose.js.
(imported from commit 29a309aa0597f17d82277901bcf5d38c680c9b94)
2014-02-03 13:32:02 -05:00
Leo Franchi be115a2914 [localecho] Properly account for an empty message list and empty db
(imported from commit faac1644cb81bc53f43de8c6f830a0145c8c7ca5)
2014-02-03 13:15:42 -05:00
Leo Franchi bb21400732 [localecho] Properly escape HTML in code blocks
(imported from commit 11f7e4f440cdd3a2ef6debb10c3d5a07f4fd1a1a)
2014-02-03 12:57:54 -05:00
Leo Franchi c8f134370b Provide a valid local id when a fresh database with no messages is used
(imported from commit dafff9d4800a643693b57e92b7a02171c466333b)
2014-02-03 10:35:25 -05:00