Merge commit '899eac1a92c802c334606a49d538ef37bd47c91a' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/packs/admin.jsx`: Changes split in `app/javascript/core/admin.js` and `app/javascript/flavours/glitch/packs/admin.jsx`.shrike
commit
c2f0ea415e
|
@ -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;
|
||||
});
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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) => {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import { createRoot } from 'react-dom/client';
|
|||
import ready from 'flavours/glitch/ready';
|
||||
|
||||
ready(() => {
|
||||
[].forEach.call(document.querySelectorAll('[data-admin-component]'), element => {
|
||||
document.querySelectorAll('[data-admin-component]').forEach(element => {
|
||||
const componentName = element.getAttribute('data-admin-component');
|
||||
const { ...componentProps } = JSON.parse(element.getAttribute('data-props'));
|
||||
const componentProps = JSON.parse(element.getAttribute('data-props'));
|
||||
|
||||
import('flavours/glitch/containers/admin_component').then(({ default: AdminComponent }) => {
|
||||
return import('flavours/glitch/components/admin/' + componentName).then(({ default: Component }) => {
|
||||
|
|
|
@ -68,11 +68,11 @@ function main() {
|
|||
return messageFormat.format(values);
|
||||
};
|
||||
|
||||
[].forEach.call(document.querySelectorAll('.emojify'), (content) => {
|
||||
document.querySelectorAll('.emojify').forEach((content) => {
|
||||
content.innerHTML = emojify(content.innerHTML);
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('time.formatted'), (content) => {
|
||||
document.querySelectorAll('time.formatted').forEach((content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
const formattedDate = dateTimeFormat.format(datetime);
|
||||
|
||||
|
@ -89,7 +89,7 @@ function main() {
|
|||
};
|
||||
const todayFormat = new IntlMessageFormat(localeData['relative_format.today'] || 'Today at {time}', locale);
|
||||
|
||||
[].forEach.call(document.querySelectorAll('time.relative-formatted'), (content) => {
|
||||
document.querySelectorAll('time.relative-formatted').forEach((content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
|
||||
let formattedContent;
|
||||
|
@ -106,7 +106,7 @@ function main() {
|
|||
content.textContent = formattedContent;
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {
|
||||
document.querySelectorAll('time.time-ago').forEach((content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
const now = new Date();
|
||||
|
||||
|
@ -122,8 +122,8 @@ function main() {
|
|||
if (reactComponents.length > 0) {
|
||||
import(/* webpackChunkName: "containers/media_container" */ 'flavours/glitch/containers/media_container')
|
||||
.then(({ default: MediaContainer }) => {
|
||||
[].forEach.call(reactComponents, (component) => {
|
||||
[].forEach.call(component.children, (child) => {
|
||||
reactComponents.forEach((component) => {
|
||||
Array.from(component.children).forEach((child) => {
|
||||
component.removeChild(child);
|
||||
});
|
||||
});
|
||||
|
@ -188,7 +188,7 @@ function main() {
|
|||
return false;
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('.status__content__spoiler-link'), (spoilerLink) => {
|
||||
document.querySelectorAll('.status__content__spoiler-link').forEach((spoilerLink) => {
|
||||
const statusEl = spoilerLink.parentNode.parentNode;
|
||||
const message = (statusEl.dataset.spoiler === 'expanded') ? (localeData['status.show_less'] || 'Show less') : (localeData['status.show_more'] || 'Show more');
|
||||
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
|
||||
|
@ -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'];
|
||||
}
|
||||
|
||||
|
|
|
@ -135,19 +135,19 @@ function getData(emoji, skin, set) {
|
|||
}
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data.short_names, emoji)) {
|
||||
if (Object.hasOwn(data.short_names, emoji)) {
|
||||
emoji = data.short_names[emoji];
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data.emojis, emoji)) {
|
||||
if (Object.hasOwn(data.emojis, emoji)) {
|
||||
emojiData = data.emojis[emoji];
|
||||
}
|
||||
} else if (emoji.id) {
|
||||
if (Object.prototype.hasOwnProperty.call(data.short_names, emoji.id)) {
|
||||
if (Object.hasOwn(data.short_names, emoji.id)) {
|
||||
emoji.id = data.short_names[emoji.id];
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data.emojis, emoji.id)) {
|
||||
if (Object.hasOwn(data.emojis, emoji.id)) {
|
||||
emojiData = data.emojis[emoji.id];
|
||||
skin = skin || emoji.skin;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ function deepMerge(a, b) {
|
|||
let originalValue = a[key],
|
||||
value = originalValue;
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(b, key)) {
|
||||
if (Object.hasOwn(b, key)) {
|
||||
value = b[key];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { createRoot } from 'react-dom/client';
|
|||
import ready from '../mastodon/ready';
|
||||
|
||||
ready(() => {
|
||||
[].forEach.call(document.querySelectorAll('[data-admin-component]'), element => {
|
||||
document.querySelectorAll('[data-admin-component]').forEach(element => {
|
||||
const componentName = element.getAttribute('data-admin-component');
|
||||
const componentProps = JSON.parse(element.getAttribute('data-props'));
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ function loaded() {
|
|||
return messageFormat.format(values);
|
||||
};
|
||||
|
||||
[].forEach.call(document.querySelectorAll('.emojify'), (content) => {
|
||||
document.querySelectorAll('.emojify').forEach((content) => {
|
||||
content.innerHTML = emojify(content.innerHTML);
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('time.formatted'), (content) => {
|
||||
document.querySelectorAll('time.formatted').forEach((content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
const formattedDate = dateTimeFormat.format(datetime);
|
||||
|
||||
|
@ -78,7 +78,7 @@ function loaded() {
|
|||
};
|
||||
const todayFormat = new IntlMessageFormat(localeData['relative_format.today'] || 'Today at {time}', locale);
|
||||
|
||||
[].forEach.call(document.querySelectorAll('time.relative-formatted'), (content) => {
|
||||
document.querySelectorAll('time.relative-formatted').forEach((content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
|
||||
let formattedContent;
|
||||
|
@ -95,7 +95,7 @@ function loaded() {
|
|||
content.textContent = formattedContent;
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {
|
||||
document.querySelectorAll('time.time-ago').forEach((content) => {
|
||||
const datetime = new Date(content.getAttribute('datetime'));
|
||||
const now = new Date();
|
||||
|
||||
|
@ -112,8 +112,8 @@ function loaded() {
|
|||
if (reactComponents.length > 0) {
|
||||
import(/* webpackChunkName: "containers/media_container" */ '../mastodon/containers/media_container')
|
||||
.then(({ default: MediaContainer }) => {
|
||||
[].forEach.call(reactComponents, (component) => {
|
||||
[].forEach.call(component.children, (child) => {
|
||||
reactComponents.forEach((component) => {
|
||||
Array.from(component.children).forEach((child) => {
|
||||
component.removeChild(child);
|
||||
});
|
||||
});
|
||||
|
@ -169,7 +169,7 @@ function loaded() {
|
|||
return false;
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('.status__content__spoiler-link'), (spoilerLink) => {
|
||||
document.querySelectorAll('.status__content__spoiler-link').forEach((spoilerLink) => {
|
||||
const statusEl = spoilerLink.parentNode.parentNode;
|
||||
const message = (statusEl.dataset.spoiler === 'expanded') ? (localeData['status.show_less'] || 'Show less') : (localeData['status.show_more'] || 'Show more');
|
||||
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
var iframe = iframes.get(data.id);
|
||||
|
||||
if(!iframe) return;
|
||||
|
||||
if ('source' in e && iframe.contentWindow !== e.source) {
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +40,7 @@
|
|||
iframe.height = data.height;
|
||||
});
|
||||
|
||||
[].forEach.call(document.querySelectorAll('iframe.mastodon-embed'), function (iframe) {
|
||||
document.querySelectorAll('iframe.mastodon-embed').forEach(iframe => {
|
||||
// select unique id for each iframe
|
||||
var id = 0, failCount = 0, idBuffer = new Uint32Array(1);
|
||||
while (id === 0 || iframes.has(id)) {
|
||||
|
|
|
@ -192,7 +192,7 @@ const pgConfigFromEnv = (env) => {
|
|||
if (!baseConfig.password && env.DB_PASS) {
|
||||
baseConfig.password = env.DB_PASS;
|
||||
}
|
||||
} else if (Object.hasOwnProperty.call(pgConfigs, environment)) {
|
||||
} else if (Object.hasOwn(pgConfigs, environment)) {
|
||||
baseConfig = pgConfigs[environment];
|
||||
|
||||
if (env.DB_SSLMODE) {
|
||||
|
@ -919,7 +919,7 @@ const startServer = async () => {
|
|||
// If the payload already contains the `filtered` property, it means
|
||||
// that filtering has been applied on the ruby on rails side, as
|
||||
// such, we don't need to construct or apply the filters in streaming:
|
||||
if (Object.prototype.hasOwnProperty.call(payload, "filtered")) {
|
||||
if (Object.hasOwn(payload, "filtered")) {
|
||||
transmit(event, payload);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue