Skip to content

Commit

Permalink
Merge commit '9712518b2fb2585df3bcff95a687c291f04a4199' into glitch-s…
Browse files Browse the repository at this point in the history
…oc/merge-upstream
  • Loading branch information
ClearlyClaire committed Jan 4, 2025
2 parents 1d9b585 + 9712518 commit 807bf8b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 24 deletions.
15 changes: 12 additions & 3 deletions app/javascript/mastodon/components/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions app/javascript/mastodon/features/ui/components/audio_modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {};
Expand Down
13 changes: 13 additions & 0 deletions config/initializers/statistics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

[
%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
21 changes: 0 additions & 21 deletions lib/tasks/statistics.rake

This file was deleted.

0 comments on commit 807bf8b

Please sign in to comment.