fix: allow posts to be made with empty content if an image is uploaded
fix: chats websocket message delete
This commit is contained in:
parent
d3c696026a
commit
f3b605e30e
2 changed files with 3 additions and 2 deletions
|
@ -577,13 +577,13 @@ hide_user_menu=true) }}
|
||||||
}
|
}
|
||||||
|
|
||||||
const msg = JSON.parse(event.data);
|
const msg = JSON.parse(event.data);
|
||||||
const [channel_id, data] = JSON.parse(msg.data);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
msg.method === "Message" &&
|
msg.method === "Message" &&
|
||||||
window.CURRENT_PAGE === 0 &&
|
window.CURRENT_PAGE === 0 &&
|
||||||
window.VIEWING_SINGLE
|
window.VIEWING_SINGLE
|
||||||
) {
|
) {
|
||||||
|
const [channel_id, data] = JSON.parse(msg.data);
|
||||||
if (channel_id !== window.CHAT_PROPS.selected_channel) {
|
if (channel_id !== window.CHAT_PROPS.selected_channel) {
|
||||||
// message not for us... maybe send notification later
|
// message not for us... maybe send notification later
|
||||||
// something like /api/v1/messages/{id}/mark_unread
|
// something like /api/v1/messages/{id}/mark_unread
|
||||||
|
@ -624,6 +624,7 @@ hide_user_menu=true) }}
|
||||||
socket.close();
|
socket.close();
|
||||||
}
|
}
|
||||||
} else if (msg.method === "Delete") {
|
} else if (msg.method === "Delete") {
|
||||||
|
const data = JSON.parse(msg.data);
|
||||||
if (document.getElementById(`message-${data.id}`)) {
|
if (document.getElementById(`message-${data.id}`)) {
|
||||||
document
|
document
|
||||||
.getElementById(`message-${data.id}`)
|
.getElementById(`message-${data.id}`)
|
||||||
|
|
|
@ -836,7 +836,7 @@ impl DataManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !is_reposting {
|
if !is_reposting {
|
||||||
if data.content.len() < 2 {
|
if data.content.len() < 2 && data.uploads.len() == 0 {
|
||||||
return Err(Error::DataTooShort("content".to_string()));
|
return Err(Error::DataTooShort("content".to_string()));
|
||||||
} else if data.content.len() > 4096 {
|
} else if data.content.len() > 4096 {
|
||||||
return Err(Error::DataTooLong("content".to_string()));
|
return Err(Error::DataTooLong("content".to_string()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue