Revert unsafe rename and use boolean coercion

pull/21833/head
Jorik Schellekens 2020-07-21 10:29:05 +01:00
parent 6219e67a8a
commit be5db851ca
4 changed files with 21 additions and 16 deletions

View File

@ -40,6 +40,7 @@ module.exports = {
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
"quotes": "off", "quotes": "off",
"no-extra-boolean-cast": "off",
} }
}], }],
}; };

View File

@ -14,18 +14,21 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// The following interfaces take their names and member names from the js-sdk
/* eslint-disable camelcase */
export interface MatrixEvent { export interface MatrixEvent {
type: string; type: string;
sender: string; sender: string;
content: {}; content: {};
eventId: string; event_id: string;
originServerTs: number; origin_server_ts: number;
unsigned?: {}; unsigned?: {};
roomId: string; roomId: string;
} }
export interface MatrixProfile { export interface MatrixProfile {
avatarUrl: string; avatar_url: string;
displayname: string; displayname: string;
} }
@ -37,9 +40,9 @@ export interface CrawlerCheckpoint {
} }
export interface ResultContext { export interface ResultContext {
eventsBefore: [MatrixEvent]; events_before: [MatrixEvent];
eventsAfter: [MatrixEvent]; events_after: [MatrixEvent];
profileInfo: Map<string, MatrixProfile>; profile_info: Map<string, MatrixProfile>;
} }
export interface ResultsElement { export interface ResultsElement {
@ -55,11 +58,11 @@ export interface SearchResult {
} }
export interface SearchArgs { export interface SearchArgs {
searchTerm: string; search_term: string;
beforeLimit: number; before_limit: number;
afterLimit: number; after_limit: number;
orderByRecency: boolean; order_by_recency: boolean;
roomId?: string; room_id?: string;
} }
export interface EventAndProfile { export interface EventAndProfile {
@ -76,8 +79,8 @@ export interface LoadArgs {
export interface IndexStats { export interface IndexStats {
size: number; size: number;
eventCount: number; event_count: number;
roomCount: number; room_count: number;
} }
/** /**

View File

@ -382,7 +382,7 @@ export class Algorithm extends EventEmitter {
if (!this._stickyRoom) { if (!this._stickyRoom) {
// If there's no sticky room, just do nothing useful. // If there's no sticky room, just do nothing useful.
if (this._cachedStickyRooms) { if (!!this._cachedStickyRooms) {
// Clear the cache if we won't be needing it // Clear the cache if we won't be needing it
this._cachedStickyRooms = null; this._cachedStickyRooms = null;
this.emit(LIST_UPDATED_EVENT); this.emit(LIST_UPDATED_EVENT);

View File

@ -262,8 +262,9 @@ export class ImportanceAlgorithm extends OrderingAlgorithm {
if (indices[lastCat] > indices[thisCat]) { if (indices[lastCat] > indices[thisCat]) {
// "should never happen" disclaimer goes here // "should never happen" disclaimer goes here
// eslint-disable-next-line max-len console.warn(
console.warn(`!! Room list index corruption: ${lastCat} (i:${indices[lastCat]}) is greater than ${thisCat} (i:${indices[thisCat]}) - category indices are likely desynced from reality`); `!! Room list index corruption: ${lastCat} (i:${indices[lastCat]}) is greater ` +
`than ${thisCat} (i:${indices[thisCat]}) - category indices are likely desynced from reality`);
// TODO: Regenerate index when this happens: https://github.com/vector-im/riot-web/issues/14234 // TODO: Regenerate index when this happens: https://github.com/vector-im/riot-web/issues/14234
} }