diff --git a/crates/app/src/public/html/chats/app.html b/crates/app/src/public/html/chats/app.html index 39449b2..59db607 100644 --- a/crates/app/src/public/html/chats/app.html +++ b/crates/app/src/public/html/chats/app.html @@ -577,13 +577,13 @@ hide_user_menu=true) }} } const msg = JSON.parse(event.data); - const [channel_id, data] = JSON.parse(msg.data); if ( msg.method === "Message" && window.CURRENT_PAGE === 0 && window.VIEWING_SINGLE ) { + const [channel_id, data] = JSON.parse(msg.data); if (channel_id !== window.CHAT_PROPS.selected_channel) { // message not for us... maybe send notification later // something like /api/v1/messages/{id}/mark_unread @@ -624,6 +624,7 @@ hide_user_menu=true) }} socket.close(); } } else if (msg.method === "Delete") { + const data = JSON.parse(msg.data); if (document.getElementById(`message-${data.id}`)) { document .getElementById(`message-${data.id}`) diff --git a/crates/core/src/database/posts.rs b/crates/core/src/database/posts.rs index 4740f19..0bec8db 100644 --- a/crates/core/src/database/posts.rs +++ b/crates/core/src/database/posts.rs @@ -836,7 +836,7 @@ impl DataManager { }; if !is_reposting { - if data.content.len() < 2 { + if data.content.len() < 2 && data.uploads.len() == 0 { return Err(Error::DataTooShort("content".to_string())); } else if data.content.len() > 4096 { return Err(Error::DataTooLong("content".to_string()));