mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2025-01-18 19:44:05 +01:00
Merge pull request #2930 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 9b82bedc6f
This commit is contained in:
commit
747f1f4910
8 changed files with 73 additions and 27 deletions
|
@ -272,7 +272,12 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
handleClick = e => {
|
handleClick = e => {
|
||||||
e.preventDefault();
|
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 => {
|
handleMouseUp = e => {
|
||||||
|
@ -349,7 +354,11 @@ class Status extends ImmutablePureComponent {
|
||||||
this.props.onMention(this.props.status.get('account'));
|
this.props.onMention(this.props.status.get('account'));
|
||||||
};
|
};
|
||||||
|
|
||||||
handleHotkeyOpen = (e) => {
|
handleHotkeyOpen = () => {
|
||||||
|
this._openStatus();
|
||||||
|
};
|
||||||
|
|
||||||
|
_openStatus = (newTab = false) => {
|
||||||
if (this.props.onClick) {
|
if (this.props.onClick) {
|
||||||
this.props.onClick();
|
this.props.onClick();
|
||||||
return;
|
return;
|
||||||
|
@ -364,7 +373,7 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
const path = `/@${status.getIn(['account', 'acct'])}/${status.get('id')}`;
|
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');
|
window.open(path, '_blank', 'noopener');
|
||||||
} else {
|
} else {
|
||||||
history.push(path);
|
history.push(path);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
import { getAverageFromBlurhash } from 'flavours/glitch/blurhash';
|
||||||
import Audio from 'flavours/glitch/features/audio';
|
import Audio from 'flavours/glitch/features/audio';
|
||||||
import Footer from 'flavours/glitch/features/picture_in_picture/components/footer';
|
import Footer from 'flavours/glitch/features/picture_in_picture/components/footer';
|
||||||
|
|
||||||
|
@ -26,6 +27,18 @@ class AudioModal extends ImmutablePureComponent {
|
||||||
onChangeBackgroundColor: PropTypes.func.isRequired,
|
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 () {
|
render () {
|
||||||
const { media, status, accountStaticAvatar, onClose } = this.props;
|
const { media, status, accountStaticAvatar, onClose } = this.props;
|
||||||
const options = this.props.options || {};
|
const options = this.props.options || {};
|
||||||
|
|
|
@ -37,6 +37,10 @@ class VideoModal extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
this.props.onChangeBackgroundColor(null);
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { media, status, onClose } = this.props;
|
const { media, status, onClose } = this.props;
|
||||||
const options = this.props.options || {};
|
const options = this.props.options || {};
|
||||||
|
|
|
@ -167,7 +167,12 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
handleClick = e => {
|
handleClick = e => {
|
||||||
e.preventDefault();
|
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 => {
|
handleMouseUp = e => {
|
||||||
|
@ -275,7 +280,11 @@ class Status extends ImmutablePureComponent {
|
||||||
this.props.onMention(this._properStatus().get('account'));
|
this.props.onMention(this._properStatus().get('account'));
|
||||||
};
|
};
|
||||||
|
|
||||||
handleHotkeyOpen = (e) => {
|
handleHotkeyOpen = () => {
|
||||||
|
this._openStatus();
|
||||||
|
};
|
||||||
|
|
||||||
|
_openStatus = (newTab = false) => {
|
||||||
if (this.props.onClick) {
|
if (this.props.onClick) {
|
||||||
this.props.onClick();
|
this.props.onClick();
|
||||||
return;
|
return;
|
||||||
|
@ -290,7 +299,7 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
const path = `/@${status.getIn(['account', 'acct'])}/${status.get('id')}`;
|
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');
|
window.open(path, '_blank', 'noopener');
|
||||||
} else {
|
} else {
|
||||||
history.push(path);
|
history.push(path);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
import { getAverageFromBlurhash } from 'mastodon/blurhash';
|
||||||
import Audio from 'mastodon/features/audio';
|
import Audio from 'mastodon/features/audio';
|
||||||
import Footer from 'mastodon/features/picture_in_picture/components/footer';
|
import Footer from 'mastodon/features/picture_in_picture/components/footer';
|
||||||
|
|
||||||
|
@ -26,6 +27,18 @@ class AudioModal extends ImmutablePureComponent {
|
||||||
onChangeBackgroundColor: PropTypes.func.isRequired,
|
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 () {
|
render () {
|
||||||
const { media, status, accountStaticAvatar, onClose } = this.props;
|
const { media, status, accountStaticAvatar, onClose } = this.props;
|
||||||
const options = this.props.options || {};
|
const options = this.props.options || {};
|
||||||
|
|
|
@ -37,6 +37,10 @@ class VideoModal extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
this.props.onChangeBackgroundColor(null);
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { media, status, onClose } = this.props;
|
const { media, status, onClose } = this.props;
|
||||||
const options = this.props.options || {};
|
const options = this.props.options || {};
|
||||||
|
|
15
config/initializers/statistics.rb
Normal file
15
config/initializers/statistics.rb
Normal 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
|
|
@ -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 a new issue