Merge remote-tracking branch 'upstream/develop' into fix/rl-resort/110
This commit is contained in:
commit
08402cca9f
241 changed files with 5871 additions and 2674 deletions
|
@ -14,12 +14,14 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
import { Store } from 'flux/utils';
|
||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
import dis from '../dispatcher/dispatcher';
|
||||
import GroupStore from './GroupStore';
|
||||
import Analytics from '../Analytics';
|
||||
import * as RoomNotifs from "../RoomNotifs";
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import { CreateEventField } from "../components/views/dialogs/CreateSpaceFromCommunityDialog";
|
||||
|
||||
const INITIAL_STATE = {
|
||||
orderedTags: null,
|
||||
|
@ -235,8 +237,12 @@ class GroupFilterOrderStore extends Store {
|
|||
(t) => (t[0] !== '+' || groupIds.includes(t)) && !removedTags.has(t),
|
||||
);
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
const migratedCommunities = new Set(cli.getRooms().map(r => {
|
||||
return r.currentState.getStateEvents(EventType.RoomCreate, "")?.getContent()[CreateEventField];
|
||||
}).filter(Boolean));
|
||||
const groupIdsToAdd = groupIds.filter(
|
||||
(groupId) => !tags.includes(groupId) && !removedTags.has(groupId),
|
||||
(groupId) => !tags.includes(groupId) && !removedTags.has(groupId) && !migratedCommunities.has(groupId),
|
||||
);
|
||||
|
||||
return tagsToKeep.concat(groupIdsToAdd);
|
||||
|
|
|
@ -20,11 +20,11 @@ import FlairStore from './FlairStore';
|
|||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import dis from '../dispatcher/dispatcher';
|
||||
|
||||
function parseMembersResponse(response) {
|
||||
export function parseMembersResponse(response) {
|
||||
return response.chunk.map((apiMember) => groupMemberFromApiObject(apiMember));
|
||||
}
|
||||
|
||||
function parseRoomsResponse(response) {
|
||||
export function parseRoomsResponse(response) {
|
||||
return response.chunk.map((apiRoom) => groupRoomFromApiObject(apiRoom));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import { ListIteratee, Many, sortBy, throttle } from "lodash";
|
|||
import { EventType, RoomType } from "matrix-js-sdk/src/@types/event";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { ISpaceSummaryRoom } from "matrix-js-sdk/src/@types/spaces";
|
||||
import { IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces";
|
||||
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
|
||||
import { IRoomCapability } from "matrix-js-sdk/src/client";
|
||||
|
||||
|
@ -64,7 +64,7 @@ export const UPDATE_SELECTED_SPACE = Symbol("selected-space");
|
|||
export const UPDATE_HOME_BEHAVIOUR = Symbol("home-behaviour");
|
||||
// Space Room ID/HOME_SPACE will be emitted when a Space's children change
|
||||
|
||||
export interface ISuggestedRoom extends ISpaceSummaryRoom {
|
||||
export interface ISuggestedRoom extends IHierarchyRoom {
|
||||
viaServers: string[];
|
||||
}
|
||||
|
||||
|
@ -303,18 +303,20 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
|
||||
public fetchSuggestedRooms = async (space: Room, limit = MAX_SUGGESTED_ROOMS): Promise<ISuggestedRoom[]> => {
|
||||
try {
|
||||
const data = await this.matrixClient.getSpaceSummary(space.roomId, 0, true, false, limit);
|
||||
const { rooms } = await this.matrixClient.getRoomHierarchy(space.roomId, limit, 1, true);
|
||||
|
||||
const viaMap = new EnhancedMap<string, Set<string>>();
|
||||
data.events.forEach(ev => {
|
||||
if (ev.type === EventType.SpaceChild && ev.content.via?.length) {
|
||||
ev.content.via.forEach(via => {
|
||||
viaMap.getOrCreate(ev.state_key, new Set()).add(via);
|
||||
});
|
||||
}
|
||||
rooms.forEach(room => {
|
||||
room.children_state.forEach(ev => {
|
||||
if (ev.type === EventType.SpaceChild && ev.content.via?.length) {
|
||||
ev.content.via.forEach(via => {
|
||||
viaMap.getOrCreate(ev.state_key, new Set()).add(via);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return data.rooms.filter(roomInfo => {
|
||||
return rooms.filter(roomInfo => {
|
||||
return roomInfo.room_type !== RoomType.Space
|
||||
&& this.matrixClient.getRoom(roomInfo.room_id)?.getMyMembership() !== "join";
|
||||
}).map(roomInfo => ({
|
||||
|
|
|
@ -137,6 +137,20 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
|
|||
if (edited && !this.roomMap.has(room.roomId)) {
|
||||
this.roomMap.set(room.roomId, roomInfo);
|
||||
}
|
||||
|
||||
// If a persistent widget is active, check to see if it's just been removed.
|
||||
// If it has, it needs to destroyed otherwise unmounting the node won't kill it
|
||||
const persistentWidgetId = ActiveWidgetStore.getPersistentWidgetId();
|
||||
if (persistentWidgetId) {
|
||||
if (
|
||||
ActiveWidgetStore.getRoomId(persistentWidgetId) === room.roomId &&
|
||||
!roomInfo.widgets.some(w => w.id === persistentWidgetId)
|
||||
) {
|
||||
console.log(`Persistent widget ${persistentWidgetId} removed from room ${room.roomId}: destroying.`);
|
||||
ActiveWidgetStore.destroyPersistentWidget(persistentWidgetId);
|
||||
}
|
||||
}
|
||||
|
||||
this.emit(room.roomId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue