Merge pull request #1684 from matrix-org/luke/fix-tag-panel-shift-ctrl-click
Fix shift and shift-ctrl click in TagPanel
This commit is contained in:
commit
5961cf3958
6 changed files with 83 additions and 134 deletions
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { MatrixClient } from 'matrix-js-sdk';
|
||||
import FilterStore from '../../stores/FilterStore';
|
||||
import TagOrderStore from '../../stores/TagOrderStore';
|
||||
|
||||
import GroupActions from '../../actions/GroupActions';
|
||||
|
@ -44,20 +43,13 @@ const TagPanel = React.createClass({
|
|||
this.unmounted = false;
|
||||
this.context.matrixClient.on("Group.myMembership", this._onGroupMyMembership);
|
||||
|
||||
this._filterStoreToken = FilterStore.addListener(() => {
|
||||
if (this.unmounted) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
selectedTags: FilterStore.getSelectedTags(),
|
||||
});
|
||||
});
|
||||
this._tagOrderStoreToken = TagOrderStore.addListener(() => {
|
||||
if (this.unmounted) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
orderedTags: TagOrderStore.getOrderedTags() || [],
|
||||
selectedTags: TagOrderStore.getSelectedTags(),
|
||||
});
|
||||
});
|
||||
// This could be done by anything with a matrix client
|
||||
|
|
|
@ -20,7 +20,7 @@ import classNames from 'classnames';
|
|||
import { MatrixClient } from 'matrix-js-sdk';
|
||||
import sdk from '../../../index';
|
||||
import dis from '../../../dispatcher';
|
||||
import { isOnlyCtrlOrCmdKeyEvent } from '../../../Keyboard';
|
||||
import { isCtrlOrCmdKeyEvent } from '../../../Keyboard';
|
||||
|
||||
import FlairStore from '../../../stores/FlairStore';
|
||||
|
||||
|
@ -76,7 +76,7 @@ export default React.createClass({
|
|||
dis.dispatch({
|
||||
action: 'select_tag',
|
||||
tag: this.props.tag,
|
||||
ctrlOrCmdKey: isOnlyCtrlOrCmdKeyEvent(e),
|
||||
ctrlOrCmdKey: isCtrlOrCmdKeyEvent(e),
|
||||
shiftKey: e.shiftKey,
|
||||
});
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ const rate_limited_func = require('../../../ratelimitedfunc');
|
|||
const Rooms = require('../../../Rooms');
|
||||
import DMRoomMap from '../../../utils/DMRoomMap';
|
||||
const Receipt = require('../../../utils/Receipt');
|
||||
import FilterStore from '../../../stores/FilterStore';
|
||||
import TagOrderStore from '../../../stores/TagOrderStore';
|
||||
import GroupStoreCache from '../../../stores/GroupStoreCache';
|
||||
|
||||
const HIDE_CONFERENCE_CHANS = true;
|
||||
|
@ -95,8 +95,8 @@ module.exports = React.createClass({
|
|||
// All rooms that should be kept in the room list when filtering
|
||||
this._visibleRooms = [];
|
||||
// When the selected tags are changed, initialise a group store if necessary
|
||||
this._filterStoreToken = FilterStore.addListener(() => {
|
||||
FilterStore.getSelectedTags().forEach((tag) => {
|
||||
this._tagStoreToken = TagOrderStore.addListener(() => {
|
||||
TagOrderStore.getSelectedTags().forEach((tag) => {
|
||||
if (tag[0] !== '+' || this._groupStores[tag]) {
|
||||
return;
|
||||
}
|
||||
|
@ -182,8 +182,8 @@ module.exports = React.createClass({
|
|||
MatrixClientPeg.get().removeListener("Group.myMembership", this._onGroupMyMembership);
|
||||
}
|
||||
|
||||
if (this._filterStoreToken) {
|
||||
this._filterStoreToken.remove();
|
||||
if (this._tagStoreToken) {
|
||||
this._tagStoreToken.remove();
|
||||
}
|
||||
|
||||
if (this._groupStoreTokens.length > 0) {
|
||||
|
@ -298,14 +298,14 @@ module.exports = React.createClass({
|
|||
// Update which rooms and users should appear according to which tags are selected
|
||||
updateVisibleRooms: function() {
|
||||
this._visibleRooms = [];
|
||||
FilterStore.getSelectedTags().forEach((tag) => {
|
||||
TagOrderStore.getSelectedTags().forEach((tag) => {
|
||||
(this._visibleRoomsForGroup[tag] || []).forEach(
|
||||
(roomId) => this._visibleRooms.push(roomId),
|
||||
);
|
||||
});
|
||||
|
||||
this.setState({
|
||||
selectedTags: FilterStore.getSelectedTags(),
|
||||
selectedTags: TagOrderStore.getSelectedTags(),
|
||||
}, () => {
|
||||
this.refreshRoomList();
|
||||
});
|
||||
|
@ -362,7 +362,7 @@ module.exports = React.createClass({
|
|||
// Used to split rooms via tags
|
||||
const tagNames = Object.keys(room.tags);
|
||||
|
||||
// Apply TagPanel filtering, derived from FilterStore
|
||||
// Apply TagPanel filtering, derived from TagOrderStore
|
||||
if (!this.isRoomInSelectedTags(room)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue