fix: don't allow private profiles to be exposed via mentions
This commit is contained in:
parent
eec81f5718
commit
5cc137a0ca
3 changed files with 27 additions and 0 deletions
|
@ -148,6 +148,17 @@ impl DataManager {
|
||||||
return Err(Error::NotAllowed);
|
return Err(Error::NotAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check private status
|
||||||
|
if user.settings.private_profile {
|
||||||
|
if self
|
||||||
|
.get_userfollow_by_initiator_receiver(user.id, data.owner)
|
||||||
|
.await
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
|
return Err(Error::NotAllowed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if the user can read the channel
|
// check if the user can read the channel
|
||||||
let membership = self
|
let membership = self
|
||||||
.get_membership_by_owner_community(user.id, channel.community)
|
.get_membership_by_owner_community(user.id, channel.community)
|
||||||
|
|
|
@ -2067,6 +2067,17 @@ impl DataManager {
|
||||||
return Err(Error::NotAllowed);
|
return Err(Error::NotAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check private status
|
||||||
|
if user.settings.private_profile {
|
||||||
|
if self
|
||||||
|
.get_userfollow_by_initiator_receiver(user.id, data.owner)
|
||||||
|
.await
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
|
return Err(Error::NotAllowed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// send notif
|
// send notif
|
||||||
self.create_notification(Notification::new(
|
self.create_notification(Notification::new(
|
||||||
"You've been mentioned in a post!".to_string(),
|
"You've been mentioned in a post!".to_string(),
|
||||||
|
|
|
@ -525,6 +525,11 @@ impl User {
|
||||||
out.push(buffer);
|
out.push(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if out.len() > 5 {
|
||||||
|
// if we're trying to mention more than 5 people, mention nobody (we're a spammer)
|
||||||
|
return Vec::new();
|
||||||
|
}
|
||||||
|
|
||||||
// return
|
// return
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue