зеркало из
				https://github.com/iharh/notes.git
				synced 2025-11-02 22:56:09 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			89 строки
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			89 строки
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
https://github.com/matrix-org/matrix-react-sdk/pull/7339
 | 
						|
    https://github.com/matrix-org/matrix-react-sdk/commit/7fa27f583490a4a9bf0b5469fef6143bc5f5bc06
 | 
						|
https://github.com/matrix-org/matrix-react-sdk/pull/7372
 | 
						|
    !!! merged, 2022-03-15, /jumptodate slash command at "Settings->Labs"
 | 
						|
https://github.com/matrix-org/matrix-react-sdk/pull/7317
 | 
						|
    ?! closed ?! right after merging 7339
 | 
						|
https://github.com/matrix-org/matrix-js-sdk/pull/2072
 | 
						|
 | 
						|
https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.tsx#L349
 | 
						|
    "feature_jump_to_date": {
 | 
						|
        // We purposely leave out `isFeature: true` so it doesn't show in Labs
 | 
						|
        // by default. We will conditionally show it depending on whether we can
 | 
						|
        // detect MSC3030 support (see LabUserSettingsTab.tsx).
 | 
						|
        // labsGroup: LabGroup.Messaging,
 | 
						|
        displayName: _td("Jump to date (adds /jumptodate and jump to date headers)"),
 | 
						|
        supportedLevels: LEVELS_FEATURE,
 | 
						|
        default: false,
 | 
						|
    },
 | 
						|
https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx
 | 
						|
    @replaceableComponent("views.settings.tabs.user.LabsUserSettingsTab")
 | 
						|
    export default class LabsUserSettingsTab extends React.Component<{}, IState> {
 | 
						|
        constructor(props: {}) {
 | 
						|
            super(props);
 | 
						|
 | 
						|
            MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc2285").then((showHiddenReadReceipts) => {
 | 
						|
                this.setState({ showHiddenReadReceipts });
 | 
						|
            });
 | 
						|
 | 
						|
            MatrixClientPeg.get().doesServerSupportUnstableFeature("org.matrix.msc3030").then((showJumpToDate) => {
 | 
						|
                this.setState({ showJumpToDate });
 | 
						|
            });
 | 
						|
 | 
						|
            this.state = {
 | 
						|
                showHiddenReadReceipts: false,
 | 
						|
                showJumpToDate: false,
 | 
						|
            };
 | 
						|
        }
 | 
						|
        ...
 | 
						|
    }
 | 
						|
https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/MatrixClientPeg.ts
 | 
						|
    import { IStartClientOpts, MatrixClient } from 'matrix-js-sdk/src/client';
 | 
						|
    ...
 | 
						|
    public get(): MatrixClient {
 | 
						|
        return this.matrixClient;
 | 
						|
    }
 | 
						|
    ...
 | 
						|
https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/client.ts
 | 
						|
    ...
 | 
						|
   /**
 | 
						|
     * Query the server to see if it lists support for an unstable feature
 | 
						|
     * in the /versions response
 | 
						|
     * @param {string} feature the feature name
 | 
						|
     * @return {Promise<boolean>} true if the feature is supported
 | 
						|
     */
 | 
						|
    public async doesServerSupportUnstableFeature(feature: string): Promise<boolean> {
 | 
						|
        const response = await this.getVersions();
 | 
						|
        if (!response) return false;
 | 
						|
        const unstableFeatures = response["unstable_features"];
 | 
						|
        return unstableFeatures && !!unstableFeatures[feature];
 | 
						|
    }
 | 
						|
    ...
 | 
						|
   /**
 | 
						|
     * Get the API versions supported by the server, along with any
 | 
						|
     * unstable APIs it supports
 | 
						|
     * @return {Promise<object>} The server /versions response
 | 
						|
     */
 | 
						|
    public getVersions(): Promise<IServerVersions> {
 | 
						|
        if (this.serverVersionsPromise) {
 | 
						|
            return this.serverVersionsPromise;
 | 
						|
        }
 | 
						|
 | 
						|
        this.serverVersionsPromise = this.http.request<IServerVersions>(
 | 
						|
            undefined, // callback
 | 
						|
            Method.Get, "/_matrix/client/versions",
 | 
						|
            undefined, // queryParams
 | 
						|
            undefined, // data
 | 
						|
            {
 | 
						|
                prefix: '',
 | 
						|
            },
 | 
						|
        ).catch((e: Error) => {
 | 
						|
            // Need to unset this if it fails, otherwise we'll never retry
 | 
						|
            this.serverVersionsPromise = null;
 | 
						|
            // but rethrow the exception to anything that was waiting
 | 
						|
            throw e;
 | 
						|
        });
 | 
						|
 | 
						|
        return this.serverVersionsPromise;
 | 
						|
    }
 |