Site > Chat > Add associated file to messages

This commit is contained in:
brunosimon
2017-09-01 01:06:21 +02:00
parent 015cd88ca5
commit c34936b068
11 changed files with 147 additions and 12 deletions
+23 -1
View File
@@ -1,11 +1,13 @@
export default {
state:
{
open: false,
user: null,
pendingUser: null,
messages: [],
pendingMessage: null,
pendingAlert: null
pendingAlert: null,
question: null
},
mutations:
@@ -39,6 +41,26 @@ export default {
{
const date = new Date()
state.pendingAlert = { date }
},
setQuestion(state, data)
{
state.question = data
},
openChat(state)
{
state.open = true
},
closeChat(state)
{
state.open = false
},
toggleChat(state)
{
state.open = !state.open
}
}
}
+26 -1
View File
@@ -6,6 +6,7 @@ export default {
tree: new FileTree({ autoWash: true }),
current: null,
currentVersion: null,
currentLine: null,
search: ''
},
@@ -37,8 +38,10 @@ export default {
setFile(state, data)
{
// Retrieve file from path
const file = state.tree.getFile(data)
// No current file or file different than current
if(!state.current || state.current.id !== file.id)
{
state.current = file
@@ -60,7 +63,29 @@ export default {
setVersion(state, data)
{
state.currentVersion = data
// Date sent
if(typeof data === 'string')
{
// Find version by date
const version = state.current.versions.find((version) => version.date === data)
// Found
if(version)
{
state.currentVersion = version
}
}
// Version directly sent
else
{
state.currentVersion = data
}
},
setLine(state, data)
{
state.currentLine = data
},
searchFile(state, data)