Fix js-sdk types (#8588)
This commit is contained in:
parent
1fc8009109
commit
6453530993
2 changed files with 13 additions and 7 deletions
|
@ -17,7 +17,13 @@ limitations under the License.
|
||||||
|
|
||||||
import { PushProcessor } from 'matrix-js-sdk/src/pushprocessor';
|
import { PushProcessor } from 'matrix-js-sdk/src/pushprocessor';
|
||||||
import { NotificationCountType, Room } from "matrix-js-sdk/src/models/room";
|
import { NotificationCountType, Room } from "matrix-js-sdk/src/models/room";
|
||||||
import { ConditionKind, IPushRule, PushRuleActionName, PushRuleKind } from "matrix-js-sdk/src/@types/PushRules";
|
import {
|
||||||
|
ConditionKind,
|
||||||
|
IPushRule,
|
||||||
|
PushRuleActionName,
|
||||||
|
PushRuleKind,
|
||||||
|
TweakName,
|
||||||
|
} from "matrix-js-sdk/src/@types/PushRules";
|
||||||
import { EventType } from 'matrix-js-sdk/src/@types/event';
|
import { EventType } from 'matrix-js-sdk/src/@types/event';
|
||||||
|
|
||||||
import { MatrixClientPeg } from './MatrixClientPeg';
|
import { MatrixClientPeg } from './MatrixClientPeg';
|
||||||
|
@ -144,13 +150,13 @@ function setRoomNotifsStateMuted(roomId: string): Promise<any> {
|
||||||
promises.push(cli.addPushRule('global', PushRuleKind.Override, roomId, {
|
promises.push(cli.addPushRule('global', PushRuleKind.Override, roomId, {
|
||||||
conditions: [
|
conditions: [
|
||||||
{
|
{
|
||||||
kind: 'event_match',
|
kind: ConditionKind.EventMatch,
|
||||||
key: 'room_id',
|
key: 'room_id',
|
||||||
pattern: roomId,
|
pattern: roomId,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
'dont_notify',
|
PushRuleActionName.DontNotify,
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -174,7 +180,7 @@ function setRoomNotifsStateUnmuted(roomId: string, newState: RoomNotifState): Pr
|
||||||
} else if (newState === RoomNotifState.MentionsOnly) {
|
} else if (newState === RoomNotifState.MentionsOnly) {
|
||||||
promises.push(cli.addPushRule('global', PushRuleKind.RoomSpecific, roomId, {
|
promises.push(cli.addPushRule('global', PushRuleKind.RoomSpecific, roomId, {
|
||||||
actions: [
|
actions: [
|
||||||
'dont_notify',
|
PushRuleActionName.DontNotify,
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
// https://matrix.org/jira/browse/SPEC-400
|
// https://matrix.org/jira/browse/SPEC-400
|
||||||
|
@ -182,9 +188,9 @@ function setRoomNotifsStateUnmuted(roomId: string, newState: RoomNotifState): Pr
|
||||||
} else if (newState === RoomNotifState.AllMessagesLoud) {
|
} else if (newState === RoomNotifState.AllMessagesLoud) {
|
||||||
promises.push(cli.addPushRule('global', PushRuleKind.RoomSpecific, roomId, {
|
promises.push(cli.addPushRule('global', PushRuleKind.RoomSpecific, roomId, {
|
||||||
actions: [
|
actions: [
|
||||||
'notify',
|
PushRuleActionName.Notify,
|
||||||
{
|
{
|
||||||
set_tweak: 'sound',
|
set_tweak: TweakName.Sound,
|
||||||
value: 'default',
|
value: 'default',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -79,7 +79,7 @@ describe("RoomNotifs test", () => {
|
||||||
rule_id: "!roomId:server",
|
rule_id: "!roomId:server",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
default: false,
|
default: false,
|
||||||
actions: [{ set_tweak: TweakName.Sound }],
|
actions: [{ set_tweak: TweakName.Sound, value: "default" }],
|
||||||
});
|
});
|
||||||
expect(getRoomNotifsState("!roomId:server")).toBe(RoomNotifState.AllMessagesLoud);
|
expect(getRoomNotifsState("!roomId:server")).toBe(RoomNotifState.AllMessagesLoud);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue