fix: don't send self dm notifications (#706)
* fix: don't send self dm notifications Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> * fix: test failure due to wrong assertion (#707) Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> * fix: RA auto import moment Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com> --------- Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com>
This commit is contained in:
@@ -705,7 +705,7 @@ impl Message {
|
|||||||
Some(
|
Some(
|
||||||
PushNotification::from(
|
PushNotification::from(
|
||||||
self.clone().into_model(user, member),
|
self.clone().into_model(user, member),
|
||||||
Some(author),
|
Some(author.clone()),
|
||||||
channel.to_owned().into(),
|
channel.to_owned().into(),
|
||||||
)
|
)
|
||||||
.await,
|
.await,
|
||||||
@@ -713,7 +713,11 @@ impl Message {
|
|||||||
self.clone(),
|
self.clone(),
|
||||||
match channel {
|
match channel {
|
||||||
Channel::DirectMessage { recipients, .. }
|
Channel::DirectMessage { recipients, .. }
|
||||||
| Channel::Group { recipients, .. } => recipients.clone(),
|
| Channel::Group { recipients, .. } => recipients
|
||||||
|
.iter()
|
||||||
|
.filter(|uid| *uid != author.id())
|
||||||
|
.cloned()
|
||||||
|
.collect(),
|
||||||
Channel::TextChannel { .. } => {
|
Channel::TextChannel { .. } => {
|
||||||
self.mentions.clone().unwrap_or_default()
|
self.mentions.clone().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -391,6 +391,7 @@ auto_derived!(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/// Message Author Abstraction
|
/// Message Author Abstraction
|
||||||
|
#[derive(Clone)]
|
||||||
pub enum MessageAuthor<'a> {
|
pub enum MessageAuthor<'a> {
|
||||||
User(&'a User),
|
User(&'a User),
|
||||||
Webhook(&'a Webhook),
|
Webhook(&'a Webhook),
|
||||||
|
|||||||
Reference in New Issue
Block a user