Merge pull request #544 from ThibG/glitch-soc/merge-upstream
Merge branch 'master' into glitch-soc/merge-upstreamth-downstream
commit
079bc2906a
@ -1,59 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component, Fragment } from 'react';
|
|
||||||
import { FormattedMessage } from 'react-intl';
|
|
||||||
import { NavLink } from 'react-router-dom';
|
|
||||||
|
|
||||||
export default class SectionHeadline extends Component {
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
timelineId: PropTypes.string.isRequired,
|
|
||||||
to: PropTypes.string.isRequired,
|
|
||||||
pinned: PropTypes.bool.isRequired,
|
|
||||||
onlyMedia: PropTypes.bool.isRequired,
|
|
||||||
onClick: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
shouldComponentUpdate (nextProps) {
|
|
||||||
return (
|
|
||||||
this.props.onlyMedia !== nextProps.onlyMedia ||
|
|
||||||
this.props.pinned !== nextProps.pinned ||
|
|
||||||
this.props.to !== nextProps.to ||
|
|
||||||
this.props.timelineId !== nextProps.timelineId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleClick = e => {
|
|
||||||
const { onClick } = this.props;
|
|
||||||
|
|
||||||
if (typeof onClick === 'function') {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
onClick.call(this, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const { timelineId, to, pinned, onlyMedia } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={`${timelineId}-timeline__section-headline`}>
|
|
||||||
{pinned ? (
|
|
||||||
<Fragment>
|
|
||||||
<a href={to} className={!onlyMedia ? 'active' : undefined} onClick={this.handleClick}>
|
|
||||||
<FormattedMessage id='timeline.posts' defaultMessage='Toots' />
|
|
||||||
</a>
|
|
||||||
<a href={`${to}/media`} className={onlyMedia ? 'active' : undefined} onClick={this.handleClick}>
|
|
||||||
<FormattedMessage id='timeline.media' defaultMessage='Media' />
|
|
||||||
</a>
|
|
||||||
</Fragment>
|
|
||||||
) : (
|
|
||||||
<Fragment>
|
|
||||||
<NavLink exact to={to} replace><FormattedMessage id='timeline.posts' defaultMessage='Toots' /></NavLink>
|
|
||||||
<NavLink exact to={`${to}/media`} replace><FormattedMessage id='timeline.media' defaultMessage='Media' /></NavLink>
|
|
||||||
</Fragment>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +1,28 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ColumnSettings from '../components/column_settings';
|
import ColumnSettings from '../components/column_settings';
|
||||||
import { changeSetting } from '../../../actions/settings';
|
import { changeSetting } from '../../../actions/settings';
|
||||||
|
import { changeColumnParams } from '../../../actions/columns';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = (state, { columnId }) => {
|
||||||
settings: state.getIn(['settings', 'community']),
|
const uuid = columnId;
|
||||||
});
|
const columns = state.getIn(['settings', 'columns']);
|
||||||
|
const index = columns.findIndex(c => c.get('uuid') === uuid);
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
return {
|
||||||
|
settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'community']),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch, { columnId }) => {
|
||||||
|
return {
|
||||||
onChange (key, checked) {
|
onChange (key, checked) {
|
||||||
|
if (columnId) {
|
||||||
|
dispatch(changeColumnParams(columnId, key, checked));
|
||||||
|
} else {
|
||||||
dispatch(changeSetting(['community', ...key], checked));
|
dispatch(changeSetting(['community', ...key], checked));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
};
|
||||||
});
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
|
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
|
import SettingText from '../../../components/setting_text';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' },
|
||||||
|
settings: { id: 'home.settings', defaultMessage: 'Column settings' },
|
||||||
|
});
|
||||||
|
|
||||||
|
@injectIntl
|
||||||
|
export default class ColumnSettings extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
settings: ImmutablePropTypes.map.isRequired,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { settings, onChange, intl } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<span className='column-settings__section'><FormattedMessage id='home.column_settings.advanced' defaultMessage='Advanced' /></span>
|
||||||
|
|
||||||
|
<div className='column-settings__row'>
|
||||||
|
<SettingText settings={settings} settingKey={['regex', 'body']} onChange={onChange} label={intl.formatMessage(messages.filter_regex)} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,17 +1,28 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ColumnSettings from '../../community_timeline/components/column_settings';
|
import ColumnSettings from '../../community_timeline/components/column_settings';
|
||||||
import { changeSetting } from '../../../actions/settings';
|
import { changeSetting } from '../../../actions/settings';
|
||||||
|
import { changeColumnParams } from '../../../actions/columns';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = (state, { columnId }) => {
|
||||||
settings: state.getIn(['settings', 'public']),
|
const uuid = columnId;
|
||||||
});
|
const columns = state.getIn(['settings', 'columns']);
|
||||||
|
const index = columns.findIndex(c => c.get('uuid') === uuid);
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
return {
|
||||||
|
settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'public']),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch, { columnId }) => {
|
||||||
|
return {
|
||||||
onChange (key, checked) {
|
onChange (key, checked) {
|
||||||
|
if (columnId) {
|
||||||
|
dispatch(changeColumnParams(columnId, key, checked));
|
||||||
|
} else {
|
||||||
dispatch(changeSetting(['public', ...key], checked));
|
dispatch(changeSetting(['public', ...key], checked));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
};
|
||||||
});
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
|
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
Rack::Timeout::Logger.disable
|
|
||||||
Rack::Timeout.service_timeout = false
|
|
||||||
|
|
||||||
if Rails.env.production?
|
|
||||||
Rack::Timeout.service_timeout = 90
|
|
||||||
end
|
|
@ -0,0 +1,17 @@
|
|||||||
|
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||||
|
|
||||||
|
class AddAutofollowToInvites < ActiveRecord::Migration[5.2]
|
||||||
|
include Mastodon::MigrationHelpers
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def change
|
||||||
|
safety_assured do
|
||||||
|
add_column_with_default :invites, :autofollow, :bool, default: false, allow_null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :invites, :autofollow
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue