diff options
author | Starfall <admin@plural.cafe> | 2020-05-31 12:56:29 -0500 |
---|---|---|
committer | Starfall <admin@plural.cafe> | 2020-05-31 12:56:29 -0500 |
commit | 76f79dd29909d39f1d36ef48e6892223d59e29d7 (patch) | |
tree | 8a5ace5fea5cf8a4c6f1c55e01db99a289c4b1e3 /app/javascript/flavours/glitch/features | |
parent | 0167552bed46508efeed266853a1ee4437e12998 (diff) | |
parent | ddcd9fe9f0e85b1db12ae584749e680146611f9a (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/features')
4 files changed, 16 insertions, 23 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index 3d736e83f..a7cb95222 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -158,19 +158,12 @@ class ComposeForm extends ImmutablePureComponent { this.props.onSuggestionSelected(tokenStart, token, value, ['spoiler_text']); } - // When the escape key is released, we focus the UI. - handleKeyUp = ({ key, ctrlKey, keyCode, metaKey, altKey }) => { - if (key === 'Escape') { - document.querySelector('.ui').parentElement.focus(); - } - - // We submit the status on control/meta + enter. - if (keyCode === 13 && (ctrlKey || metaKey)) { + handleKeyDown = (e) => { + if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { this.handleSubmit(); } - // Submit the status with secondary visibility on alt + enter. - if (keyCode === 13 && altKey) { + if (e.keyCode == 13 && e.altKey) { this.handleSecondarySubmit(); } } @@ -305,7 +298,7 @@ class ComposeForm extends ImmutablePureComponent { placeholder={intl.formatMessage(messages.spoiler_placeholder)} value={spoilerText} onChange={this.handleChangeSpoiler} - onKeyUp={this.handleKeyUp} + onKeyDown={this.handleKeyDown} disabled={!spoiler} ref={this.handleRefSpoilerText} suggestions={this.props.suggestions} @@ -325,7 +318,7 @@ class ComposeForm extends ImmutablePureComponent { disabled={isSubmitting} value={this.props.text} onChange={this.handleChange} - onKeyUp={this.handleKeyUp} + onKeyDown={this.handleKeyDown} suggestions={this.props.suggestions} onFocus={this.handleFocus} onSuggestionsFetchRequested={onFetchSuggestions} diff --git a/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js b/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js index 7a5268780..68568d169 100644 --- a/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js +++ b/app/javascript/flavours/glitch/features/getting_started/containers/trends_container.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { fetchTrends } from 'mastodon/actions/trends'; +import { fetchTrends } from 'flavours/glitch/actions/trends'; import Trends from '../components/trends'; const mapStateToProps = state => ({ diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/index.js b/app/javascript/flavours/glitch/features/hashtag_timeline/index.js index e94f36501..48e52e4cd 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/index.js +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/index.js @@ -12,7 +12,7 @@ import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; import { isEqual } from 'lodash'; const mapStateToProps = (state, props) => ({ - hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0, + hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}${props.params.local ? ':local' : ''}`, 'unread']) > 0, }); export default @connect(mapStateToProps) @@ -75,13 +75,13 @@ class HashtagTimeline extends React.PureComponent { this.column.scrollTop(); } - _subscribe (dispatch, id, tags = {}) { + _subscribe (dispatch, id, tags = {}, local) { let any = (tags.any || []).map(tag => tag.value); let all = (tags.all || []).map(tag => tag.value); let none = (tags.none || []).map(tag => tag.value); [id, ...any].map(tag => { - this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => { + this.disconnects.push(dispatch(connectHashtagStream(id, tag, local, status => { let tags = status.tags.map(tag => tag.name); return all.filter(tag => tags.includes(tag)).length === all.length && @@ -99,7 +99,7 @@ class HashtagTimeline extends React.PureComponent { const { dispatch } = this.props; const { id, tags, local } = this.props.params; - this._subscribe(dispatch, id, tags); + this._subscribe(dispatch, id, tags, local); dispatch(expandHashtagTimeline(id, { tags, local })); } @@ -109,8 +109,8 @@ class HashtagTimeline extends React.PureComponent { if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) { this._unsubscribe(); - this._subscribe(dispatch, id, tags); - dispatch(clearTimeline(`hashtag:${id}`)); + this._subscribe(dispatch, id, tags, local); + dispatch(clearTimeline(`hashtag:${id}${local ? ':local' : ''}`)); dispatch(expandHashtagTimeline(id, { tags, local })); } } @@ -130,7 +130,7 @@ class HashtagTimeline extends React.PureComponent { render () { const { hasUnread, columnId, multiColumn } = this.props; - const { id } = this.props.params; + const { id, local } = this.props.params; const pinned = !!columnId; return ( @@ -153,7 +153,7 @@ class HashtagTimeline extends React.PureComponent { <StatusListContainer trackScroll={!pinned} scrollKey={`hashtag_timeline-${columnId}`} - timelineId={`hashtag:${id}`} + timelineId={`hashtag:${id}${local ? ':local' : ''}`} onLoadMore={this.handleLoadMore} emptyMessage={<FormattedMessage id='empty_column.hashtag' defaultMessage='There is nothing in this hashtag yet.' />} bindToDocument={!multiColumn} diff --git a/app/javascript/flavours/glitch/features/ui/index.js b/app/javascript/flavours/glitch/features/ui/index.js index 9f9ef561a..f8f6cff88 100644 --- a/app/javascript/flavours/glitch/features/ui/index.js +++ b/app/javascript/flavours/glitch/features/ui/index.js @@ -12,7 +12,7 @@ import { expandHomeTimeline } from 'flavours/glitch/actions/timelines'; import { expandNotifications, notificationsSetVisibility } from 'flavours/glitch/actions/notifications'; import { fetchFilters } from 'flavours/glitch/actions/filters'; import { clearHeight } from 'flavours/glitch/actions/height_cache'; -import { submitMarkers, fetchMarkers } from 'flavours/glitch/actions/markers'; +import { synchronouslySubmitMarkers, fetchMarkers } from 'flavours/glitch/actions/markers'; import { WrappedSwitch, WrappedRoute } from 'flavours/glitch/util/react_router_helpers'; import UploadArea from './components/upload_area'; import PermaLink from 'flavours/glitch/components/permalink'; @@ -267,7 +267,7 @@ class UI extends React.Component { handleBeforeUnload = (e) => { const { intl, dispatch, hasComposingText, hasMediaAttachments } = this.props; - dispatch(submitMarkers()); + dispatch(synchronouslySubmitMarkers()); if (hasComposingText || hasMediaAttachments) { // Setting returnValue to any string causes confirmation dialog. |