Commit graph

6860 commits

Author SHA1 Message Date
Richard Hansen
c625c611d2 tests: delete src/tests/frontend/specs/caret.js
All of the tests in this file are commented out so this file does
nothing. We can uncomment the code and clean it up, but the approach
taken in these tests will never work: For security reasons, browsers
do not allow synthetic key events to perform the default
behavior (such as moving the carent when an arrow key is pressed).

There are two ways to test responses to navigation keys:
  * Use WebDriver to create "genuine" keyboard events.
  * Suppress the default behavior and implement caret movement
    ourselves. This is tremendously complicated, especially arrow
    up/down.
2021-02-07 07:02:23 +00:00
John McLear
1f0cb01110 tests: fix enter test 2021-02-07 07:00:12 +00:00
John McLear
f8a19c4527
lint: lint and various fixes of frontend test specs 2021-02-07 06:39:03 +00:00
Richard Hansen
da10d42183 Delete top-level package.json
Advantages of a top-level `package.json`:
  * It prevents npm from printing benign warnings about missing
    `package.json` whenever a plugin is installed.
  * Semantically, it is "the right thing to do" if plugins are to be
    installed in the top-level directory. This avoids violating
    assumptions various tools make about `package.json`, which makes
    it more likely that we can easily switch to a new version of npm
    or to an npm alternative.

Disadvantages of a top-level `package.json`:
  * Including a dependency of `ep_etherpad-lite@file:src` in the
    top-level `package.json`, which is required to keep npm from
    deleting the `node_modules/ep_etherpad-lite` symlink each time a
    package is installed, drastically slows down plugin installation
    because npm recursively walks the ep_etherpad-lite dependencies.
  * npm has a horrible dependency hoisting behavior: It moves
    dependencies from `src/node_modules/` to the top-level
    `node_modules/` directory when possible. This causes numerous
    mysterious problems, such as silent failures in `npm outdated` and
    `npm update`, and it breaks plugins that do
    `require('ep_etherpad-lite/node_modules/foo')`.

Right now, with npm v6.x, eliminating the disadvantages is far more
valuable than keeping the advantages. (This might change with npm
v7.x.)

For a long time there was no top-level `package.json` and it worked
fairly well, although users were often confused by npm's benign
warnings. The top-level `package.json` was added because we needed a
place to put ESLint config for the stuff in `bin/` and `tests/`, and
we wanted the advantages listed above. Unfortunately we were unaware
of the disadvantages at the time. The `bin/` and `tests/` directories
were moved under `src/` so we no longer need the top-level
`package.json` for ESLint.

An alternative to a top-level `package.json`: Create
`plugins/package.json` and install all plugins in `plugins/`. If
`plugins/package.json` has a dependency of
`ep_etherpad-lite@file:../src` then plugin installation will still be
slow (npm will still recursively walk the dependencies in
`src/package.json`) but it should avoid npm's nasty dependency
hoisting behavior. To avoid slow plugin installation we could create a
lightweight `etherpad-pluginlib` package that Etherpad plugins would
use to indirectly access Etherpad's internals. As an added bonus, this
intermediate package could become an adaptor that provides a stable
interface to plugins even when Etherpad core rapidly evolves.
2021-02-07 06:24:52 +00:00
John McLear
e02246641e
ordered lists bugfix: first line item can be 0.*, don't show 0 as undefined (#4600) 2021-02-06 20:19:05 +00:00
John McLear
4862d6fa9c
editor: fix enter key keep line in view (#4639) 2021-02-06 19:56:59 +00:00
John McLear
c969ae58c2
stats: activePads & lastDisconnected stats 2021-02-06 19:53:52 +00:00
John McLear
5f58ce14d6
editor: remove grayed logic and styles so background color is not lost on disconnect/reconnect. 2021-02-06 09:58:10 +00:00
Richard Hansen
8b28e00784 restructure: Prefix bin/ and tests/ with src/
This is a follow-up to commit
2ea8ea1275.
2021-02-05 21:52:08 +00:00
John McLear
2ea8ea1275 restructure: move bin/ and tests/ to src/
Also add symlinks from the old `bin/` and `tests/` locations to avoid
breaking scripts and other tools.

Motivations:

  * Scripts and tests no longer have to do dubious things like:

        require('ep_etherpad-lite/node_modules/foo')

    to access packages installed as dependencies in
    `src/package.json`.

  * Plugins can access the backend test helper library in a non-hacky
    way:

        require('ep_etherpad-lite/tests/backend/common')

  * We can delete the top-level `package.json` without breaking our
    ability to lint the files in `bin/` and `tests/`.

    Deleting the top-level `package.json` has downsides: It will cause
    `npm` to print warnings whenever plugins are installed, npm will
    no longer be able to enforce a plugin's peer dependency on
    ep_etherpad-lite, and npm will keep deleting the
    `node_modules/ep_etherpad-lite` symlink that points to `../src`.

    But there are significant upsides to deleting the top-level
    `package.json`: It will drastically speed up plugin installation
    because `npm` doesn't have to recursively walk the dependencies in
    `src/package.json`. Also, deleting the top-level `package.json`
    avoids npm's horrible dependency hoisting behavior (where it moves
    stuff from `src/node_modules/` to the top-level `node_modules/`
    directory). Dependency hoisting causes numerous mysterious
    problems such as silent failures in `npm outdated` and `npm
    update`. Dependency hoisting also breaks plugins that do:

        require('ep_etherpad-lite/node_modules/foo')
2021-02-04 17:15:08 -05:00
John McLear
efde0b787a
npm-load-remove: checkPad.js example (#4711)
* npm-load-remove: checkPad.js example

* npm-load-remove: checkPad.js example

* npm-load-remove: checkPad.js example

* npm-load-remove: checkPad.js example

* npm-load-remove: checkPad.js example

* npm-load-remove: checkPad.js example

* npm-load-remove: checkPadDeltas

* npm-load-remove: extractPadData

* npm-load-remove: importSqlFile

* npm-load-remove: rebuildPad

* npm-load-remove: repairPad

* npm-load-remove: checkAllPads

* npm-load-remove: migrateDirtyDBtoRealDB

* npm-load-remove: migrateDirtyDBtoRealDB path

* npm-load-remove: migrateDirtyDBtoRealDB dbclose fix

* npm-load-remove: migrateDirtyDBtoRealDB remove commented out line

* npm-load-remove: migrateDirtyDBtoRealDB reintroduce util
2021-02-04 20:53:30 +00:00
Richard Hansen
5a865dfc7e pluginfw: Delete unused return value 2021-02-04 08:41:00 +00:00
Richard Hansen
a145b97682 pluginfw: Use for loops to improve readability 2021-02-04 08:41:00 +00:00
Richard Hansen
fdaacc44c8 pluginfw: Replace slide.asyncMap() with Promise.all() 2021-02-04 08:41:00 +00:00
Richard Hansen
746cc8cc34 pluginfw: In-line formatPluginsWithVersion()
There's only one caller of the function, so move the logic to where it
is used.
2021-02-04 08:41:00 +00:00
Richard Hansen
cd1d322af4 /admin/plugins/info: Move logic to .js file 2021-02-04 08:41:00 +00:00
Richard Hansen
c5f0274116 lint: Move functions up to fix more lint errors 2021-02-04 08:41:00 +00:00
Richard Hansen
99ca57f3ab lint: src/static/js/pluginfw/shared.js 2021-02-04 08:41:00 +00:00
Richard Hansen
2c80c1f2da lint: src/static/js/pluginfw/read-installed.js 2021-02-04 08:41:00 +00:00
Richard Hansen
2b32bc1840 lint: src/static/js/pluginfw/plugins.js 2021-02-04 08:41:00 +00:00
Richard Hansen
9a86ebec2a pluginfw: Fix state reset logic 2021-02-04 08:41:00 +00:00
Richard Hansen
895764e047 pluginfw: Return from findUnmet() early if not given an object
For some reason strings are sometimes passed to `findUnmet()`, which
is obviously unexpected given the way the code is written. Rather than
figure out why strings are passed and how to safely avoid passing
strings, just return early. The net effect is the same, but returning
early avoids setting a property on a string, which is prohibited in
strict mode.
2021-02-04 08:41:00 +00:00
Richard Hansen
a06662fd00 pluginfw: Delete commented-out code 2021-02-04 08:41:00 +00:00
Richard Hansen
c64ee6ff4c pluginfw: Call npm.load() before using npm
This code is only used when testing `read-installed.js` by running it
directly (e.g., `node src/static/js/pluginfw/read-installed.js`).
2021-02-04 08:41:00 +00:00
translatewiki.net
a5bde7982a Localisation updates from https://translatewiki.net. 2021-02-04 08:58:26 +01:00
John McLear
1076783985
tests: backend test coverage for #3227 where a group cannot be deleted if it has pads. 2021-02-03 10:39:30 +00:00
freddii
ea202e41f6 docs: fixed typos 2021-02-03 00:30:07 +01:00
John McLear
65dec5bd2c lint: json.js 2021-02-02 15:24:12 -05:00
Richard Hansen
05e0e8dbf7 hooks: New callAllSerial() function
This is necessary to migrate away from `callAll()` (which only
supports synchronous hook functions).
2021-02-02 09:09:02 +00:00
Richard Hansen
763fe6fc26 hooks: Document callFirst() and aCallFirst() 2021-02-02 09:09:02 +00:00
Richard Hansen
ba0544ea9e hooks: Add unit tests for callFirst(), aCallFirst() 2021-02-02 09:09:02 +00:00
Richard Hansen
6f30ea7c38 hooks: Use callHookFn{Sync,Async}() for {call,aCall}First()
Benefits of `callHookFnSync()` and `callHookFnAsync()`:
  * They are a lot more forgiving than `hookCallWrapper()` was.
  * They perform useful sanity checks.
  * They have extensive unit test coverage.
  * They make the behavior of `callFirst()` and `aCallFirst()` match
    the behavior of `callAll()` and `aCallAll()`.
2021-02-02 09:09:02 +00:00
Richard Hansen
c11d60c5f6 hooks: Check context nullness, not truthiness 2021-02-02 09:09:02 +00:00
Richard Hansen
fd5d3ce777 hooks: Inline aCallFirst() into exports.aCallFirst() 2021-02-02 09:09:02 +00:00
Richard Hansen
77f480d954 hooks: Asyncify aCallFirst 2021-02-02 09:09:02 +00:00
Richard Hansen
22d02dbcbf hooks: Factor out value normalization 2021-02-02 09:09:02 +00:00
Richard Hansen
f316a3bacd hooks: Never pass a falsy error to a callback 2021-02-02 09:09:02 +00:00
Richard Hansen
708206449a hooks: Factor out callback attachment
The separate function will be reused in a future commit.
2021-02-02 09:09:02 +00:00
Richard Hansen
13e806ad7a hooks: Inline mapFirst() into aCallFirst() for readability
There's only one caller of the function, and the function is simple,
so there's no need for a separate function.
2021-02-02 09:09:02 +00:00
Richard Hansen
4ab7a99512 hooks: Inline syncMapFirst() into callFirst() for readability
There's only one caller of the function, and the function is simple,
so there's no need for a separate function.
2021-02-02 09:09:02 +00:00
Richard Hansen
53ccfa8703 hooks: Asyncify mapFirst 2021-02-02 09:09:02 +00:00
Richard Hansen
0b83ff8ec2 hooks: Simplify syncMapFirst iteration 2021-02-02 09:09:02 +00:00
Richard Hansen
c89db33ff0 hooks: Refine caveat comments about function parameter count 2021-02-02 09:09:02 +00:00
Richard Hansen
f02f288e80 hooks: Rename args to context for consistency 2021-02-02 09:09:02 +00:00
Richard Hansen
7dba847f21 hooks: Don't export syncMapFirst or mapFirst
Nobody uses these functions outside of this file.
2021-02-02 09:09:02 +00:00
Richard Hansen
6b42dabf6c hooks: Delete unused bubbleExceptions setting 2021-02-02 09:09:02 +00:00
Richard Hansen
ba02e70020 tests: Make the fake webaccess hook registrations look more real
The additional properties will be needed once `aCallAll()` is upgraded
to use `callHookFnAsync()`.
2021-02-02 09:09:02 +00:00
Richard Hansen
47f0a7dacf lint: Fix more ESLint errors 2021-02-02 09:09:02 +00:00
Richard Hansen
1bc52f4913 hooks: Remove unnecessary callAllStr() function 2021-02-02 09:09:02 +00:00
John McLear
3e910b9905 stale: remove convert.js as no one runs old Etherpad 2021-02-01 22:45:51 +00:00