You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Make the js-sdk conform to tsc --strict (#2835)
Co-authored-by: Faye Duxovni <fayed@matrix.org>
This commit is contained in:
committed by
GitHub
parent
42b08eca57
commit
db49cd8d13
@@ -219,8 +219,11 @@ export class PushProcessor {
|
||||
return null;
|
||||
}
|
||||
|
||||
private templateRuleToRaw(kind: PushRuleKind, tprule: any): any {
|
||||
const rawrule = {
|
||||
private templateRuleToRaw(
|
||||
kind: PushRuleKind,
|
||||
tprule: IPushRule,
|
||||
): Pick<IPushRule, "rule_id" | "actions" | "conditions"> | null {
|
||||
const rawrule: Pick<IPushRule, "rule_id" | "actions" | "conditions"> = {
|
||||
'rule_id': tprule.rule_id,
|
||||
'actions': tprule.actions,
|
||||
'conditions': [],
|
||||
@@ -234,7 +237,7 @@ export class PushProcessor {
|
||||
if (!tprule.rule_id) {
|
||||
return null;
|
||||
}
|
||||
rawrule.conditions.push({
|
||||
rawrule.conditions!.push({
|
||||
'kind': ConditionKind.EventMatch,
|
||||
'key': 'room_id',
|
||||
'value': tprule.rule_id,
|
||||
@@ -244,7 +247,7 @@ export class PushProcessor {
|
||||
if (!tprule.rule_id) {
|
||||
return null;
|
||||
}
|
||||
rawrule.conditions.push({
|
||||
rawrule.conditions!.push({
|
||||
'kind': ConditionKind.EventMatch,
|
||||
'key': 'user_id',
|
||||
'value': tprule.rule_id,
|
||||
@@ -254,7 +257,7 @@ export class PushProcessor {
|
||||
if (!tprule.pattern) {
|
||||
return null;
|
||||
}
|
||||
rawrule.conditions.push({
|
||||
rawrule.conditions!.push({
|
||||
'kind': ConditionKind.EventMatch,
|
||||
'key': 'content.body',
|
||||
'pattern': tprule.pattern,
|
||||
@@ -474,7 +477,7 @@ export class PushProcessor {
|
||||
return actionObj;
|
||||
}
|
||||
|
||||
public ruleMatchesEvent(rule: IPushRule, ev: MatrixEvent): boolean {
|
||||
public ruleMatchesEvent(rule: Partial<IPushRule> & Pick<IPushRule, "conditions">, ev: MatrixEvent): boolean {
|
||||
if (!rule.conditions?.length) return true;
|
||||
|
||||
let ret = true;
|
||||
|
Reference in New Issue
Block a user