mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 05:58:07 +01:00
feat(preview): Allow bypassing CW/sensitive for link preview
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.1) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (push) Has been cancelled
Ruby Testing / End to End testing (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (push) Has been cancelled
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.1) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (push) Has been cancelled
Ruby Testing / End to End testing (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (push) Has been cancelled
This commit is contained in:
parent
3fc4a1a03f
commit
2d5f770295
6 changed files with 25 additions and 2 deletions
|
@ -54,6 +54,8 @@ For production, it is suggested you run:
|
||||||
- Allow dashes in emoji shortcodes
|
- Allow dashes in emoji shortcodes
|
||||||
- This is simply to allow custom emoji compat with other fedi software.
|
- This is simply to allow custom emoji compat with other fedi software.
|
||||||
- Original patch by hazycora: https://github.com/TheEssem/mastodon/commit/2dde7a25a47a23f827e2fd2d07f55438f9985181
|
- Original patch by hazycora: https://github.com/TheEssem/mastodon/commit/2dde7a25a47a23f827e2fd2d07f55438f9985181
|
||||||
|
- Allow appending "?unrestricted_preview=true" to post links to bypass CWs and sensitive-markings of media for link
|
||||||
|
previews.
|
||||||
|
|
||||||
## Contributions to glitch-soc Mastodon
|
## Contributions to glitch-soc Mastodon
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ module StatusesHelper
|
||||||
def status_description(status)
|
def status_description(status)
|
||||||
components = [[media_summary(status), status_text_summary(status)].compact_blank.join(' · ')]
|
components = [[media_summary(status), status_text_summary(status)].compact_blank.join(' · ')]
|
||||||
|
|
||||||
if status.spoiler_text.blank?
|
if status.spoiler_text.blank? || ActiveRecord::Type::Boolean.new.deserialize(params[:unrestricted_preview])
|
||||||
components << status.text
|
components << status.text
|
||||||
components << poll_summary(status)
|
components << poll_summary(status)
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,6 +64,7 @@ const messages = defineMessages({
|
||||||
admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' },
|
admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' },
|
||||||
admin_domain: { id: 'status.admin_domain', defaultMessage: 'Open moderation interface for {domain}' },
|
admin_domain: { id: 'status.admin_domain', defaultMessage: 'Open moderation interface for {domain}' },
|
||||||
copy: { id: 'status.copy', defaultMessage: 'Copy link to post' },
|
copy: { id: 'status.copy', defaultMessage: 'Copy link to post' },
|
||||||
|
copyUnrestricted: { id: 'status.copyUnrestricted', defaultMessage: 'Copy link to post (no CW preview)' },
|
||||||
hide: { id: 'status.hide', defaultMessage: 'Hide post' },
|
hide: { id: 'status.hide', defaultMessage: 'Hide post' },
|
||||||
edited: { id: 'status.edited', defaultMessage: 'Edited {date}' },
|
edited: { id: 'status.edited', defaultMessage: 'Edited {date}' },
|
||||||
filter: { id: 'status.filter', defaultMessage: 'Filter this post' },
|
filter: { id: 'status.filter', defaultMessage: 'Filter this post' },
|
||||||
|
@ -205,6 +206,11 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleCopyUnrestricted = () => {
|
||||||
|
const url = `${this.props.status.get('url')}?unrestricted_preview=true`;
|
||||||
|
navigator.clipboard.writeText(url);
|
||||||
|
};
|
||||||
|
|
||||||
handleHideClick = () => {
|
handleHideClick = () => {
|
||||||
this.props.onFilter();
|
this.props.onFilter();
|
||||||
};
|
};
|
||||||
|
@ -237,6 +243,10 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||||
|
|
||||||
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
|
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
|
||||||
|
|
||||||
|
if (publicStatus) {
|
||||||
|
menu.push({ text: intl.formatMessage(messages.copyUnrestricted), action: this.handleCopyUnrestricted });
|
||||||
|
}
|
||||||
|
|
||||||
if (publicStatus && 'share' in navigator) {
|
if (publicStatus && 'share' in navigator) {
|
||||||
menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick });
|
menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick });
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ const messages = defineMessages({
|
||||||
admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' },
|
admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' },
|
||||||
admin_domain: { id: 'status.admin_domain', defaultMessage: 'Open moderation interface for {domain}' },
|
admin_domain: { id: 'status.admin_domain', defaultMessage: 'Open moderation interface for {domain}' },
|
||||||
copy: { id: 'status.copy', defaultMessage: 'Copy link to post' },
|
copy: { id: 'status.copy', defaultMessage: 'Copy link to post' },
|
||||||
|
copyUnrestricted: { id: 'status.copyUnrestricted', defaultMessage: 'Copy link to post (no CW preview)' },
|
||||||
openOriginalPage: { id: 'account.open_original_page', defaultMessage: 'Open original page' },
|
openOriginalPage: { id: 'account.open_original_page', defaultMessage: 'Open original page' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,6 +158,11 @@ class ActionBar extends PureComponent {
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleCopyUnrestricted = () => {
|
||||||
|
const url = `${this.props.status.get('url')}?unrestricted_preview=true`;
|
||||||
|
navigator.clipboard.writeText(url);
|
||||||
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { status, intl } = this.props;
|
const { status, intl } = this.props;
|
||||||
const { signedIn, permissions } = this.props.identity;
|
const { signedIn, permissions } = this.props.identity;
|
||||||
|
@ -175,6 +181,10 @@ class ActionBar extends PureComponent {
|
||||||
|
|
||||||
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
|
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
|
||||||
|
|
||||||
|
if (publicStatus) {
|
||||||
|
menu.push({ text: intl.formatMessage(messages.copyUnrestricted), action: this.handleCopyUnrestricted });
|
||||||
|
}
|
||||||
|
|
||||||
if (publicStatus && 'share' in navigator) {
|
if (publicStatus && 'share' in navigator) {
|
||||||
menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare });
|
menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare });
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
"settings.wide_view": "Wide view (Desktop mode only)",
|
"settings.wide_view": "Wide view (Desktop mode only)",
|
||||||
"settings.wide_view_hint": "Stretches columns to better fill the available space.",
|
"settings.wide_view_hint": "Stretches columns to better fill the available space.",
|
||||||
"status.collapse": "Collapse",
|
"status.collapse": "Collapse",
|
||||||
|
"status.copyUnrestricted": "Copy link to post (no CW preview)",
|
||||||
"status.filtered": "Filtered",
|
"status.filtered": "Filtered",
|
||||||
"status.has_audio": "Features attached audio files",
|
"status.has_audio": "Features attached audio files",
|
||||||
"status.has_pictures": "Features attached pictures",
|
"status.has_pictures": "Features attached pictures",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- if activity.is_a?(Status) && (activity.non_sensitive_with_media? || (activity.with_media? && Setting.preview_sensitive_media))
|
- if activity.is_a?(Status) && (activity.non_sensitive_with_media? || ActiveRecord::Type::Boolean.new.deserialize(params[:unrestricted_preview]) || (activity.with_media? && Setting.preview_sensitive_media))
|
||||||
- player_card = false
|
- player_card = false
|
||||||
- activity.ordered_media_attachments.each do |media|
|
- activity.ordered_media_attachments.each do |media|
|
||||||
- if media.image?
|
- if media.image?
|
||||||
|
|
Loading…
Reference in a new issue