Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Implement push notification toggle in device detail #9308

Merged
merged 19 commits into from
Sep 27, 2022

Conversation

germain-gg
Copy link
Contributor

@germain-gg germain-gg commented Sep 22, 2022

Implements the UI side of matrix-org/matrix-spec-proposals#3881
Fixes https://element-io.atlassian.net/browse/PSG-708

Screen Shot 2022-09-22 at 16 07 59

Acceptance criterias:

  • Pushers are loaded with device list GET /_matrix/client/v3/pushers
  • For devices with a related pusher, the push notification toggle is displayed in the session overview screen
  • For devices without a related pusher, the push notifications section is not displayed
  • Toggling the toggle sets the enabled property on the Pusher using POST /_matrix/client/v3/pushers/set
  • any pusher without an enabled field should be treated as if enabled is false
  • When there is no server support for setting is_disabled (see /versions response), the toggle should be disabled

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Here's what your changelog entry will look like:

✨ Features

  • Implement push notification toggle in device detail (#9308).

@germain-gg germain-gg added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Sep 22, 2022
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally this seems fine, though the quality gate wants more tests

src/components/views/settings/devices/DeviceDetails.tsx Outdated Show resolved Hide resolved
Comment on lines 208 to 210
function getPusherForDevice(device: DeviceWithVerification): IPusher | null {
return pushers.find(pusher => pusher[PUSHER_DEVICE_ID.name] === device.device_id);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function getPusherForDevice(device: DeviceWithVerification): IPusher | null {
return pushers.find(pusher => pusher[PUSHER_DEVICE_ID.name] === device.device_id);
}
const getPusherForDevice = (device: DeviceWithVerification): IPusher | null => {
return pushers.find(pusher => pusher[PUSHER_DEVICE_ID.name] === device.device_id);
};

I'm paranoid about scope changing randomly on us

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the rationale behind this change.
This function, overall declared will be scoped to the function it's declared in. Using const will scope it to the block it's declared in...
It's the whole concept of closures and sounds more like a stylistic preference

Germain and others added 3 commits September 27, 2022 08:37
Co-authored-by: Travis Ralston <travisr@matrix.org>
Co-authored-by: Travis Ralston <travisr@matrix.org>
Co-authored-by: Travis Ralston <travisr@matrix.org>
Germain Souquet added 2 commits September 27, 2022 09:41
@germain-gg germain-gg merged commit 641cf28 into develop Sep 27, 2022
@germain-gg germain-gg deleted the gsouquet/pusher-ui-psg-708 branch September 27, 2022 12:35
odelcroi added a commit to tchapgouv/tchap-web-v4 that referenced this pull request Oct 5, 2022
* Device manager - select all devices ([\#9330](matrix-org/matrix-react-sdk#9330)). Contributed by @kerryarchibald.
* New group call experience: Call tiles ([\#9332](matrix-org/matrix-react-sdk#9332)).
* Add Shift key to FormatQuote keyboard shortcut ([\#9298](matrix-org/matrix-react-sdk#9298)). Contributed by @owi92.
* Device manager - sign out of multiple sessions ([\#9325](matrix-org/matrix-react-sdk#9325)). Contributed by @kerryarchibald.
* Display push toggle for web sessions (MSC3890) ([\#9327](matrix-org/matrix-react-sdk#9327)).
* Add device notifications enabled switch ([\#9324](matrix-org/matrix-react-sdk#9324)).
* Implement push notification toggle in device detail ([\#9308](matrix-org/matrix-react-sdk#9308)).
* New group call experience: Starting and ending calls ([\#9318](matrix-org/matrix-react-sdk#9318)).
* New group call experience: Room header call buttons ([\#9311](matrix-org/matrix-react-sdk#9311)).
* Make device ID copyable in device list ([\#9297](matrix-org/matrix-react-sdk#9297)). Contributed by @duxovni.
* Use display name instead of user ID when rendering power events ([\#9295](matrix-org/matrix-react-sdk#9295)).
* Read receipts for threads ([\#9239](matrix-org/matrix-react-sdk#9239)). Fixes #23191.
* Fix device selection in pre-join screen for Element Call video rooms ([\#9321](matrix-org/matrix-react-sdk#9321)). Fixes #23331.
* Don't render a 1px high room topic if the room topic is empty ([\#9317](matrix-org/matrix-react-sdk#9317)). Contributed by @Arnei.
* Don't show feedback prompts when that UIFeature is disabled ([\#9305](matrix-org/matrix-react-sdk#9305)). Fixes #23327.
* Fix soft crash around unknown room pills ([\#9301](matrix-org/matrix-react-sdk#9301)). Fixes matrix-org/element-web-rageshakes#15465.
* Fix spaces feedback prompt wrongly showing when feedback is disabled ([\#9302](matrix-org/matrix-react-sdk#9302)). Fixes #23314.
* Fix tile soft crash in ReplyInThreadButton ([\#9300](matrix-org/matrix-react-sdk#9300)). Fixes matrix-org/element-web-rageshakes#15493.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants