Skip to content

Commit

Permalink
Restrict SlackHeaderBlock to accept plan text only block (#273)
Browse files Browse the repository at this point in the history
* Restrict SlackHeaderBlock to accept plan text only block

* Fix new cargo clippy warnings
  • Loading branch information
abdolence authored May 15, 2024
1 parent e1ab878 commit b03c088
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/api/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ pub struct SlackApiFilesUploadResponse {
pub file: SlackFile,
}

fn to_csv<S: Serializer>(x: &Option<Vec<SlackChannelId>>, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
fn to_csv<S: Serializer>(x: &Option<Vec<SlackChannelId>>, s: S) -> Result<S::Ok, S::Error> {
match x {
None => s.serialize_none(),
Some(ids) => {
Expand Down
1 change: 1 addition & 0 deletions src/models/blocks/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub enum SlackDateTimeFormats {
TimeSecs,
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackDateTimeFormats {
fn to_string(&self) -> String {
match self {
Expand Down
6 changes: 3 additions & 3 deletions src/models/blocks/kit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl From<SlackSectionBlock> for SlackBlock {
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackHeaderBlock {
pub block_id: Option<SlackBlockId>,
pub text: SlackBlockText,
pub text: SlackBlockPlainTextOnly,
}

impl From<SlackHeaderBlock> for SlackBlock {
Expand Down Expand Up @@ -874,8 +874,8 @@ impl From<SlackBlockCheckboxesElement> for SlackActionBlockElement {
}

/**
* 'plain_text' type of https://api.slack.com/reference/block-kit/composition-objects#text
*/
* 'plain_text' type of https://api.slack.com/reference/block-kit/composition-objects#text
*/
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackBlockPlainText {
Expand Down
13 changes: 13 additions & 0 deletions src/models/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,35 @@ use std::*;
use url::Url;

mod user;

pub use user::*;

mod team;

pub use team::*;

mod channel;

pub use channel::*;

mod reaction;

pub use reaction::*;

mod star;

pub use star::*;

mod bot;

pub use bot::*;

mod icon;

pub use icon::*;

mod formatters;

pub use formatters::*;

#[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)]
Expand Down Expand Up @@ -178,6 +190,7 @@ pub enum SlackConversationType {
Public,
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackConversationType {
fn to_string(&self) -> String {
match self {
Expand Down
1 change: 1 addition & 0 deletions src/socket_mode/wss_client_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl SlackSocketModeWssClientId {
}
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackSocketModeWssClientId {
fn to_string(&self) -> String {
format!(
Expand Down
1 change: 1 addition & 0 deletions src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum SlackApiTokenType {
App,
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackApiTokenType {
fn to_string(&self) -> String {
match self {
Expand Down

0 comments on commit b03c088

Please sign in to comment.