You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Improve tsdoc types (#2940)
* Install eslint-plugin-jsdoc * Enable lint rule jsdoc/no-types * Make tsdoc more valid, add required hyphens and s/return/returns/g * Stash tsdoc work * Fix mistypes * Stash * Stash * More tsdoc work * Remove useless doc params * Fixup docs * Apply suggestions from code review Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Update src/crypto/verification/request/ToDeviceChannel.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Update src/client.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Update src/client.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Update src/client.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Iterate Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a9e7a46c56
commit
c4006d752a
@@ -14,10 +14,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module filter
|
||||
*/
|
||||
|
||||
import {
|
||||
EventType,
|
||||
RelationType,
|
||||
@@ -27,9 +23,6 @@ import { FilterComponent, IFilterComponent } from "./filter-component";
|
||||
import { MatrixEvent } from "./models/event";
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* @param {string} keyNesting
|
||||
* @param {*} val
|
||||
*/
|
||||
function setProp(obj: Record<string, any>, keyNesting: string, val: any): void {
|
||||
const nestedKeys = keyNesting.split(".") as [keyof typeof obj];
|
||||
@@ -78,14 +71,6 @@ interface IRoomFilter {
|
||||
}
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
/**
|
||||
* Construct a new Filter.
|
||||
* @constructor
|
||||
* @param {string} userId The user ID for this filter.
|
||||
* @param {string=} filterId The filter ID if known.
|
||||
* @prop {string} userId The user ID of the filter
|
||||
* @prop {?string} filterId The filter ID
|
||||
*/
|
||||
export class Filter {
|
||||
public static LAZY_LOADING_MESSAGES_FILTER = {
|
||||
lazy_load_members: true,
|
||||
@@ -93,11 +78,6 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Create a filter from existing data.
|
||||
* @static
|
||||
* @param {string} userId
|
||||
* @param {string} filterId
|
||||
* @param {Object} jsonObj
|
||||
* @return {Filter}
|
||||
*/
|
||||
public static fromJson(userId: string | undefined | null, filterId: string, jsonObj: IFilterDefinition): Filter {
|
||||
const filter = new Filter(userId, filterId);
|
||||
@@ -109,11 +89,16 @@ export class Filter {
|
||||
private roomFilter?: FilterComponent;
|
||||
private roomTimelineFilter?: FilterComponent;
|
||||
|
||||
/**
|
||||
* Construct a new Filter.
|
||||
* @param userId - The user ID for this filter.
|
||||
* @param filterId - The filter ID if known.
|
||||
*/
|
||||
public constructor(public readonly userId: string | undefined | null, public filterId?: string) {}
|
||||
|
||||
/**
|
||||
* Get the ID of this filter on your homeserver (if known)
|
||||
* @return {?string} The filter ID
|
||||
* @returns The filter ID
|
||||
*/
|
||||
public getFilterId(): string | undefined {
|
||||
return this.filterId;
|
||||
@@ -121,7 +106,7 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Get the JSON body of the filter.
|
||||
* @return {Object} The filter definition
|
||||
* @returns The filter definition
|
||||
*/
|
||||
public getDefinition(): IFilterDefinition {
|
||||
return this.definition;
|
||||
@@ -129,7 +114,7 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Set the JSON body of the filter
|
||||
* @param {Object} definition The filter definition
|
||||
* @param definition - The filter definition
|
||||
*/
|
||||
public setDefinition(definition: IFilterDefinition): void {
|
||||
this.definition = definition;
|
||||
@@ -198,7 +183,7 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Get the room.timeline filter component of the filter
|
||||
* @return {FilterComponent} room timeline filter component
|
||||
* @returns room timeline filter component
|
||||
*/
|
||||
public getRoomTimelineFilterComponent(): FilterComponent | undefined {
|
||||
return this.roomTimelineFilter;
|
||||
@@ -207,8 +192,8 @@ export class Filter {
|
||||
/**
|
||||
* Filter the list of events based on whether they are allowed in a timeline
|
||||
* based on this filter
|
||||
* @param {MatrixEvent[]} events the list of events being filtered
|
||||
* @return {MatrixEvent[]} the list of events which match the filter
|
||||
* @param events - the list of events being filtered
|
||||
* @returns the list of events which match the filter
|
||||
*/
|
||||
public filterRoomTimeline(events: MatrixEvent[]): MatrixEvent[] {
|
||||
if (this.roomFilter) {
|
||||
@@ -222,7 +207,7 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Set the max number of events to return for each room's timeline.
|
||||
* @param {Number} limit The max number of events to return for each room.
|
||||
* @param limit - The max number of events to return for each room.
|
||||
*/
|
||||
public setTimelineLimit(limit: number): void {
|
||||
setProp(this.definition, "room.timeline.limit", limit);
|
||||
@@ -230,7 +215,6 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Enable threads unread notification
|
||||
* @param {boolean} enabled
|
||||
*/
|
||||
public setUnreadThreadNotifications(enabled: boolean): void {
|
||||
this.definition = {
|
||||
@@ -251,7 +235,7 @@ export class Filter {
|
||||
|
||||
/**
|
||||
* Control whether left rooms should be included in responses.
|
||||
* @param {boolean} includeLeave True to make rooms the user has left appear
|
||||
* @param includeLeave - True to make rooms the user has left appear
|
||||
* in responses.
|
||||
*/
|
||||
public setIncludeLeaveRooms(includeLeave: boolean): void {
|
||||
|
||||
Reference in New Issue
Block a user