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
ec92246e
Commit
ec92246e
authored
Mar 09, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix quotes markdown parsing
parent
c1871a62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
ViewModelMapper.kt
...chat/rocket/android/chatroom/viewmodel/ViewModelMapper.kt
+11
-2
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 @
ec92246e
...
...
@@ -130,6 +130,7 @@ class ViewModelMapper @Inject constructor(private val context: Context,
var
quote
:
Message
?
=
null
val
urls
=
ArrayList
<
Url
>()
var
messageWithQuote
:
Message
?
=
null
message
.
urls
?.
let
{
if
(
it
.
isEmpty
())
return
@let
for
(
url
in
it
)
{
...
...
@@ -139,12 +140,20 @@ class ViewModelMapper @Inject constructor(private val context: Context,
val
serverUrl
=
HttpUrl
.
parse
(
baseUrl
)
if
(
quoteUrl
!=
null
&&
serverUrl
!=
null
)
{
quote
=
makeQuote
(
quoteUrl
,
serverUrl
)
if
(
quote
!=
null
)
{
if
(
quote
!=
null
)
{
messageWithQuote
=
message
.
copy
(
message
=
message
.
message
.
replace
(
"[ ](${url.url})"
,
""
).
trim
()
)
}
}
}
}
}
}
val
content
=
getContent
(
context
,
message
,
quote
)
val
content
=
getContent
(
context
,
messageWithQuote
?:
message
,
quote
)
MessageViewModel
(
message
=
message
,
rawData
=
message
,
messageId
=
message
.
id
,
avatar
=
avatar
!!
,
time
=
time
,
senderName
=
sender
,
content
=
content
,
isPinned
=
message
.
pinned
)
...
...
@@ -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 @
ec92246e
...
...
@@ -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