Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
9c848e7c
Unverified
Commit
9c848e7c
authored
Mar 12, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Mar 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #881 from RocketChat/fix/emoji-on-message-with-quotes
[FIX] Fix emoji parsing on quote markdown
parents
3439c730
cc2da139
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
ViewModelMapper.kt
...chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
+14
-5
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+1
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
View file @
9c848e7c
...
...
@@ -138,18 +138,27 @@ class ViewModelMapper @Inject constructor(private val context: Context,
val
quoteUrl
=
HttpUrl
.
parse
(
url
.
url
)
val
serverUrl
=
HttpUrl
.
parse
(
baseUrl
)
if
(
quoteUrl
!=
null
&&
serverUrl
!=
null
)
{
quote
=
makeQuote
(
quoteUrl
,
serverUrl
)
quote
=
makeQuote
(
quoteUrl
,
serverUrl
)
?.
let
{
getMessageWithoutQuoteMarkdown
(
it
)
}
}
}
}
}
val
content
=
getContent
(
context
,
message
,
quote
)
MessageViewModel
(
message
=
message
,
rawData
=
message
,
messageId
=
message
.
id
,
avatar
=
avatar
!!
,
time
=
time
,
senderName
=
sender
,
val
content
=
getContent
(
context
,
getMessageWithoutQuoteMarkdown
(
message
)
,
quote
)
MessageViewModel
(
message
=
getMessageWithoutQuoteMarkdown
(
message
),
rawData
=
message
,
messageId
=
message
.
id
,
avatar
=
avatar
!!
,
time
=
time
,
senderName
=
sender
,
content
=
content
,
isPinned
=
message
.
pinned
)
}
private
fun
getMessageWithoutQuoteMarkdown
(
message
:
Message
):
Message
{
val
baseUrl
=
settings
.
baseUrl
()
return
message
.
copy
(
message
=
message
.
message
.
replace
(
"\\[\\s\\]\\($baseUrl.*\\)"
.
toRegex
(),
""
).
trim
()
)
}
private
fun
getSenderName
(
message
:
Message
):
CharSequence
{
if
(!
message
.
senderAlias
.
isNullOrEmpty
())
{
return
message
.
senderAlias
!!
...
...
@@ -194,7 +203,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
var
quoteViewModel
:
MessageViewModel
?
=
null
if
(
quote
!=
null
)
{
val
quoteMessage
:
Message
=
quote
quoteViewModel
=
map
(
quoteMessage
).
first
{
it
is
MessageViewModel
}
as
MessageViewModel
quoteViewModel
=
map
Message
(
quoteMessage
)
}
return
parser
.
renderMarkdown
(
message
.
message
,
quoteViewModel
,
currentUsername
)
}
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
9c848e7c
...
...
@@ -59,6 +59,7 @@ class MessageParser @Inject constructor(val context: Application, private val co
parentNode
.
appendChild
(
quoteNode
)
quoteNode
.
accept
(
QuoteMessageSenderVisitor
(
context
,
configuration
,
builder
,
senderName
.
length
))
quoteNode
=
parser
.
parse
(
"> ${toLenientMarkdown(quote.rawData.message)}"
)
quoteNode
.
accept
(
EmojiVisitor
(
builder
))
quoteNode
.
accept
(
QuoteMessageBodyVisitor
(
context
,
configuration
,
builder
))
}
parentNode
.
accept
(
LinkVisitor
(
builder
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment