events: Remove PartialEq impl on NotificationPowerLevels

This commit is contained in:
Jonas Platte 2022-05-23 18:24:58 +02:00
parent 74423b7a4e
commit b1cb6cd4c0
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
3 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@
Breaking changes:
* Add `user_id` field to `PushConditionRoomCtx`
* Remove `PartialEq` implementation on `NotificationPowerLevels`
Improvements:

View File

@ -135,7 +135,7 @@ pub struct RoomPowerLevelsEventContent {
/// The power level requirements for specific notification types.
///
/// This is a mapping from `key` to power level for that notifications key.
#[serde(default, skip_serializing_if = "crate::serde::is_default")]
#[serde(default, skip_serializing_if = "NotificationPowerLevels::is_default")]
pub notifications: NotificationPowerLevels,
}

View File

@ -6,7 +6,7 @@ use js_int::{int, Int};
use serde::{Deserialize, Serialize};
/// The power level requirements for specific notification types.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct NotificationPowerLevels {
/// The level required to trigger an `@room` notification.
@ -34,6 +34,10 @@ impl NotificationPowerLevels {
_ => None,
}
}
pub(crate) fn is_default(&self) -> bool {
self.room == default_power_level()
}
}
impl Default for NotificationPowerLevels {