Commit Graph

20 Commits

Author SHA1 Message Date
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Anders Kaseorg 190524b6a0 alert_words.js: Add setter for words.
After migration to an ES6 module, `words` would no longer be mutable
from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Tim Abbott 838dd6d273 lint: Add eslint enforcement for comma-spacing.
We've been enforcing this manually for a long time, and hadn't
realized it was missing from our eslint configuration.
2018-12-07 12:22:24 -08:00
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
Steve Howell 52299ce987 Highlight alert words in mentions you send to yourself.
Fixes #6946.
2017-10-12 14:03:36 -07:00
Harshit Bansal a13535ff1f alert_words: Don't muck up rendered HTML content while munging.
Prior to this we were also performing highlighting inside HTML tags
which was wrong and causing weird behavior. Like, for example, if
someone added `emoji` as an alert word then any message containing
both emoji and alert word was rendered with a jumbo emoji.

Fixes: #4357.
2017-07-31 21:20:21 -07:00
Harshit Bansal d5ab8ac1e1 alert_words: Remove the `page_params.alert_words` after initialization.
We remove the `page_params.alert_words` since `alert_words.words`
is the sole source of alert words. Use of `page_params.alert_words`
could lead to bugs when alert words are updated since it is not updated.
2017-06-13 16:36:11 -07:00
Steve Howell 73125e2718 refactor: Move is_current_user() to people.js.
We no longer have it in util.js, because we will
want to encapsulate this better for upcoming commits
related to email changes.
2017-01-21 21:45:12 -08:00
Rafid Aslam 0290aeb6ab lint: Fix several no-unused-vars eslint rule violations.
These changes were extracted by tabbott from the original commit
to merge now because they have been reviewed as safe.
2016-12-03 18:43:47 -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
Tim Abbott b25562ca1d Add and use util.is_current_user helper function.
Previously, we were checking if a particular user was the current user
in dozens of places in the codebase, and correct case-insensitive
checks were not used consistently, leading to bugs like #502.
2016-06-07 21:58:44 -07:00
Leo Franchi 9d8758557b Use global match in alert word regex to match all matches
(imported from commit aaec296ad6b18b20c1c2d1cb017cffef8e3e0512)
2014-03-11 13:06:16 -04:00
Leo Franchi 65b6c80f07 Don't highlight alert words that are in URLs, breaking them
(imported from commit e20ee33a1687f935482f48f829c19a1606ce6db1)
2014-03-11 13:06:16 -04:00
Luke Faraone 4ebc4a4ef1 Expand characters allowed after an alertword.
We now support .';[ before a word and ';]! after.

Closes trac #2283.

(imported from commit b3e3cb3d8d49a8e74d0b6a108c5ec73e9d9b5f32)
2014-02-13 17:14:53 -05:00
Steve Howell 175aeef09a Simplify code by using message.alerted.
(imported from commit 10eaca36cd3d60ce3cdd36be62dff02217f0b6c6)
2014-01-10 21:39:02 -05:00
Steve Howell b98e7f8d90 Remove transitional feature_flags.alert_words flag.
(imported from commit f00eba8a12054e9771105e341e2652a53271e298)
2013-10-15 09:57:19 -04:00
Leo Franchi 6e188fb067 Tweak alert_word matches and add some more tests
(imported from commit 63dc4064c15d5d33a7ec0c992b183bf323dd4ee8)
2013-10-10 10:58:21 -04:00
Leo Franchi 663fd4653f Feature-flag alert words to staging + reddit
(imported from commit 1fe9c596b26ce6676514719e4ed2e185108685cb)
2013-09-05 10:21:39 -04:00
Leo Franchi 897dd87b94 Add a span around alert words to mark them visually
(imported from commit 9b8fbbd957086f1eeaa3409e5830aa6d7974fbe8)
2013-09-05 10:18:40 -04:00