You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	Factor-out GroupStore and create GroupStoreCache
In order to provide feedback when adding a room to a group, the group summarry store needs to be extended to store the list of rooms in a group. This commit is the first step required. The next step is to get the GroupRoomList listening to updates from GroupStore and expose the list of rooms from GroupStore. (We're running out of words to describe the hierachy of things that store things)
This commit is contained in:
		@@ -19,6 +19,7 @@ import sdk from './';
 | 
			
		||||
import MultiInviter from './utils/MultiInviter';
 | 
			
		||||
import { _t } from './languageHandler';
 | 
			
		||||
import MatrixClientPeg from './MatrixClientPeg';
 | 
			
		||||
import GroupStoreCache from './stores/GroupStoreCache';
 | 
			
		||||
 | 
			
		||||
export function showGroupInviteDialog(groupId) {
 | 
			
		||||
    const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog");
 | 
			
		||||
@@ -86,10 +87,11 @@ function _onGroupInviteFinished(groupId, addrs) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function _onGroupAddRoomFinished(groupId, addrs) {
 | 
			
		||||
    const groupStore = GroupStoreCache.getGroupStore(MatrixClientPeg.get(), groupId);
 | 
			
		||||
    const errorList = [];
 | 
			
		||||
    return Promise.all(addrs.map((addr) => {
 | 
			
		||||
        return MatrixClientPeg.get()
 | 
			
		||||
            .addRoomToGroup(groupId, addr.address)
 | 
			
		||||
        return groupStore
 | 
			
		||||
            .addRoomToGroup(addr.address)
 | 
			
		||||
            .catch(() => { errorList.push(addr.address); })
 | 
			
		||||
            .reflect();
 | 
			
		||||
    })).then(() => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user