Skip to content

Commit

Permalink
feat: get sending replys and creating conversations working in mobile…
Browse files Browse the repository at this point in the history
… view
  • Loading branch information
akinsey committed Jan 4, 2022
1 parent ae99d0d commit 727a831
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions public/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ window.images_local_root = 'http://localhost:8080'
window.websocket_host = 'localhost'
window.websocket_port = '23958'
window.post_max_length = 10000
window.mobile_break_width = 767
window.max_image_size = 10485760
window.max_avatar_size = 102400
window.portal = { enabled: false }
Expand Down
18 changes: 13 additions & 5 deletions src/views/Messages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ export default {
next(vm => {
messagesApi.page(query)
.then(d => vm.recentMessages = d)
.then(() => vm.preloadConversation(to.query.id || vm.recentMessages.messages[0].conversation_id))
.then(() => {
// Hacky, handle mobile split view
window.innerWidth > window.mobile_break_width || to.query.id ? vm.preloadConversation(to.query.id || vm.recentMessages.messages[0].conversation_id) : null
})
.catch(() => {})
})
},
Expand All @@ -186,7 +189,10 @@ export default {
}
messagesApi.page(query)
.then(d => this.recentMessages = d)
.then(() => this.preloadConversation(to.query.id || this.recentMessages.messages[0].conversation_id))
.then(() => {
// Hacky, handle mobile split view
window.innerWidth > window.mobile_break_width || to.query.id ? this.preloadConversation(to.query.id || this.recentMessages.messages[0].conversation_id) : null
})
.catch(() => {})
next()
},
Expand Down Expand Up @@ -227,7 +233,7 @@ export default {
v.recentMessages.messages.forEach(message => {
if (message.conversation_id === conversationId) { message.viewed = true }
})
messagesApi.convos.page(conversationId)
return messagesApi.convos.page(conversationId)
// build out conversation information
.then(data => {
v.currentSubject = data.messages[0].content.subject
Expand Down Expand Up @@ -297,8 +303,10 @@ export default {
const canDeleteMessage = () => true
const canCreateConversation = () => true
const canCreateMessage = () => true
const createConversation = convo => messagesApi.convos.create(convo).then(reload)
const createMessage = msg => messagesApi.create(msg).then(reload)
const createConversation = convo => window.innerWidth > window.mobile_break_width ?messagesApi.convos.create(convo).then(reload) : messagesApi.convos.create(convo).then(data => preloadConversation(data.conversation_id))
// Hacky, handle mobile split view
const createMessage = msg => window.innerWidth > window.mobile_break_width ? messagesApi.create(msg).then(reload) : messagesApi.create(msg).then(() => preloadConversation(v.selectedConversationId))
const listMessageReceivers = message => {
let receiverNames = []
Expand Down

0 comments on commit 727a831

Please sign in to comment.