mirror of
https://github.com/Troplo/Colubrina.git
synced 2024-11-22 11:17:56 +11:00
1.0.4
This commit is contained in:
parent
34bd37c5b5
commit
3562843c10
6 changed files with 28 additions and 14 deletions
|
@ -41,8 +41,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||
msg: "Username is required"
|
||||
},
|
||||
len: {
|
||||
args: [2, 12],
|
||||
msg: "Username must be between 2 and 12 characters"
|
||||
args: [2, 16],
|
||||
msg: "Username must be between 2 and 16 characters"
|
||||
},
|
||||
regex: {
|
||||
args: /^[a-z0-9_-]+$/i,
|
||||
|
|
|
@ -378,6 +378,10 @@ router.delete(
|
|||
chatId: chat.chat.id
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Chat,
|
||||
as: "chat"
|
||||
},
|
||||
{
|
||||
model: User,
|
||||
as: "user",
|
||||
|
@ -391,6 +395,9 @@ router.delete(
|
|||
if (!association) {
|
||||
throw Errors.chatNotFoundOrNotAdmin
|
||||
}
|
||||
if(association.chat.type === "direct") {
|
||||
throw Errors.invalidParameter("association id", "You cannot leave direct messages")
|
||||
}
|
||||
await association.destroy()
|
||||
res.sendStatus(204)
|
||||
const message = await Message.create({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "colubrina-chat",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"private": true,
|
||||
"author": "Troplo <troplo@troplo.com>",
|
||||
"license": "GPL-3.0",
|
||||
|
|
|
@ -534,7 +534,7 @@ export default {
|
|||
).unread += 1
|
||||
if (
|
||||
(message.userId !== this.$store.state.user.id &&
|
||||
this.$route.params?.id !== message.associationId &&
|
||||
parseInt(this.$route.params?.id) !== message.associationId &&
|
||||
this.$store.state.user?.storedStatus !== "busy") ||
|
||||
(message.userId !== this.$store.state.user.id &&
|
||||
this.$store.state.user?.storedStatus !== "busy" &&
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
outlined
|
||||
append-outer-icon="mdi-send"
|
||||
auto-grow
|
||||
@keyup.up="editLastMessage"
|
||||
@keyup.up="handleEditMessage"
|
||||
@keyup.esc="handleEsc"
|
||||
@click:append-outer="handleMessage()"
|
||||
@keydown.enter.exact.prevent="handleMessage()"
|
||||
|
@ -111,6 +111,11 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
handleEditMessage() {
|
||||
if(!this.message?.length) {
|
||||
this.editLastMessage()
|
||||
}
|
||||
},
|
||||
handleMessage() {
|
||||
if (this.edit) {
|
||||
this.editMessage()
|
||||
|
@ -134,7 +139,6 @@ export default {
|
|||
.then(() => {
|
||||
this.edit.editing = false
|
||||
this.edit.id = null
|
||||
this.edit.content = ""
|
||||
this.focusInput()
|
||||
this.endEdit()
|
||||
// response will be handled via WebSocket
|
||||
|
@ -234,7 +238,6 @@ export default {
|
|||
)
|
||||
.then(() => {
|
||||
this.focusInput()
|
||||
this.message = ""
|
||||
this.autoScroll()
|
||||
this.endSend()
|
||||
})
|
||||
|
@ -264,7 +267,6 @@ export default {
|
|||
)
|
||||
.then(() => {
|
||||
this.focusInput()
|
||||
this.message = ""
|
||||
this.autoScroll()
|
||||
this.endSend()
|
||||
this.file = null
|
||||
|
|
|
@ -26,10 +26,7 @@
|
|||
<v-list-item-title>Group Settings</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item
|
||||
@click="
|
||||
leave.item = context.user.item
|
||||
leave.dialog = true
|
||||
"
|
||||
@click="groupLeave(context.user.id)"
|
||||
color="error"
|
||||
>
|
||||
<v-list-item-title>Leave Group</v-list-item-title>
|
||||
|
@ -679,6 +676,12 @@ export default {
|
|||
)
|
||||
this.settings.dialog = true
|
||||
},
|
||||
groupLeave(id) {
|
||||
this.leave.item = this.$store.state.chats.find(
|
||||
(chat) => chat.id === id
|
||||
)
|
||||
this.leave.dialog = true
|
||||
},
|
||||
show(e, context, item, id) {
|
||||
e.preventDefault()
|
||||
this.context[context].value = false
|
||||
|
@ -817,9 +820,11 @@ export default {
|
|||
.delete("/api/v1/communications/association/" + this.leave.item.id)
|
||||
.then(() => {
|
||||
this.leave.dialog = false
|
||||
this.$store.state.chats = this.$store.state.chats.filter(
|
||||
(chat) => chat.id !== this.leave.item.id
|
||||
)
|
||||
this.$router.push("/communications/friends")
|
||||
this.leave.item = null
|
||||
this.getChats()
|
||||
this.$router.push("/communications/home")
|
||||
})
|
||||
.catch((e) => {
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
|
|
Loading…
Reference in a new issue