Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ plugin_packages
playwright-report
state.json
/src/static/oidc
.claude/
1 change: 1 addition & 0 deletions settings.json.docker
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
*/
"padOptions": {
"noColors": "${PAD_OPTIONS_NO_COLORS:false}",
"showAuthorColors": "${PAD_OPTIONS_SHOW_AUTHOR_COLORS:true}",
"showControls": "${PAD_OPTIONS_SHOW_CONTROLS:true}",
"showChat": "${PAD_OPTIONS_SHOW_CHAT:true}",
"showLineNumbers": "${PAD_OPTIONS_SHOW_LINE_NUMBERS:true}",
Expand Down
1 change: 1 addition & 0 deletions settings.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
*/
"padOptions": {
"noColors": false,
"showAuthorColors": true,
"showControls": true,
"showChat": true,
"showLineNumbers": true,
Expand Down
2 changes: 2 additions & 0 deletions src/node/utils/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export type SettingsType = {
defaultPadText: string,
padOptions: {
noColors: boolean,
showAuthorColors: boolean,
showControls: boolean,
showChat: boolean,
showLineNumbers: boolean,
Expand Down Expand Up @@ -398,6 +399,7 @@ const settings: SettingsType = {
*/
padOptions: {
noColors: false,
showAuthorColors: true,
showControls: true,
showChat: true,
showLineNumbers: true,
Expand Down
20 changes: 19 additions & 1 deletion src/static/js/pad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ const getParameters = [
$('#clearAuthorship').hide();
},
},
{
name: 'showAuthorColors',
checkVal: 'false',
callback: (val) => {
settings.showAuthorColorsDisabled = true;
},
},
{
name: 'showControls',
checkVal: 'true',
Expand Down Expand Up @@ -461,7 +468,10 @@ const pad = {
chat.chatAndUsers(true); // stick it to the screen
$('#options-chatandusers').prop('checked', true); // set the checkbox to on
}
if (padcookie.getPref('showAuthorshipColors') === false) {
const authorColorsPref = padcookie.getPref('showAuthorshipColors');
if (authorColorsPref === true) {
pad.changeViewOption('showAuthorColors', true);
} else if (authorColorsPref === false) {
pad.changeViewOption('showAuthorColors', false);
}
if (padcookie.getPref('showLineNumbers') === false) {
Expand Down Expand Up @@ -555,6 +565,13 @@ const pad = {
this.changeViewOption('noColors', true);
}

// If showAuthorColors is set to false in padOptions, default colors off.
// The user can still toggle them on via the checkbox; the cookie will
// override this default on subsequent visits.
if (settings.showAuthorColorsDisabled === true) {
this.changeViewOption('showAuthorColors', false);
}

// RTL override is applied in postAceInit (after padeditor.init resolves)
// to avoid a race where setViewOptions(initialViewOptions) overwrites it.

Expand Down Expand Up @@ -783,6 +800,7 @@ const init = () => pad.init();
const settings = {
LineNumbersDisabled: false,
noColors: false,
showAuthorColorsDisabled: false,
useMonospaceFontGlobal: false,
globalUserName: false,
globalUserColor: false,
Expand Down
9 changes: 4 additions & 5 deletions src/static/js/pad_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,15 @@ const padeditor = (() => {
padutils.setCheckbox($('#options-linenoscheck'), v);

v = getOption('showAuthorColors', true);
// noColors overrides showAuthorColors completely
if (settings.noColors) {
v = false;
}
self.ace.setProperty('showsauthorcolors', v);
$('#chattext').toggleClass('authorColors', v);
$('iframe[name="ace_outer"]').contents().find('#sidedivinner').toggleClass('authorColors', v);
padutils.setCheckbox($('#options-colorscheck'), v);

// Override from parameters if true
if (settings.noColors !== false) {
self.ace.setProperty('showsauthorcolors', !settings.noColors);
}

self.ace.setProperty('textface', newOptions.padFontFamily || '');
},
dispose: () => {
Expand Down
1 change: 1 addition & 0 deletions src/static/js/types/SocketIOMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export type PadOptionsMessage = {

export type PadOption = {
"noColors"?: boolean,
"showAuthorColors"?: boolean,
"showControls"?: boolean,
"showChat"?: boolean,
"showLineNumbers"?: boolean,
Expand Down
41 changes: 41 additions & 0 deletions src/tests/frontend-new/specs/show_author_colors.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {expect, test} from "@playwright/test";
import {
appendQueryParams,
clearPadContent,
getPadBody,
goToNewPad,
writeToPad,
} from "../helper/padHelper";

test.describe('showAuthorColors pad option', () => {
test('authorship colors checkbox is checked by default', async ({page}) => {
await goToNewPad(page);
const checkbox = page.locator('#options-colorscheck');
await expect(checkbox).toBeChecked();
});

test('noColors query param unchecks the authorship colors checkbox', async ({page}) => {
const padId = await goToNewPad(page);
await appendQueryParams(page, {noColors: 'true'});
const checkbox = page.locator('#options-colorscheck');
await expect(checkbox).not.toBeChecked();
});

test('toggling authorship colors checkbox works', async ({page}) => {
await goToNewPad(page);
const padBody = await getPadBody(page);

await clearPadContent(page);
await writeToPad(page, 'Hello colors');
await expect(padBody.locator('div span').first()).toHaveAttribute('class', /author-/);

// Uncheck colors
const checkbox = page.locator('#options-colorscheck');
await checkbox.click();

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Chrome

[chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 173 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Chrome

[chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 173 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Chrome

[chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 173 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Firefox

[firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 170 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Firefox

[firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 170 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Firefox

[firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 171 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms - waiting for element to be visible, enabled and stable 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Firefox

[firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 170 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Firefox

[firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 170 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Firefox

[firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [firefox] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 171 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Chrome

[chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 173 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Chrome

[chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 173 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20

Check failure on line 34 in src/tests/frontend-new/specs/show_author_colors.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright Chrome

[chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works

1) [chromium] › tests/frontend-new/specs/show_author_colors.spec.ts:24:7 › showAuthorColors pad option › toggling authorship colors checkbox works Error: locator.click: Test timeout of 90000ms exceeded. Call log: - waiting for locator('#options-colorscheck') - locator resolved to <input type="checkbox" id="options-colorscheck"/> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 173 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms 32 | // Uncheck colors 33 | const checkbox = page.locator('#options-colorscheck'); > 34 | await checkbox.click(); | ^ 35 | await expect(checkbox).not.toBeChecked(); 36 | 37 | // Re-check colors at /home/runner/work/etherpad-lite/etherpad-lite/src/tests/frontend-new/specs/show_author_colors.spec.ts:34:20
await expect(checkbox).not.toBeChecked();

// Re-check colors
await checkbox.click();
await expect(checkbox).toBeChecked();
});
});
Loading