Commit Graph

149 Commits

Author SHA1 Message Date
Anders Kaseorg cfacf68fb8 js: Convert static/js/filter.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Abhijeet Prasad Bodas 9ae44c769c refactor: Rename MessageList.muting_enabled.
Previously, the `muting_enabled` property of
MessageListData class was used to indicate whether
some messages in the message list need to be
filtered due to topic muting, depending on the
narrow. For example, we exclude messages belonging
to muted topics from stream narrows, but not from
search narrows.

The name `muting_enabled` is a bit confusing, and hence is
changed to `excludes_muted_topics`.
It is also important that the name be specific, since
a similar new property will be added for user mutes
in future commits.
2021-02-10 07:53:05 -05:00
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg f3726db89a js: Normalize strings to double quotes.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:24 -07:00
Anders Kaseorg 28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00
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
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 a3d3d08a80 refactor: Avoid positional params for MessageList.
We used to have positional parameters for table_name
and filter, but we don't use them for message_list.all
and we're about to replace filter in some cases.

Passing everything in on opts is more consistent and
self-documenting in the calling code, plus lots of
unit tests can get away with passing in `{}` now
for situations where table_name does not matter.

All of our callers pass in muting_enabled, so we
remove the default value for it.  And then the
collapse_messages variable doesn't have to live on
`this` as it's only being passed through down to the
view.
2018-05-15 14:25:21 -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
Brock Whittaker e0236646bf night-mode: Add custom CSS through JS.
This adds custom CSS through JavaScript for things that do not
scope well and will override other inherited styles.

This should ONLY be used for problematic CSS that has no obvious
or easy CSS-only solution.

(Specifically, we need this for the "default link" styling, which is
hard to override because we don't want to start winning ties due to
specificity that we would not have won in the light theme).
2017-11-29 23:06:11 -08:00
Brock Whittaker f9f0f356be settings: Add backend storage and interface for night mode.
This allows the night mode setting to be stored in the backend.
2017-11-15 16:36:06 -08:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
Tim Abbott ee361cbe30 js: Eliminate process_loaded_for_unread global. 2016-11-05 11:33:04 -07:00
Tim Abbott d60ec24c1f js: Move set_user_statuses to activity.js initialization. 2016-11-05 11:33:04 -07:00
Tim Abbott 6daf2b1e46 js: Move pointer initialization code out of zulip.js. 2016-11-05 11:33:04 -07:00
Tim Abbott d76f9b09a3 unread: Move consider_bankruptcy into unread module. 2016-11-05 11:33:04 -07:00
Tim Abbott 9f41fc0882 zulip.js: Remove unused javascript variables. 2016-09-12 22:40:11 -07:00
Vishnu Ks e4b72c3a65 Move respond_to_message to compose.js. 2016-06-29 13:04:02 -07:00
Tim Abbott ec8b8cc5c0 Add warning at top of zulip.js about adding new things. 2016-06-10 10:22:24 -07:00
Vishnu Ks d30ea0bc44 Move recent_subjects to stream_data. 2016-06-07 17:50:16 -07:00
Vishnu Ks 51c86a8e2e Move get_private_message_recipient to message_store.js 2016-05-27 01:03:21 -07:00
Vishnu Ks 89d743787e Move recenter_view to viewport.js. 2016-05-27 01:03:21 -07:00
Vishnu Ks 4be20c4b4a Move scroll_to_selected to navigate.js. 2016-05-27 01:03:21 -07:00
Vishnu Ks e329c9e0f5 Move maybe_scroll_to_selected to navigate.js. 2016-05-27 01:03:21 -07:00
Vishnu Ks dc577343fe Move last_viewport_movement_direction to viewport. 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
Vishnu Ks ee39f5009f Make message_list.js work like the other modules. 2016-04-20 15:29:30 -07:00
Vishnu Ks 3179434f93 Move keep_pointer_in_view to pointer.js. 2016-04-19 15:23:45 -07:00
Vishnu Ks 35f70e9dac Move 5 legacy global variables to pointer.js.
Move recenter_pointer_on_display, suppress_scroll_pointer_update,
fast_forward_pointer, furthest_read, and server_furthest_read to
a new pointer module in pointer.js.
2016-04-12 10:56:54 -07:00
Ashish 6356584f84 Replace /json/update_pointer with REST style route. 2016-04-11 21:38:23 -07:00
Ashish b8ec8f5ef0 Replace /json/get_profile with REST style route. 2016-04-11 21:38:23 -07:00
Vishnu Ks 2ac5271091 Move global variable have_scrolled_away_from_top to ui.js. 2016-04-10 10:55:16 -07:00
Aristeidis Fkiaras 0058ccbdb0 Move global unread_messages_read_in_narrow to unread.js. 2016-04-08 12:11:47 -07:00
Tim Abbott 12bff0441c Save compose state when reloading due to 'declare bankruptcy'. 2015-11-30 08:49:37 -08:00
Dylan Dumesnil 24b63f30ba Refactor reload.js to allow saving only some state when reloading.
The reload state is now divided into 3 different components:
  pointer, narrow, compose
2015-11-30 08:47:36 -08:00
Steve Howell be2a1c2893 Move resizing code to resize.js.
(imported from commit b6df0007307872751e1a4200af740076e08b5c11)
2014-03-14 20:48:55 -04:00
Leo Franchi 748e5b6da6 Remove disabled summarization code
This experiment has been disabled for everyone for a while: if we
bring something like this back, it is not likely to be exactly the same,
and will be different enough to require a different implementation.

As it is, the summarization code was making a few code paths (rendering
especially) more complex, and is worth removing for simplicity's sake.

(imported from commit 6ac8cdc9f7077a5a1da01ab4268aba3db0bc43f8)
2014-02-27 20:25:23 -05:00
Steve Howell 10b24f77b6 Fix misc. uses of search tuples.
(imported from commit c7dc47c1396eb0d9f6821cafcb3dc90d283b4764)
2014-02-10 15:11:43 -05:00
Tim Abbott 7e6bb801e2 Move message_range to a function on the message list.
(imported from commit c78710a3ccddb15352086b450fb6986e1251f364)
2014-02-03 13:32:02 -05:00
Tim Abbott 4b30afbb27 Fix display of unread counts.
I apparently screwed up when backing up the process_loaded_for_unread
move in a way that just lost the function.

(imported from commit 91dfcf1abc85d439274cb8b0be380e9230942ebb)
2014-01-31 17:53:11 -05:00
Tim Abbott 88fbd5d16a Split out new module message_store.js.
(imported from commit 57cf3f2b8e74d7c56e3baf75859d5b3646282225)
2014-01-31 15:57:28 -05:00
Tim Abbott f5d3a6ddc7 Move suppress_unread_counts to unread.js.
(imported from commit fb64edc27b661d036c9f24715aeb3b4dbdf9463a)
2014-01-31 15:57:28 -05:00
Tim Abbott 004fd0eab8 Move unread-related functions from zulip.js to unread.js.
(imported from commit efc0dd84c2cd30b0203b906af6991475d8a63985)
2014-01-31 14:59:03 -05:00
Tim Abbott c8d57fcafb Split out message_flags.js.
(imported from commit 52afa76fa71141630e325e558cb9c6955d8c03d5)
2014-01-31 14:59:03 -05:00
Tim Abbott 55a88f049c Remove unused within_viewport.
(imported from commit d528e022a0d088052bb0bac5c29864688dae59ca)
2014-01-31 14:59:03 -05:00
Tim Abbott 6e5e5596fd Remove deferred installation of scroll handler.
This is no longer required, now that we're no longer scrolling the
main body of the page.

(imported from commit c2aa0d403c8fd0679b3110fe8e7684d46a7557fa)
2014-01-31 11:15:14 -05:00
Leo Franchi 1056078415 Truncate local ids when loading older messages if messages could be local only
(imported from commit b32ae8f3554632aa84ed2dd039a612bb0fa644e2)
2014-01-30 18:08:48 -05:00
Tim Abbott e505583f52 Split out new module people.js for tracking people.
(imported from commit fb9b769819ade25d1d3d6e452e68c7ee8651cfdd)
2014-01-30 17:32:58 -05:00
Tim Abbott d0ae8795c3 Clean up obsolete fields in get_events_params.
Both pointer and last are fields that were removed when we changed the
protocol to use events like a year ago.

This conveniently allows us to stop exporting get_updates_params to
other modules.

(imported from commit 13651ee240ce6e1bafb241b185e5ef653c348cdf)
2014-01-30 17:23:53 -05:00