File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ export default {
311
311
312
312
computed: {
313
313
linkifiedMessage () {
314
- return formatString (this .message .content )
314
+ return formatString (this .message .content , true )
315
315
},
316
316
showDate () {
317
317
return (
Original file line number Diff line number Diff line change 63
63
<span v-if =" room.lastMessage.seen" >
64
64
<svg-icon name =" checkmark" class =" icon-check" />
65
65
</span >
66
- <span >{{ getLastMessage(room) }}</span >
66
+ <span v-for =" (message, i) in getLastMessage(room)" :key =" i" >
67
+ <span v-if =" message.bind" v-html =" message.content" ></span >
68
+ <span v-else >{{ message.content }}</span >
69
+ </span >
67
70
</div >
68
71
</div >
69
72
</div >
@@ -76,6 +79,7 @@ import Loader from './Loader'
76
79
import SvgIcon from ' ./SvgIcon'
77
80
78
81
import filteredUsers from ' ../utils/filterItems'
82
+ import formatString from ' ../utils/formatString'
79
83
80
84
export default {
81
85
name: ' rooms-list' ,
@@ -132,15 +136,19 @@ export default {
132
136
if (user .status ) return user .status .state
133
137
},
134
138
getLastMessage (room ) {
135
- if (room .users .length <= 2 ) return room .lastMessage .content
139
+ if (room .users .length <= 2 ) {
140
+ return formatString (room .lastMessage .content )
141
+ }
136
142
137
143
const user = room .users .find (
138
144
user => user ._id === room .lastMessage .sender_id
139
145
)
140
146
141
- if (user ._id === this .currentUserId ) return room .lastMessage .content
147
+ if (user ._id === this .currentUserId ) {
148
+ return formatString (room .lastMessage .content )
149
+ }
142
150
143
- return ` ${ user .username } - ${ room .lastMessage .content } `
151
+ return ` ${ user .username } - ${ formatString ( room .lastMessage .content ) } `
144
152
}
145
153
}
146
154
}
Original file line number Diff line number Diff line change 1
1
const linkify = require ( 'linkifyjs' )
2
2
import linkifyHtml from 'linkifyjs/html'
3
3
4
- export default text => {
4
+ export default ( text , doLinkify = false ) => {
5
5
const strings = text . split ( ' ' )
6
6
7
7
const formattedStrings = strings . map ( ( string , i ) => {
8
8
const links = linkify . find ( string )
9
9
10
10
let result = ''
11
11
12
- if ( links . length && string === links [ 0 ] . value ) {
12
+ if ( doLinkify && links . length && string === links [ 0 ] . value ) {
13
13
result = {
14
14
bind : true ,
15
15
content : linkifyHtml ( links [ 0 ] . value , {
You can’t perform that action at this time.
0 commit comments