events: Remove PartialEq impl on NotificationPowerLevels
This commit is contained in:
parent
74423b7a4e
commit
b1cb6cd4c0
@ -3,6 +3,7 @@
|
|||||||
Breaking changes:
|
Breaking changes:
|
||||||
|
|
||||||
* Add `user_id` field to `PushConditionRoomCtx`
|
* Add `user_id` field to `PushConditionRoomCtx`
|
||||||
|
* Remove `PartialEq` implementation on `NotificationPowerLevels`
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ pub struct RoomPowerLevelsEventContent {
|
|||||||
/// The power level requirements for specific notification types.
|
/// The power level requirements for specific notification types.
|
||||||
///
|
///
|
||||||
/// This is a mapping from `key` to power level for that notifications key.
|
/// 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,
|
pub notifications: NotificationPowerLevels,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use js_int::{int, Int};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// The power level requirements for specific notification types.
|
/// 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)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct NotificationPowerLevels {
|
pub struct NotificationPowerLevels {
|
||||||
/// The level required to trigger an `@room` notification.
|
/// The level required to trigger an `@room` notification.
|
||||||
@ -34,6 +34,10 @@ impl NotificationPowerLevels {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn is_default(&self) -> bool {
|
||||||
|
self.room == default_power_level()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for NotificationPowerLevels {
|
impl Default for NotificationPowerLevels {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user