Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream changes up to 0c3c06f7cc50c9207a44f56e184ce6a41f953171 #2842

Merged
3 changes: 2 additions & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
annotations: false
comment: false # Do not leave PR comments
coverage:
status:
Expand All @@ -10,3 +9,5 @@ coverage:
default:
# GitHub status check is not blocking
informational: true
github_checks:
annotations: false
20 changes: 18 additions & 2 deletions app/controllers/settings/verifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,30 @@

class Settings::VerificationsController < Settings::BaseController
before_action :set_account
before_action :set_verified_links

def show
@verified_links = @account.fields.select(&:verified?)
def show; end

def update
if UpdateAccountService.new.call(@account, account_params)
ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
redirect_to settings_verification_path, notice: I18n.t('generic.changes_saved_msg')
else
render :show
end
end

private

def account_params
params.require(:account).permit(:attribution_domains_as_text)
end

def set_account
@account = current_account
end

def set_verified_links
@verified_links = @account.fields.select(&:verified?)
end
end
1 change: 1 addition & 0 deletions app/helpers/context_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module ContextHelper
'cipherText' => 'toot:cipherText',
},
suspended: { 'toot' => 'http://joinmastodon.org/ns#', 'suspended' => 'toot:suspended' },
attribution_domains: { 'toot' => 'http://joinmastodon.org/ns#', 'attributionDomains' => { '@id' => 'toot:attributionDomains', '@type' => '@id' } },
}.freeze

def full_context
Expand Down
32 changes: 15 additions & 17 deletions app/javascript/flavours/glitch/components/media_gallery.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { FormattedMessage } from 'react-intl';

import classNames from 'classnames';

Expand All @@ -10,17 +10,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes';

import { debounce } from 'lodash';

import VisibilityOffIcon from '@/material-icons/400-24px/visibility_off.svg?react';
import { Blurhash } from 'flavours/glitch/components/blurhash';

import { autoPlayGif, displayMedia, useBlurhash } from '../initial_state';

import { IconButton } from './icon_button';

const messages = defineMessages({
toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' },
});

class Item extends PureComponent {

static propTypes = {
Expand Down Expand Up @@ -220,7 +213,6 @@ class MediaGallery extends PureComponent {
lang: PropTypes.string,
size: PropTypes.object,
onOpenMedia: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
defaultWidth: PropTypes.number,
cacheWidth: PropTypes.func,
visible: PropTypes.bool,
Expand Down Expand Up @@ -309,7 +301,7 @@ class MediaGallery extends PureComponent {
}

render () {
const { media, lang, intl, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props;
const { media, lang, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props;
const { visible } = this.state;
const size = media.size;
const uncached = media.every(attachment => attachment.get('type') === 'unknown');
Expand Down Expand Up @@ -343,9 +335,7 @@ class MediaGallery extends PureComponent {
</span>
</button>
);
} else if (visible) {
spoilerButton = <IconButton title={intl.formatMessage(messages.toggle_visible, { number: size })} icon='eye-slash' iconComponent={VisibilityOffIcon} overlay onClick={this.handleOpen} ariaHidden />;
} else {
} else if (!visible) {
spoilerButton = (
<button type='button' onClick={this.handleOpen} className='spoiler-button__overlay'>
<span className='spoiler-button__overlay__label'>
Expand All @@ -358,15 +348,23 @@ class MediaGallery extends PureComponent {

return (
<div className={computedClass} style={style} ref={this.handleRef}>
<div className={classNames('spoiler-button', { 'spoiler-button--minified': visible && !uncached, 'spoiler-button--click-thru': uncached })}>
{spoilerButton}
</div>
{(!visible || uncached) && (
<div className={classNames('spoiler-button', { 'spoiler-button--click-thru': uncached })}>
{spoilerButton}
</div>
)}

{children}

{(visible && !uncached) && (
<div className='media-gallery__actions'>
<button className='media-gallery__actions__pill' onClick={this.handleOpen}><FormattedMessage id='media_gallery.hide' defaultMessage='Hide' /></button>
</div>
)}
</div>
);
}

}

export default injectIntl(MediaGallery);
export default MediaGallery;
60 changes: 35 additions & 25 deletions app/javascript/flavours/glitch/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5050,22 +5050,14 @@ a.status-card {
position: absolute;
z-index: 100;

&--minified {
display: block;
inset-inline-start: 4px;
top: 4px;
width: auto;
height: auto;
&--hidden {
display: none;
}

&--click-thru {
pointer-events: none;
}

&--hidden {
display: none;
}

&__overlay {
display: flex;
align-items: center;
Expand All @@ -5077,19 +5069,20 @@ a.status-card {
margin: 0;
border: 0;
color: $white;
line-height: 20px;
font-size: 14px;

&__label {
background-color: rgba($black, 0.45);
backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%);
border-radius: 6px;
padding: 10px 15px;
border-radius: 8px;
padding: 12px 16px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
gap: 4px;
flex-direction: column;
font-weight: 500;
font-size: 14px;
font-weight: 600;
}

&__action {
Expand Down Expand Up @@ -7336,10 +7329,32 @@ img.modal-warning {
}
}

.media-gallery__item__badges {
.media-gallery__actions {
position: absolute;
bottom: 6px;
inset-inline-start: 6px;
inset-inline-end: 6px;
display: flex;
gap: 2px;
z-index: 2;

&__pill {
display: block;
color: $white;
border: 0;
background: rgba($black, 0.65);
backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%);
padding: 3px 12px;
border-radius: 99px;
font-size: 14px;
font-weight: 700;
line-height: 20px;
}
}

.media-gallery__item__badges {
position: absolute;
bottom: 8px;
inset-inline-start: 8px;
display: flex;
gap: 2px;
}
Expand All @@ -7352,18 +7367,13 @@ img.modal-warning {
color: $white;
background: rgba($black, 0.65);
backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%);
padding: 2px 6px;
padding: 3px 8px;
border-radius: 4px;
font-size: 11px;
font-size: 12px;
font-weight: 700;
z-index: 1;
pointer-events: none;
line-height: 18px;

.icon {
width: 15px;
height: 15px;
}
line-height: 20px;
}

.attachment-list {
Expand Down
35 changes: 35 additions & 0 deletions app/javascript/flavours/glitch/styles/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@ code {
margin: 50px auto;
}

.form-section {
border-radius: 8px;
background: var(--surface-background-color);
padding: 24px;
margin-bottom: 24px;
}

.fade-out-top {
position: relative;
overflow: hidden;
height: 160px;

&::after {
content: '';
display: block;
background: linear-gradient(
to bottom,
var(--surface-background-color),
transparent
);
position: absolute;
top: 0;
inset-inline-start: 0;
width: 100%;
height: 100px;
pointer-events: none;
}

& > div {
position: absolute;
inset-inline-start: 0;
bottom: 0;
}
}

.indicator-icon {
display: flex;
align-items: center;
Expand Down
32 changes: 15 additions & 17 deletions app/javascript/mastodon/components/media_gallery.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { FormattedMessage } from 'react-intl';

import classNames from 'classnames';

Expand All @@ -10,17 +10,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes';

import { debounce } from 'lodash';

import VisibilityOffIcon from '@/material-icons/400-24px/visibility_off.svg?react';
import { Blurhash } from 'mastodon/components/blurhash';

import { autoPlayGif, displayMedia, useBlurhash } from '../initial_state';

import { IconButton } from './icon_button';

const messages = defineMessages({
toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' },
});

class Item extends PureComponent {

static propTypes = {
Expand Down Expand Up @@ -215,7 +208,6 @@ class MediaGallery extends PureComponent {
size: PropTypes.object,
height: PropTypes.number.isRequired,
onOpenMedia: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
defaultWidth: PropTypes.number,
cacheWidth: PropTypes.func,
visible: PropTypes.bool,
Expand Down Expand Up @@ -291,7 +283,7 @@ class MediaGallery extends PureComponent {
}

render () {
const { media, lang, intl, sensitive, defaultWidth, autoplay } = this.props;
const { media, lang, sensitive, defaultWidth, autoplay } = this.props;
const { visible } = this.state;
const width = this.state.width || defaultWidth;

Expand Down Expand Up @@ -323,9 +315,7 @@ class MediaGallery extends PureComponent {
</span>
</button>
);
} else if (visible) {
spoilerButton = <IconButton title={intl.formatMessage(messages.toggle_visible, { number: size })} icon='eye-slash' iconComponent={VisibilityOffIcon} overlay onClick={this.handleOpen} ariaHidden />;
} else {
} else if (!visible) {
spoilerButton = (
<button type='button' onClick={this.handleOpen} className='spoiler-button__overlay'>
<span className='spoiler-button__overlay__label'>
Expand All @@ -338,15 +328,23 @@ class MediaGallery extends PureComponent {

return (
<div className='media-gallery' style={style} ref={this.handleRef}>
<div className={classNames('spoiler-button', { 'spoiler-button--minified': visible && !uncached, 'spoiler-button--click-thru': uncached })}>
{spoilerButton}
</div>
{(!visible || uncached) && (
<div className={classNames('spoiler-button', { 'spoiler-button--click-thru': uncached })}>
{spoilerButton}
</div>
)}

{children}

{(visible && !uncached) && (
<div className='media-gallery__actions'>
<button className='media-gallery__actions__pill' onClick={this.handleOpen}><FormattedMessage id='media_gallery.hide' defaultMessage='Hide' /></button>
</div>
)}
</div>
);
}

}

export default injectIntl(MediaGallery);
export default MediaGallery;
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
"lists.subheading": "Your lists",
"load_pending": "{count, plural, one {# new item} other {# new items}}",
"loading_indicator.label": "Loading…",
"media_gallery.toggle_visible": "{number, plural, one {Hide image} other {Hide images}}",
"media_gallery.hide": "Hide",
"moved_to_account_banner.text": "Your account {disabledAccount} is currently disabled because you moved to {movedToAccount}.",
"mute_modal.hide_from_notifications": "Hide from notifications",
"mute_modal.hide_options": "Hide options",
Expand Down
Loading
Loading