Merge pull request #2930 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 9b82bedc6f
pull/2920/head
commit
747f1f4910
|
@ -272,7 +272,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 => {
|
||||
|
@ -349,7 +354,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;
|
||||
|
@ -364,7 +373,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);
|
||||
|
|
|
@ -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 || {};
|
||||
|
|
|
@ -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 || {};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 || {};
|
||||
|
|
|
@ -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 || {};
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue