Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chat: New option to completely disable chat #5500

Draft
wants to merge 38 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f812e53
API: Add missing `await`
rhansen Apr 8, 2022
7e2472c
Move `tar.json` into JavaScript
rhansen Dec 3, 2021
cae949a
lint: Fix indentation and formatting in `pad.html`
rhansen Dec 7, 2021
fec1bc0
css: Fix class name typo
rhansen Dec 3, 2021
9b7108d
PadMessageHandler: Delete unnecessary variables
rhansen Dec 7, 2021
5fe5a87
collab_client: Pass raw message to `handleClientMessage_*` hooks
rhansen Dec 6, 2021
595697b
plugins: Don't tell clients about server-side hooks
rhansen Apr 8, 2022
16f84ba
plugins: Move plugin logging to `plugins.update()`
rhansen Apr 9, 2022
8d062b2
tests: chat: Consolidate all frontend chat tests
rhansen Dec 4, 2021
33c46cb
tests: chat: Wait for message ack
rhansen Apr 7, 2022
5603e6b
tests: chat API: Promisify
rhansen Apr 7, 2022
3146d67
tests: chat API: Use `assert` library
rhansen Apr 7, 2022
cb02253
tests: chat API: Reorder assertions
rhansen Apr 7, 2022
92d70e5
tests: chat API: Delete unnecessary `describe()` calls
rhansen Apr 7, 2022
7b7b085
tests: chat API: Move test setup to `before()`
rhansen Apr 7, 2022
f7d7d89
chat: Move click handlers to `chat.js`
rhansen Dec 6, 2021
b830ed9
chat: Rename `hide` method to `reduce`
rhansen Dec 6, 2021
8ae5f25
chat: Make sure the icon is visible when minimizing
rhansen Dec 6, 2021
1cbba4e
chat: New `hide` method to completely hide chat
rhansen Dec 6, 2021
a1388b7
chat: Move chat-specific option processing to `chat.js`
rhansen Dec 5, 2021
59848ef
chat: Delete non-functional Alt-C shortcut handler
rhansen Dec 6, 2021
92cd1fe
chat: Fix blur and focus in Alt-C shortcut handler
rhansen Dec 6, 2021
870191f
chat: Move Alt-C handling to `chat.js`
rhansen Dec 6, 2021
8d3a6e5
chat: Move chat message handling to `chat.js`
rhansen Dec 6, 2021
a5c729a
chat: Move chat init to `chat.js`
rhansen Dec 6, 2021
e0f28cf
chat: Move cookie pref handling to chat init in `chat.js`
rhansen Dec 6, 2021
a177a62
chat: Move chat-specific pad HTML to `eejsBlock_*` hook functions
rhansen Dec 6, 2021
8d5fdd7
chat: Move chat message handling to `handleMessage` hook
rhansen Dec 7, 2021
2e68447
chat: Move `chatHead` client var to `clientVars` hook
rhansen Apr 8, 2022
2d3418c
chat: Deprecate the `chat` export from the client-side chat module
rhansen Apr 8, 2022
cdea600
chat: Move Pad chat methods to `chat.js`
rhansen Apr 8, 2022
42c22ce
chat: Move message checking to `padCheck` hook
rhansen Apr 8, 2022
01f1a8b
chat: Move `chatHead` initialization to `padLoad` hook
rhansen Apr 8, 2022
bd62104
chat: Move message copy to `padCopy` hook
rhansen Apr 8, 2022
b6bcc09
chat: Move message deletion to `padRemove` hook
rhansen Apr 8, 2022
bc06ef8
chat: Move HTTP API handlers to `chat.js`
rhansen Apr 8, 2022
310a371
chat: Move `.etherpad` import/export handling to `chat.js`
rhansen May 6, 2022
dda284c
chat: New option to completely disable chat
rhansen Dec 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Notable enhancements and fixes

* New `integratedChat` setting makes it possible to completely disable the
built-in chat feature (not just hide it).
* Improvements to login session management:
* `express_sid` cookies and `sessionstorage:*` database records are no longer
created unless `requireAuthentication` is `true` (or a plugin causes them to
Expand Down Expand Up @@ -55,6 +57,8 @@
* New APIs for processing attributes: `ep_etherpad-lite/static/js/attributes`
(low-level API) and `ep_etherpad-lite/static/js/AttributeMap` (high-level
API).
* The `handleClientMessage_${name}` client-side hooks are now passed the raw
message object in the new `msg` context property.
* The `import` server-side hook has a new `ImportError` context property.
* New `exportEtherpad` and `importEtherpad` server-side hooks.
* The `handleMessageSecurity` and `handleMessage` server-side hooks have a new
Expand Down Expand Up @@ -89,6 +93,18 @@
instead.
* `padUpdate`: The `author` context property is deprecated; use the new
`authorId` context property instead. Also, the hook now runs asynchronously.
* Chat API deprecations and removals (no replacements planned):
* Server-side:
* The `Pad.appendChatMessage()` method is deprecated.
* The `Pad.getChatMessage()` method is deprecated.
* The `Pad.getChatMessages()` method is deprecated.
* The `sendChatMessageToPadClients()` function in
`src/node/handler/PadMessageHandler.js` is deprecated.
* Client-side:
* The `chat` global variable is deprecated.
* The `chat` export in `src/static/js/chat.js` is deprecated.
* The `pad.determineChatVisibility()` method was removed.
* The `pad.determineChatAndUsersVisibility()` method was removed.
* Returning `true` from a `handleMessageSecurity` hook function is deprecated;
return `'permitOnce'` instead.
* Changes to the `src/static/js/Changeset.js` library:
Expand Down
13 changes: 7 additions & 6 deletions doc/api/hooks_client-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,10 @@ This hook is called after the content of a node is collected by the usual
methods. The cc object can be used to do a bunch of things that modify the
content of the pad. See, for example, the heading1 plugin for etherpad original.

## handleClientMessage_`name`
## `handleClientMessage_${name}`

Called from: `src/static/js/collab_client.js`

Things in context:

1. payload - the data that got sent with the message (use it for custom message
content)

This hook gets called every time the client receives a message of type `name`.
This can most notably be used with the new HTTP API call, "sendClientsMessage",
which sends a custom message type to all clients connected to a pad. You can
Expand All @@ -410,6 +405,12 @@ also use this to handle existing types.
`collab_client.js` has a pretty extensive list of message types, if you want to
take a look.

Context properties:

* `msg`: The raw message object.
* `payload`: The data that got sent with the message. Usually this is
`msg.payload`.

## aceStartLineAndCharForPoint-aceEndLineAndCharForPoint

Called from: src/static/js/ace2_inner.js
Expand Down
2 changes: 1 addition & 1 deletion doc/api/hooks_server-side.md
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ exports.userLeave = async (hookName, {author, padId}) => {

## `chatNewMessage`

Called from: `src/node/handler/PadMessageHandler.js`
Called from: `src/node/chat.js`

Called when a user (or plugin) generates a new chat message, just before it is
saved to the pad and relayed to all connected users.
Expand Down
19 changes: 10 additions & 9 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ The `settings.json.docker` available by default allows to control almost every s

### General

| Variable | Description | Default |
| ------------------ | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TITLE` | The name of the instance | `Etherpad` |
| `FAVICON` | favicon default name, or a fully specified URL to your own favicon | `favicon.ico` |
| `DEFAULT_PAD_TEXT` | The default text of a pad | `Welcome to Etherpad! This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents! Get involved with Etherpad at https://etherpad.org` |
| `IP` | IP which etherpad should bind at. Change to `::` for IPv6 | `0.0.0.0` |
| `PORT` | port which etherpad should bind at | `9001` |
| `ADMIN_PASSWORD` | the password for the `admin` user (leave unspecified if you do not want to create it) | |
| `USER_PASSWORD` | the password for the first user `user` (leave unspecified if you do not want to create it) | |
| Variable | Description | Default |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `TITLE` | The name of the instance | `Etherpad` |
| `FAVICON` | favicon default name, or a fully specified URL to your own favicon | `favicon.ico` |
| `DEFAULT_PAD_TEXT` | The default text of a pad | `Welcome to Etherpad! This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents! Get involved with Etherpad at https://etherpad.org` |
| `INTEGRATED_CHAT` | Whether to enable the built-in chat feature. Set this to false if you prefer to use a plugin to provide chat functionality or simply do not want the feature. | true |
| `IP` | IP which etherpad should bind at. Change to `::` for IPv6 | `0.0.0.0` |
| `PORT` | port which etherpad should bind at | `9001` |
| `ADMIN_PASSWORD` | the password for the `admin` user (leave unspecified if you do not want to create it) | |
| `USER_PASSWORD` | the password for the first user `user` (leave unspecified if you do not want to create it) | |


### Database
Expand Down
8 changes: 8 additions & 0 deletions settings.json.docker
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@
*/
"defaultPadText" : "${DEFAULT_PAD_TEXT:Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at https:\/\/etherpad.org\n}",

/*
* Whether to enable the built-in chat feature. Set this to false if you
* prefer to use a plugin to provide chat functionality or simply do not want
* the feature.
*/
"integratedChat": "${INTEGRATED_CHAT:true}",

/*
* Default Pad behavior.
*
Expand All @@ -231,6 +238,7 @@
"padOptions": {
"noColors": "${PAD_OPTIONS_NO_COLORS:false}",
"showControls": "${PAD_OPTIONS_SHOW_CONTROLS:true}",
// To completely disable chat, set integratedChat to false.
"showChat": "${PAD_OPTIONS_SHOW_CHAT:true}",
"showLineNumbers": "${PAD_OPTIONS_SHOW_LINE_NUMBERS:true}",
"useMonospaceFont": "${PAD_OPTIONS_USE_MONOSPACE_FONT:false}",
Expand Down
8 changes: 8 additions & 0 deletions settings.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@
*/
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at https:\/\/etherpad.org\n",

/*
* Whether to enable the built-in chat feature. Set this to false if you
* prefer to use a plugin to provide chat functionality or simply do not want
* the feature.
*/
"integratedChat": true,

/*
* Default Pad behavior.
*
Expand All @@ -232,6 +239,7 @@
"padOptions": {
"noColors": false,
"showControls": true,
// To completely disable chat, set integratedChat to false.
"showChat": true,
"showLineNumbers": true,
"useMonospaceFont": false,
Expand Down
27 changes: 27 additions & 0 deletions src/ep.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@
"shutdown": "ep_etherpad-lite/node/utils/Minify"
}
},
{
"name": "chat",
"client_hooks": {
"aceKeyEvent": "ep_etherpad-lite/static/js/chat",
"handleClientMessage_CHAT_MESSAGE": "ep_etherpad-lite/static/js/chat",
"handleClientMessage_CHAT_MESSAGES": "ep_etherpad-lite/static/js/chat",
"postAceInit": "ep_etherpad-lite/static/js/chat"
},
"hooks": {
"clientVars": "ep_etherpad-lite/node/chat",
"eejsBlock_mySettings": "ep_etherpad-lite/node/chat",
"eejsBlock_stickyContainer": "ep_etherpad-lite/node/chat",
"exportEtherpad": "ep_etherpad-lite/node/chat",
"handleMessage": "ep_etherpad-lite/node/chat",
"importEtherpad": "ep_etherpad-lite/node/chat",
"padCheck": "ep_etherpad-lite/node/chat",
"padCopy": "ep_etherpad-lite/node/chat",
"padLoad": "ep_etherpad-lite/node/chat",
"padRemove": "ep_etherpad-lite/node/chat"
}
},
{
"name": "chatAlwaysLoaded",
"hooks": {
"socketio": "ep_etherpad-lite/node/chat"
}
},
{
"name": "express",
"hooks": {
Expand Down
Loading