Skip to main content

zulip_api/message/channel_permission/
can_delete_own_message_group.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{impl_cow, GroupSetting};
4
5/// Represents a group-setting value defining the set of users who have permission to delete the messages that they have sent in the channel.
6///
7/// `update-group-setting`: Note that a user must `have content access` to a channel in order to delete their own message in the channel.
8///
9/// Users with permission to delete any message in the channel and users present in the organization-level `can_delete_own_message_group` setting can always delete their own messages in the channel if they `have content access` to that channel.
10///
11/// **Changes**: New in Zulip 11.0 (feature level 407). Prior to this change, only the users in the organization-level `can_delete_any_message_group` and `can_delete_own_message_group` settings were able delete their own messages in the organization.
12#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
13pub struct CanDeleteOwnMessageGroup(pub GroupSetting);
14
15impl CanDeleteOwnMessageGroup {
16    /// Creates a new [Self].
17    pub const fn new() -> Self {
18        Self(GroupSetting::new())
19    }
20
21    /// Converts the inner representation into a [Self].
22    pub const fn from_inner(val: GroupSetting) -> Self {
23        Self(val)
24    }
25
26    /// Converts the [Self] into the inner representation.
27    pub fn into_inner(self) -> GroupSetting {
28        self.0
29    }
30}
31
32impl Default for CanDeleteOwnMessageGroup {
33    fn default() -> Self {
34        Self::new()
35    }
36}
37
38impl_cow!(CanDeleteOwnMessageGroup);