push: Update poll push rules
According to MSC3930
This commit is contained in:
parent
33f7df8bf2
commit
c12f2f4002
@ -27,7 +27,7 @@ js = ["dep:js-sys", "getrandom?/js", "uuid?/js"]
|
|||||||
rand = ["dep:rand", "dep:uuid"]
|
rand = ["dep:rand", "dep:uuid"]
|
||||||
unstable-exhaustive-types = []
|
unstable-exhaustive-types = []
|
||||||
unstable-msc2870 = []
|
unstable-msc2870 = []
|
||||||
unstable-msc3381 = []
|
unstable-msc3930 = []
|
||||||
unstable-msc3931 = []
|
unstable-msc3931 = []
|
||||||
unstable-msc3932 = ["unstable-msc3931"]
|
unstable-msc3932 = ["unstable-msc3931"]
|
||||||
unstable-msc3958 = []
|
unstable-msc3958 = []
|
||||||
|
@ -42,6 +42,8 @@ impl Ruleset {
|
|||||||
ConditionalPushRule::server_acl(),
|
ConditionalPushRule::server_acl(),
|
||||||
#[cfg(feature = "unstable-msc3958")]
|
#[cfg(feature = "unstable-msc3958")]
|
||||||
ConditionalPushRule::suppress_edits(),
|
ConditionalPushRule::suppress_edits(),
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
ConditionalPushRule::poll_response(),
|
||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
underride: [
|
underride: [
|
||||||
@ -50,13 +52,13 @@ impl Ruleset {
|
|||||||
ConditionalPushRule::room_one_to_one(),
|
ConditionalPushRule::room_one_to_one(),
|
||||||
ConditionalPushRule::message(),
|
ConditionalPushRule::message(),
|
||||||
ConditionalPushRule::encrypted(),
|
ConditionalPushRule::encrypted(),
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
ConditionalPushRule::poll_start_one_to_one(),
|
ConditionalPushRule::poll_start_one_to_one(),
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
ConditionalPushRule::poll_start(),
|
ConditionalPushRule::poll_start(),
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
ConditionalPushRule::poll_end_one_to_one(),
|
ConditionalPushRule::poll_end_one_to_one(),
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
ConditionalPushRule::poll_end(),
|
ConditionalPushRule::poll_end(),
|
||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
@ -325,6 +327,26 @@ impl ConditionalPushRule {
|
|||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Matches a poll response event sent in any room.
|
||||||
|
///
|
||||||
|
/// This rule uses the unstable prefixes defined in [MSC3381] and [MSC3930].
|
||||||
|
///
|
||||||
|
/// [MSC3381]: https://github.com/matrix-org/matrix-spec-proposals/pull/3381
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
pub fn poll_response() -> Self {
|
||||||
|
Self {
|
||||||
|
rule_id: PredefinedOverrideRuleId::PollResponse.to_string(),
|
||||||
|
default: true,
|
||||||
|
enabled: true,
|
||||||
|
conditions: vec![EventPropertyIs {
|
||||||
|
key: "type".to_owned(),
|
||||||
|
value: "org.matrix.msc3381.poll.response".into(),
|
||||||
|
}],
|
||||||
|
actions: vec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default content push rules
|
/// Default content push rules
|
||||||
@ -436,8 +458,11 @@ impl ConditionalPushRule {
|
|||||||
|
|
||||||
/// Matches a poll start event sent in a room with exactly two members.
|
/// Matches a poll start event sent in a room with exactly two members.
|
||||||
///
|
///
|
||||||
/// This rule should be kept in sync with `.m.rule.room_one_to_one` by the server.
|
/// This rule uses the unstable prefixes defined in [MSC3381] and [MSC3930].
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// [MSC3381]: https://github.com/matrix-org/matrix-spec-proposals/pull/3381
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
pub fn poll_start_one_to_one() -> Self {
|
pub fn poll_start_one_to_one() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: PredefinedUnderrideRuleId::PollStartOneToOne.to_string(),
|
rule_id: PredefinedUnderrideRuleId::PollStartOneToOne.to_string(),
|
||||||
@ -445,7 +470,10 @@ impl ConditionalPushRule {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
conditions: vec![
|
conditions: vec![
|
||||||
RoomMemberCount { is: RoomMemberCountIs::from(js_int::uint!(2)) },
|
RoomMemberCount { is: RoomMemberCountIs::from(js_int::uint!(2)) },
|
||||||
EventMatch { key: "type".into(), pattern: "m.poll.start".into() },
|
EventPropertyIs {
|
||||||
|
key: "type".to_owned(),
|
||||||
|
value: "org.matrix.msc3381.poll.start".into(),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
actions: vec![Notify, SetTweak(Tweak::Sound("default".into()))],
|
actions: vec![Notify, SetTweak(Tweak::Sound("default".into()))],
|
||||||
}
|
}
|
||||||
@ -453,22 +481,31 @@ impl ConditionalPushRule {
|
|||||||
|
|
||||||
/// Matches a poll start event sent in any room.
|
/// Matches a poll start event sent in any room.
|
||||||
///
|
///
|
||||||
/// This rule should be kept in sync with `.m.rule.message` by the server.
|
/// This rule uses the unstable prefixes defined in [MSC3381] and [MSC3930].
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// [MSC3381]: https://github.com/matrix-org/matrix-spec-proposals/pull/3381
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
pub fn poll_start() -> Self {
|
pub fn poll_start() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: PredefinedUnderrideRuleId::PollStart.to_string(),
|
rule_id: PredefinedUnderrideRuleId::PollStart.to_string(),
|
||||||
default: true,
|
default: true,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
conditions: vec![EventMatch { key: "type".into(), pattern: "m.poll.start".into() }],
|
conditions: vec![EventPropertyIs {
|
||||||
|
key: "type".to_owned(),
|
||||||
|
value: "org.matrix.msc3381.poll.start".into(),
|
||||||
|
}],
|
||||||
actions: vec![Notify],
|
actions: vec![Notify],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches a poll end event sent in a room with exactly two members.
|
/// Matches a poll end event sent in a room with exactly two members.
|
||||||
///
|
///
|
||||||
/// This rule should be kept in sync with `.m.rule.room_one_to_one` by the server.
|
/// This rule uses the unstable prefixes defined in [MSC3381] and [MSC3930].
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// [MSC3381]: https://github.com/matrix-org/matrix-spec-proposals/pull/3381
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
pub fn poll_end_one_to_one() -> Self {
|
pub fn poll_end_one_to_one() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: PredefinedUnderrideRuleId::PollEndOneToOne.to_string(),
|
rule_id: PredefinedUnderrideRuleId::PollEndOneToOne.to_string(),
|
||||||
@ -476,7 +513,10 @@ impl ConditionalPushRule {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
conditions: vec![
|
conditions: vec![
|
||||||
RoomMemberCount { is: RoomMemberCountIs::from(js_int::uint!(2)) },
|
RoomMemberCount { is: RoomMemberCountIs::from(js_int::uint!(2)) },
|
||||||
EventMatch { key: "type".into(), pattern: "m.poll.end".into() },
|
EventPropertyIs {
|
||||||
|
key: "type".to_owned(),
|
||||||
|
value: "org.matrix.msc3381.poll.end".into(),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
actions: vec![Notify, SetTweak(Tweak::Sound("default".into()))],
|
actions: vec![Notify, SetTweak(Tweak::Sound("default".into()))],
|
||||||
}
|
}
|
||||||
@ -484,14 +524,20 @@ impl ConditionalPushRule {
|
|||||||
|
|
||||||
/// Matches a poll end event sent in any room.
|
/// Matches a poll end event sent in any room.
|
||||||
///
|
///
|
||||||
/// This rule should be kept in sync with `.m.rule.message` by the server.
|
/// This rule uses the unstable prefixes defined in [MSC3381] and [MSC3930].
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// [MSC3381]: https://github.com/matrix-org/matrix-spec-proposals/pull/3381
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
pub fn poll_end() -> Self {
|
pub fn poll_end() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: PredefinedUnderrideRuleId::PollEnd.to_string(),
|
rule_id: PredefinedUnderrideRuleId::PollEnd.to_string(),
|
||||||
default: true,
|
default: true,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
conditions: vec![EventMatch { key: "type".into(), pattern: "m.poll.end".into() }],
|
conditions: vec![EventPropertyIs {
|
||||||
|
key: "type".to_owned(),
|
||||||
|
value: "org.matrix.msc3381.poll.end".into(),
|
||||||
|
}],
|
||||||
actions: vec![Notify],
|
actions: vec![Notify],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -559,6 +605,15 @@ pub enum PredefinedOverrideRuleId {
|
|||||||
#[ruma_enum(rename = ".org.matrix.msc3958.suppress_edits")]
|
#[ruma_enum(rename = ".org.matrix.msc3958.suppress_edits")]
|
||||||
SuppressEdits,
|
SuppressEdits,
|
||||||
|
|
||||||
|
/// `.m.rule.poll_response`
|
||||||
|
///
|
||||||
|
/// This uses the unstable prefix defined in [MSC3930].
|
||||||
|
///
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
#[ruma_enum(rename = ".org.matrix.msc3930.poll_response")]
|
||||||
|
PollResponse,
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
_Custom(PrivOwnedStr),
|
_Custom(PrivOwnedStr),
|
||||||
}
|
}
|
||||||
@ -585,19 +640,39 @@ pub enum PredefinedUnderrideRuleId {
|
|||||||
Encrypted,
|
Encrypted,
|
||||||
|
|
||||||
/// `.m.rule.poll_start_one_to_one`
|
/// `.m.rule.poll_start_one_to_one`
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// This uses the unstable prefix defined in [MSC3930].
|
||||||
|
///
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
#[ruma_enum(rename = ".org.matrix.msc3930.poll_start_one_to_one")]
|
||||||
PollStartOneToOne,
|
PollStartOneToOne,
|
||||||
|
|
||||||
/// `.m.rule.poll_start`
|
/// `.m.rule.poll_start`
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// This uses the unstable prefix defined in [MSC3930].
|
||||||
|
///
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
#[ruma_enum(rename = ".org.matrix.msc3930.poll_start")]
|
||||||
PollStart,
|
PollStart,
|
||||||
|
|
||||||
/// `.m.rule.poll_end_one_to_one`
|
/// `.m.rule.poll_end_one_to_one`
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// This uses the unstable prefix defined in [MSC3930].
|
||||||
|
///
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
#[ruma_enum(rename = ".org.matrix.msc3930.poll_end_one_to_one")]
|
||||||
PollEndOneToOne,
|
PollEndOneToOne,
|
||||||
|
|
||||||
/// `.m.rule.poll_end`
|
/// `.m.rule.poll_end`
|
||||||
#[cfg(feature = "unstable-msc3381")]
|
///
|
||||||
|
/// This uses the unstable prefix defined in [MSC3930].
|
||||||
|
///
|
||||||
|
/// [MSC3930]: https://github.com/matrix-org/matrix-spec-proposals/pull/3930
|
||||||
|
#[cfg(feature = "unstable-msc3930")]
|
||||||
|
#[ruma_enum(rename = ".org.matrix.msc3930.poll_end")]
|
||||||
PollEnd,
|
PollEnd,
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -193,7 +193,7 @@ unstable-msc3245 = ["ruma-events?/unstable-msc3245"]
|
|||||||
# https://github.com/matrix-org/matrix-spec-proposals/blob/83f6c5b469c1d78f714e335dcaa25354b255ffa5/proposals/3245-voice-messages.md
|
# https://github.com/matrix-org/matrix-spec-proposals/blob/83f6c5b469c1d78f714e335dcaa25354b255ffa5/proposals/3245-voice-messages.md
|
||||||
unstable-msc3245-v1-compat = ["ruma-events?/unstable-msc3245-v1-compat"]
|
unstable-msc3245-v1-compat = ["ruma-events?/unstable-msc3245-v1-compat"]
|
||||||
unstable-msc3246 = ["ruma-events?/unstable-msc3246"]
|
unstable-msc3246 = ["ruma-events?/unstable-msc3246"]
|
||||||
unstable-msc3381 = ["ruma-common/unstable-msc3381", "ruma-events?/unstable-msc3381"]
|
unstable-msc3381 = ["ruma-events?/unstable-msc3381"]
|
||||||
unstable-msc3488 = ["ruma-client-api?/unstable-msc3488", "ruma-events?/unstable-msc3488"]
|
unstable-msc3488 = ["ruma-client-api?/unstable-msc3488", "ruma-events?/unstable-msc3488"]
|
||||||
unstable-msc3551 = ["ruma-events?/unstable-msc3551"]
|
unstable-msc3551 = ["ruma-events?/unstable-msc3551"]
|
||||||
unstable-msc3552 = ["ruma-events?/unstable-msc3552"]
|
unstable-msc3552 = ["ruma-events?/unstable-msc3552"]
|
||||||
@ -204,6 +204,7 @@ unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
|
|||||||
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
|
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
|
||||||
unstable-msc3814 = ["ruma-client-api?/unstable-msc3814"]
|
unstable-msc3814 = ["ruma-client-api?/unstable-msc3814"]
|
||||||
unstable-msc3927 = ["ruma-events?/unstable-msc3927"]
|
unstable-msc3927 = ["ruma-events?/unstable-msc3927"]
|
||||||
|
unstable-msc3930 = ["ruma-common/unstable-msc3930"]
|
||||||
unstable-msc3931 = ["ruma-common/unstable-msc3931"]
|
unstable-msc3931 = ["ruma-common/unstable-msc3931"]
|
||||||
unstable-msc3932 = ["ruma-common/unstable-msc3932"]
|
unstable-msc3932 = ["ruma-common/unstable-msc3932"]
|
||||||
unstable-msc3954 = ["ruma-events?/unstable-msc3954"]
|
unstable-msc3954 = ["ruma-events?/unstable-msc3954"]
|
||||||
@ -246,6 +247,7 @@ __ci = [
|
|||||||
"unstable-msc3723",
|
"unstable-msc3723",
|
||||||
"unstable-msc3814",
|
"unstable-msc3814",
|
||||||
"unstable-msc3927",
|
"unstable-msc3927",
|
||||||
|
"unstable-msc3930",
|
||||||
"unstable-msc3932",
|
"unstable-msc3932",
|
||||||
"unstable-msc3954",
|
"unstable-msc3954",
|
||||||
"unstable-msc3955",
|
"unstable-msc3955",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user