Revert unsafe rename and use boolean coercion

This commit is contained in:
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",
"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.
*/
// The following interfaces take their names and member names from the js-sdk
/* eslint-disable camelcase */
export interface MatrixEvent {
type: string;
sender: string;
content: {};
eventId: string;
originServerTs: number;
event_id: string;
origin_server_ts: number;
unsigned?: {};
roomId: string;
}
export interface MatrixProfile {
avatarUrl: string;
avatar_url: string;
displayname: string;
}
@ -37,9 +40,9 @@ export interface CrawlerCheckpoint {
}
export interface ResultContext {
eventsBefore: [MatrixEvent];
eventsAfter: [MatrixEvent];
profileInfo: Map<string, MatrixProfile>;
events_before: [MatrixEvent];
events_after: [MatrixEvent];
profile_info: Map<string, MatrixProfile>;
}
export interface ResultsElement {
@ -55,11 +58,11 @@ export interface SearchResult {
}
export interface SearchArgs {
searchTerm: string;
beforeLimit: number;
afterLimit: number;
orderByRecency: boolean;
roomId?: string;
search_term: string;
before_limit: number;
after_limit: number;
order_by_recency: boolean;
room_id?: string;
}
export interface EventAndProfile {
@ -76,8 +79,8 @@ export interface LoadArgs {
export interface IndexStats {
size: number;
eventCount: number;
roomCount: number;
event_count: number;
room_count: number;
}
/**

View File

@ -382,7 +382,7 @@ export class Algorithm extends EventEmitter {
if (!this._stickyRoom) {
// 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
this._cachedStickyRooms = null;
this.emit(LIST_UPDATED_EVENT);

View File

@ -262,8 +262,9 @@ export class ImportanceAlgorithm extends OrderingAlgorithm {
if (indices[lastCat] > indices[thisCat]) {
// "should never happen" disclaimer goes here
// eslint-disable-next-line max-len
console.warn(`!! Room list index corruption: ${lastCat} (i:${indices[lastCat]}) is greater than ${thisCat} (i:${indices[thisCat]}) - category indices are likely desynced from reality`);
console.warn(
`!! 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
}