Merge branch 'upstream-main' into develop
Some checks failed
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (push) Blocked by required conditions
Ruby Testing / End to End testing (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (push) Blocked by required conditions
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
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run

This commit is contained in:
Jeremy Kescher 2025-01-05 04:54:18 +01:00
commit e8c200565c
No known key found for this signature in database
GPG key ID: 80A419A7A613DFA4
8 changed files with 73 additions and 27 deletions

View file

@ -277,7 +277,12 @@ class Status extends ImmutablePureComponent {
handleClick = e => {
e.preventDefault();
this.handleHotkeyOpen(e);
if (e?.button === 0 && !(e?.ctrlKey || e?.metaKey)) {
this._openStatus();
} else if (e?.button === 1 || (e?.button === 0 && (e?.ctrlKey || e?.metaKey))) {
this._openStatus(true);
}
};
handleMouseUp = e => {
@ -354,7 +359,11 @@ class Status extends ImmutablePureComponent {
this.props.onMention(this.props.status.get('account'));
};
handleHotkeyOpen = (e) => {
handleHotkeyOpen = () => {
this._openStatus();
};
_openStatus = (newTab = false) => {
if (this.props.onClick) {
this.props.onClick();
return;
@ -369,7 +378,7 @@ class Status extends ImmutablePureComponent {
const path = `/@${status.getIn(['account', 'acct'])}/${status.get('id')}`;
if (e?.button === 1 || (e?.button === 0 && (e?.ctrlKey || e?.metaKey))) {
if (newTab) {
window.open(path, '_blank', 'noopener');
} else {
history.push(path);

View file

@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { connect } from 'react-redux';
import { getAverageFromBlurhash } from 'flavours/glitch/blurhash';
import Audio from 'flavours/glitch/features/audio';
import Footer from 'flavours/glitch/features/picture_in_picture/components/footer';
@ -26,6 +27,18 @@ class AudioModal extends ImmutablePureComponent {
onChangeBackgroundColor: PropTypes.func.isRequired,
};
componentDidMount () {
const { media, onChangeBackgroundColor } = this.props;
const backgroundColor = getAverageFromBlurhash(media.get('blurhash'));
onChangeBackgroundColor(backgroundColor || { r: 255, g: 255, b: 255 });
}
componentWillUnmount () {
this.props.onChangeBackgroundColor(null);
}
render () {
const { media, status, accountStaticAvatar, onClose } = this.props;
const options = this.props.options || {};

View file

@ -37,6 +37,10 @@ class VideoModal extends ImmutablePureComponent {
}
}
componentWillUnmount () {
this.props.onChangeBackgroundColor(null);
}
render () {
const { media, status, onClose } = this.props;
const options = this.props.options || {};

View file

@ -167,7 +167,12 @@ class Status extends ImmutablePureComponent {
handleClick = e => {
e.preventDefault();
this.handleHotkeyOpen(e);
if (e?.button === 0 && !(e?.ctrlKey || e?.metaKey)) {
this._openStatus();
} else if (e?.button === 1 || (e?.button === 0 && (e?.ctrlKey || e?.metaKey))) {
this._openStatus(true);
}
};
handleMouseUp = e => {
@ -275,7 +280,11 @@ class Status extends ImmutablePureComponent {
this.props.onMention(this._properStatus().get('account'));
};
handleHotkeyOpen = (e) => {
handleHotkeyOpen = () => {
this._openStatus();
};
_openStatus = (newTab = false) => {
if (this.props.onClick) {
this.props.onClick();
return;
@ -290,7 +299,7 @@ class Status extends ImmutablePureComponent {
const path = `/@${status.getIn(['account', 'acct'])}/${status.get('id')}`;
if (e?.button === 1 || (e?.button === 0 && (e?.ctrlKey || e?.metaKey))) {
if (newTab) {
window.open(path, '_blank', 'noopener');
} else {
history.push(path);

View file

@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { connect } from 'react-redux';
import { getAverageFromBlurhash } from 'mastodon/blurhash';
import Audio from 'mastodon/features/audio';
import Footer from 'mastodon/features/picture_in_picture/components/footer';
@ -26,6 +27,18 @@ class AudioModal extends ImmutablePureComponent {
onChangeBackgroundColor: PropTypes.func.isRequired,
};
componentDidMount () {
const { media, onChangeBackgroundColor } = this.props;
const backgroundColor = getAverageFromBlurhash(media.get('blurhash'));
onChangeBackgroundColor(backgroundColor || { r: 255, g: 255, b: 255 });
}
componentWillUnmount () {
this.props.onChangeBackgroundColor(null);
}
render () {
const { media, status, accountStaticAvatar, onClose } = this.props;
const options = this.props.options || {};

View file

@ -37,6 +37,10 @@ class VideoModal extends ImmutablePureComponent {
}
}
componentWillUnmount () {
this.props.onChangeBackgroundColor(null);
}
render () {
const { media, status, onClose } = this.props;
const options = this.props.options || {};

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
return unless defined?(Rails::Command::StatsCommand)
[
%w(AppLibs app/lib),
%w(Policies app/policies),
%w(Presenters app/presenters),
%w(Serializers app/serializers),
%w(Services app/services),
%w(Validators app/validators),
%w(Workers app/workers),
].each do |name, directory|
Rails::CodeStatistics.register_directory(name.titleize, directory)
end

View file

@ -1,21 +0,0 @@
# frozen_string_literal: true
task stats: 'mastodon:stats'
namespace :mastodon do
desc 'Report code statistics (KLOCs, etc)'
task :stats do
require 'rails/code_statistics'
[
['App Libraries', 'app/lib'],
%w(Presenters app/presenters),
%w(Policies app/policies),
%w(Serializers app/serializers),
%w(Services app/services),
%w(Validators app/validators),
%w(Workers app/workers),
].each do |name, dir|
STATS_DIRECTORIES << [name, dir]
end
end
end