Merge commit '75fca715e9ae8ad347edbaf6511a052f161a3de3' into glitch-soc/merge-upstream
Conflicts: - `app/views/settings/preferences/other/show.html.haml`: Upstream moved some preferences to a new category, while glitch-soc had an extra preference there. Moved the extra preference like upstream did to the new category.
This commit is contained in:
commit
d5b959a2ca
104 files changed
+769
-291
No files matched your search
@@ -10,7 +10,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
import EditIcon from '@/material-icons/400-24px/edit.svg?react';
|
||||
import FlagIcon from '@/material-icons/400-24px/flag-fill.svg?react';
|
||||
import FormatQuoteIcon from '@/material-icons/400-24px/format_quote.svg?react';
|
||||
import FormatQuoteIcon from '@/material-icons/400-24px/format_quote-fill.svg?react';
|
||||
import HomeIcon from '@/material-icons/400-24px/home-fill.svg?react';
|
||||
import InsertChartIcon from '@/material-icons/400-24px/insert_chart.svg?react';
|
||||
import PersonIcon from '@/material-icons/400-24px/person-fill.svg?react';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import FormatQuoteIcon from '@/material-icons/400-24px/format_quote.svg?react';
|
||||
import FormatQuoteIcon from '@/material-icons/400-24px/format_quote-fill.svg?react';
|
||||
import type { NotificationGroupQuote } from 'mastodon/models/notification_group';
|
||||
|
||||
import type { LabelRenderer } from './notification_group_with_status';
|
||||
|
||||
@@ -37,18 +37,20 @@ const getHostname = url => {
|
||||
|
||||
const domParser = new DOMParser();
|
||||
|
||||
const addAutoPlay = html => {
|
||||
const handleIframeUrl = (html, url, providerName) => {
|
||||
const document = domParser.parseFromString(html, 'text/html').documentElement;
|
||||
const iframe = document.querySelector('iframe');
|
||||
const startTime = new URL(url).searchParams.get('t')
|
||||
|
||||
if (iframe) {
|
||||
if (iframe.src.indexOf('?') !== -1) {
|
||||
iframe.src += '&';
|
||||
} else {
|
||||
iframe.src += '?';
|
||||
}
|
||||
const iframeUrl = new URL(iframe.src)
|
||||
|
||||
iframe.src += 'autoplay=1&auto_play=1';
|
||||
iframeUrl.searchParams.set('autoplay', 1)
|
||||
iframeUrl.searchParams.set('auto_play', 1)
|
||||
|
||||
if (startTime && providerName === "YouTube") iframeUrl.searchParams.set('start', startTime)
|
||||
|
||||
iframe.src = iframeUrl.href
|
||||
|
||||
// DOM parser creates html/body elements around original HTML fragment,
|
||||
// so we need to get innerHTML out of the body and not the entire document
|
||||
@@ -114,7 +116,7 @@ export default class Card extends PureComponent {
|
||||
|
||||
renderVideo () {
|
||||
const { card } = this.props;
|
||||
const content = { __html: addAutoPlay(card.get('html')) };
|
||||
const content = { __html: handleIframeUrl(card.get('html'), card.get('url'), card.get('provider_name')) };
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -89,6 +89,24 @@ const selectStatusPolicy = createAppSelector(
|
||||
},
|
||||
);
|
||||
|
||||
const selectDisablePublicVisibilities = createAppSelector(
|
||||
[
|
||||
(state) => state.statuses,
|
||||
(_state, statusId?: string) => !!statusId,
|
||||
(state) => state.compose.get('quoted_status_id') as string | null,
|
||||
],
|
||||
(statuses, isEditing, statusId) => {
|
||||
if (isEditing || !statusId) return false;
|
||||
|
||||
const status = statuses.get(statusId);
|
||||
if (!status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return status.get('visibility') === 'private';
|
||||
},
|
||||
);
|
||||
|
||||
export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
({ onClose, onChange, statusId }, _ref) => {
|
||||
@@ -110,24 +128,12 @@ export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
const disableVisibility = !!statusId;
|
||||
const disableQuotePolicy =
|
||||
visibility === 'private' || visibility === 'direct';
|
||||
const disablePublicVisibilities: boolean = useAppSelector(
|
||||
selectDisablePublicVisibilities,
|
||||
);
|
||||
|
||||
const visibilityItems = useMemo<SelectItem<StatusVisibility>[]>(
|
||||
() => [
|
||||
{
|
||||
value: 'public',
|
||||
text: intl.formatMessage(privacyMessages.public_short),
|
||||
meta: intl.formatMessage(privacyMessages.public_long),
|
||||
icon: 'globe',
|
||||
iconComponent: PublicIcon,
|
||||
},
|
||||
{
|
||||
value: 'unlisted',
|
||||
text: intl.formatMessage(privacyMessages.unlisted_short),
|
||||
meta: intl.formatMessage(privacyMessages.unlisted_long),
|
||||
extra: intl.formatMessage(privacyMessages.unlisted_extra),
|
||||
icon: 'unlock',
|
||||
iconComponent: QuietTimeIcon,
|
||||
},
|
||||
const visibilityItems = useMemo<SelectItem<StatusVisibility>[]>(() => {
|
||||
const items: SelectItem<StatusVisibility>[] = [
|
||||
{
|
||||
value: 'private',
|
||||
text: intl.formatMessage(privacyMessages.private_short),
|
||||
@@ -142,9 +148,30 @@ export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
icon: 'at',
|
||||
iconComponent: AlternateEmailIcon,
|
||||
},
|
||||
],
|
||||
[intl],
|
||||
);
|
||||
];
|
||||
|
||||
if (!disablePublicVisibilities) {
|
||||
items.unshift(
|
||||
{
|
||||
value: 'public',
|
||||
text: intl.formatMessage(privacyMessages.public_short),
|
||||
meta: intl.formatMessage(privacyMessages.public_long),
|
||||
icon: 'globe',
|
||||
iconComponent: PublicIcon,
|
||||
},
|
||||
{
|
||||
value: 'unlisted',
|
||||
text: intl.formatMessage(privacyMessages.unlisted_short),
|
||||
meta: intl.formatMessage(privacyMessages.unlisted_long),
|
||||
extra: intl.formatMessage(privacyMessages.unlisted_extra),
|
||||
icon: 'unlock',
|
||||
iconComponent: QuietTimeIcon,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return items;
|
||||
}, [intl, disablePublicVisibilities]);
|
||||
const quoteItems = useMemo<SelectItem<ApiQuotePolicy>[]>(
|
||||
() => [
|
||||
{ value: 'public', text: intl.formatMessage(messages.quotePublic) },
|
||||
@@ -198,10 +225,10 @@ export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
<div className='dialog-modal__content__description'>
|
||||
<FormattedMessage
|
||||
id='visibility_modal.instructions'
|
||||
defaultMessage='Control who can interact with this post. Global settings can be found under <link>Preferences > Other</link>.'
|
||||
defaultMessage='Control who can interact with this post. You can also apply settings to all future posts by navigating to <link>Preferences > Posting defaults</link>.'
|
||||
values={{
|
||||
link: (chunks) => (
|
||||
<a href='/settings/preferences/other'>{chunks}</a>
|
||||
<a href='/settings/preferences/posting_defaults'>{chunks}</a>
|
||||
),
|
||||
}}
|
||||
tagName='p'
|
||||
@@ -216,7 +243,7 @@ export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
>
|
||||
<FormattedMessage
|
||||
id='visibility_modal.privacy_label'
|
||||
defaultMessage='Privacy'
|
||||
defaultMessage='Visibility'
|
||||
/>
|
||||
|
||||
<Dropdown
|
||||
@@ -236,6 +263,14 @@ export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
/>
|
||||
</p>
|
||||
)}
|
||||
{!statusId && disablePublicVisibilities && (
|
||||
<p className='visibility-dropdown__helper'>
|
||||
<FormattedMessage
|
||||
id='visibility_modal.helper.privacy_private_self_quote'
|
||||
defaultMessage='Self-quotes of private posts cannot be made public.'
|
||||
/>
|
||||
</p>
|
||||
)}
|
||||
</label>
|
||||
|
||||
<label
|
||||
@@ -246,7 +281,7 @@ export const VisibilityModal: FC<VisibilityModalProps> = forwardRef(
|
||||
>
|
||||
<FormattedMessage
|
||||
id='visibility_modal.quote_label'
|
||||
defaultMessage='Change who can quote'
|
||||
defaultMessage='Who can quote'
|
||||
/>
|
||||
|
||||
<Dropdown
|
||||
|
||||
Reference in new issue
Block a user