Skip to content

Commit

Permalink
Revert "Merge branch 'pushrules' into levitating"
Browse files Browse the repository at this point in the history
This didn't work correctly, instead we will wait for cinnyapp#1988

This reverts commit 47e48e2, reversing
changes made to 62f4c2b.
  • Loading branch information
LevitatingBusinessMan committed Jan 29, 2025
1 parent 47e48e2 commit 617183b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/app/molecules/global-notification/GlobalNotification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function getTypeActions(type, highlightValue = false) {

function useGlobalNotif() {
const mx = useMatrixClient();
const pushRules = useAccountData('pushrules')?.getContent();
const pushRules = useAccountData('m.push_rules')?.getContent();
const underride = pushRules?.global?.underride ?? [];
const rulesToType = {
[DM]: notifType.ON,
Expand Down Expand Up @@ -93,7 +93,7 @@ function useGlobalNotif() {
}
ruleContent.actions = getTypeActions(type);

mx.setAccountData('pushrules', content);
mx.setAccountData('m.push_rules', content);
};

const dmRule = underride.find((rule) => rule.rule_id === DM);
Expand Down
8 changes: 4 additions & 4 deletions src/app/molecules/global-notification/KeywordNotification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const KEYWORD = 'keyword';

function useKeywordNotif() {
const mx = useMatrixClient();
const pushRules = useAccountData('pushrules')?.getContent();
const pushRules = useAccountData('m.push_rules')?.getContent();
const override = pushRules?.global?.override ?? [];
const content = pushRules?.global?.content ?? [];

Expand Down Expand Up @@ -92,7 +92,7 @@ function useKeywordNotif() {
});
}

mx.setAccountData('pushrules', evtContent);
mx.setAccountData('m.push_rules', evtContent);
};

const addKeyword = (keyword) => {
Expand All @@ -104,11 +104,11 @@ function useKeywordNotif() {
default: false,
actions: getTypeActions(rulesToType[KEYWORD] ?? notifType.NOISY, true),
});
mx.setAccountData('pushrules', pushRules);
mx.setAccountData('m.push_rules', pushRules);
};
const removeKeyword = (rule) => {
pushRules.global.content = content.filter((r) => r.rule_id !== rule.rule_id);
mx.setAccountData('pushrules', pushRules);
mx.setAccountData('m.push_rules', pushRules);
};

const dsRule = override.find((rule) => rule.rule_id === DISPLAY_NAME);
Expand Down
2 changes: 1 addition & 1 deletion src/app/state/room-list/mutedRoomList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const useBindMutedRoomsAtom = (mx: MatrixClient, mutedAtom: typeof mutedR
const setMuted = useSetAtom(mutedAtom);

useEffect(() => {
const overrideRules = mx.getAccountData('pushrules')?.getContent<IPushRules>()
const overrideRules = mx.getAccountData('m.push_rules')?.getContent<IPushRules>()
?.global?.override;
if (overrideRules) {
const mutedRooms = overrideRules.reduce<string[]>((rooms, rule) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const getNotificationType = (mx: MatrixClient, roomId: string): Notificat
}

if (!roomPushRule) {
const overrideRules = mx.getAccountData('pushrules')?.getContent<IPushRules>()
const overrideRules = mx.getAccountData('m.push_rules')?.getContent<IPushRules>()
?.global?.override;
if (!overrideRules) return NotificationType.Default;

Expand Down

0 comments on commit 617183b

Please sign in to comment.