Skip to content

Commit

Permalink
Merge pull request mastodon#2653 from ClearlyClaire/glitch-soc/merge-…
Browse files Browse the repository at this point in the history
…upstream

Merge upstream changes up to 7f84bbf
  • Loading branch information
ClearlyClaire authored Feb 28, 2024
2 parents c19787f + 4004801 commit 0d55610
Show file tree
Hide file tree
Showing 43 changed files with 298 additions and 510 deletions.
18 changes: 9 additions & 9 deletions .devcontainer/codespaces/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

"features": {
"ghcr.io/devcontainers/features/sshd:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},

"runServices": ["app", "db", "redis"],
Expand All @@ -15,16 +15,16 @@
"portsAttributes": {
"3000": {
"label": "web",
"onAutoForward": "notify",
"onAutoForward": "notify"
},
"4000": {
"label": "stream",
"onAutoForward": "silent",
},
"onAutoForward": "silent"
}
},

"otherPortsAttributes": {
"onAutoForward": "silent",
"onAutoForward": "silent"
},

"remoteEnv": {
Expand All @@ -33,7 +33,7 @@
"STREAMING_API_BASE_URL": "https://${localEnv:CODESPACE_NAME}-4000.app.github.dev",
"DISABLE_FORGERY_REQUEST_PROTECTION": "true",
"ES_ENABLED": "",
"LIBRE_TRANSLATE_ENDPOINT": "",
"LIBRE_TRANSLATE_ENDPOINT": ""
},

"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
Expand All @@ -43,7 +43,7 @@
"customizations": {
"vscode": {
"settings": {},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"],
},
},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"]
}
}
}
16 changes: 8 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

"features": {
"ghcr.io/devcontainers/features/sshd:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},

"forwardPorts": [3000, 4000],
Expand All @@ -14,17 +14,17 @@
"3000": {
"label": "web",
"onAutoForward": "notify",
"requireLocalPort": true,
"requireLocalPort": true
},
"4000": {
"label": "stream",
"onAutoForward": "silent",
"requireLocalPort": true,
},
"requireLocalPort": true
}
},

"otherPortsAttributes": {
"onAutoForward": "silent",
"onAutoForward": "silent"
},

"onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
Expand All @@ -34,7 +34,7 @@
"customizations": {
"vscode": {
"settings": {},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"],
},
},
"extensions": ["EditorConfig.EditorConfig", "webben.browserslist"]
}
}
}
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ module.exports = defineConfig({
'plugin:import/typescript',
'plugin:promise/recommended',
'plugin:jsdoc/recommended-typescript',
'plugin:prettier/recommended',
],

parserOptions: {
Expand All @@ -364,6 +363,9 @@ module.exports = defineConfig({
},

rules: {
// Disable formatting rules that have been enabled in the base config
'indent': 'off',

'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],

'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check formatting
on:
push:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Javascript environment
uses: ./.github/actions/setup-javascript

- name: Check formatting with Prettier
run: yarn format:check
2 changes: 1 addition & 1 deletion .github/workflows/lint-css.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
- run: echo "::add-matcher::.github/stylelint-matcher.json"

- name: Stylelint
run: yarn lint:sass
run: yarn lint:css
38 changes: 0 additions & 38 deletions .github/workflows/lint-json.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/lint-md.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/lint-yml.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
# Ignore Docker option files
docker-compose.override.yml

# Ignore public
/public/assets
/public/emoji
/public/packs
/public/packs-test
/public/system

# Ignore emoji map file
/app/javascript/mastodon/features/emoji/emoji_map.json

Expand All @@ -74,6 +81,7 @@ app/javascript/styles/mastodon/reset.scss
# Ignore the generated AUTHORS.md
AUTHORS.md

# Process a few selected JS files
!lint-staged.config.js

# Ignore glitch-soc emoji map file
Expand Down
22 changes: 13 additions & 9 deletions app/javascript/core/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const hideSelectAll = () => {
Rails.delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
const selectAllMatchingElement = document.querySelector('.batch-table__select-all');

[].forEach.call(document.querySelectorAll(batchCheckboxClassName), (content) => {
document.querySelectorAll(batchCheckboxClassName).forEach((content) => {
content.checked = target.checked;
});

Expand Down Expand Up @@ -80,8 +80,11 @@ Rails.delegate(document, batchCheckboxClassName, 'change', () => {
const selectAllMatchingElement = document.querySelector('.batch-table__select-all');

if (checkAllElement) {
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
const allCheckboxes = Array.from(
document.querySelectorAll(batchCheckboxClassName)
);
checkAllElement.checked = allCheckboxes.every((content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && allCheckboxes.some((content) => content.checked);

if (selectAllMatchingElement) {
if (checkAllElement.checked) {
Expand Down Expand Up @@ -132,11 +135,11 @@ Rails.delegate(document, '#form_admin_settings_enable_bootstrap_timeline_account
const onChangeRegistrationMode = (target) => {
const enabled = target.value === 'approved';

[].forEach.call(document.querySelectorAll('.form_admin_settings_registrations_mode .warning-hint'), (warning_hint) => {
document.querySelectorAll('.form_admin_settings_registrations_mode .warning-hint').forEach((warning_hint) => {
warning_hint.style.display = target.value === 'open' ? 'inline' : 'none';
});

[].forEach.call(document.querySelectorAll('#form_admin_settings_require_invite_text'), (input) => {
document.querySelectorAll('#form_admin_settings_require_invite_text').forEach((input) => {
input.disabled = !enabled;
if (enabled) {
let element = input;
Expand Down Expand Up @@ -182,8 +185,9 @@ ready(() => {

const checkAllElement = document.querySelector('#batch_checkbox_all');
if (checkAllElement) {
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
const allCheckboxes = Array.from(document.querySelectorAll(batchCheckboxClassName));
checkAllElement.checked = allCheckboxes.every( (content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && allCheckboxes.some((content) => content.checked);
}

document.querySelector('a#add-instance-button')?.addEventListener('click', (e) => {
Expand All @@ -196,7 +200,7 @@ ready(() => {
}
});

[].forEach.call(document.querySelectorAll('input[type="datetime-local"]'), element => {
document.querySelectorAll('input[type="datetime-local"]').forEach(element => {
if (element.value) {
element.value = convertUTCDateTimeToLocal(element.value);
}
Expand All @@ -206,7 +210,7 @@ ready(() => {
});

Rails.delegate(document, 'form', 'submit', ({ target }) => {
[].forEach.call(target.querySelectorAll('input[type="datetime-local"]'), element => {
target.querySelectorAll('input[type="datetime-local"]').forEach(element => {
if (element.value && element.validity.valid) {
element.value = convertLocalDatetimeToUTC(element.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class MediaContainer extends PureComponent {
return (
<IntlProvider>
<>
{[].map.call(components, (component, i) => {
{Array.from(components).map((component, i) => {
const componentName = component.getAttribute('data-component');
const Component = MEDIA_COMPONENTS[componentName];
const { media, card, poll, hashtag, ...props } = JSON.parse(component.getAttribute('data-props'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Object.keys(emojiIndex.emojis).forEach(key => {
let emoji = emojiIndex.emojis[key];

// Emojis with skin tone modifiers are stored like this
if (Object.prototype.hasOwnProperty.call(emoji, '1')) {
if (Object.hasOwn(emoji, '1')) {
emoji = emoji['1'];
}

Expand Down Expand Up @@ -88,7 +88,7 @@ Object.keys(emojiIndex.emojis).forEach(key => {
let emoji = emojiIndex.emojis[key];

// Emojis with skin tone modifiers are stored like this
if (Object.prototype.hasOwnProperty.call(emoji, '1')) {
if (Object.hasOwn(emoji, '1')) {
emoji = emoji['1'];
}

Expand Down
Loading

0 comments on commit 0d55610

Please sign in to comment.