generated from t/malachite
fix: don't allow users to create chats with themselves
This commit is contained in:
parent
361d3d8e30
commit
3942ad5a19
2 changed files with 5 additions and 1 deletions
|
@ -60,7 +60,7 @@
|
|||
(div
|
||||
("class" "card banner")
|
||||
(img
|
||||
("src" "{{ config.service_hosts.buckets }}/banners/{{ profile.id }}")))
|
||||
("src" "{{ config.service_hosts.buckets|safe }}/banners/{{ profile.id }}")))
|
||||
(div
|
||||
("class" "card flex flex_col gap_ch")
|
||||
(text "{{ components::avatar(id=profile.id, size=\"160px\") }}")
|
||||
|
|
|
@ -43,6 +43,10 @@ pub async fn create_request(
|
|||
};
|
||||
req.members.dedup();
|
||||
|
||||
if req.members.contains(&user.username) {
|
||||
return Json(Error::MiscError("Cannot create a chat with yourself".to_string()).into());
|
||||
}
|
||||
|
||||
if (req.members.len() > 2 && req.style == ChatStyle::Direct)
|
||||
| (req.members.len() >= GC_MAXIMUM_MEMBERS && req.style != ChatStyle::Direct)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue