Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
093fd7a2
Commit
093fd7a2
authored
Jan 18, 2018
by
Seve
Committed by
JC Brand
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start overriding renderMessage() properly
parent
226df674
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
47 deletions
+7
-47
src/converse-spoilers.js
src/converse-spoilers.js
+7
-47
No files found.
src/converse-spoilers.js
View file @
093fd7a2
...
...
@@ -183,46 +183,9 @@
* The DOM element representing the message.
*/
console
.
log
(
attrs
);
let
text
=
attrs
.
message
,
fullname
=
this
.
model
.
get
(
'
fullname
'
)
||
attrs
.
fullname
,
template
,
username
;
const
match
=
text
.
match
(
/^
\/(
.*
?)(?:
(
.*
))?
$/
);
if
((
match
)
&&
(
match
[
1
]
===
'
me
'
))
{
text
=
text
.
replace
(
/^
\/
me/
,
''
);
template
=
tpl_action
;
if
(
attrs
.
sender
===
'
me
'
)
{
fullname
=
_converse
.
xmppstatus
.
get
(
'
fullname
'
)
||
attrs
.
fullname
;
username
=
_
.
isNil
(
fullname
)?
_converse
.
bare_jid
:
fullname
;
}
else
{
username
=
attrs
.
fullname
;
}
}
else
{
template
=
tpl_message
;
username
=
attrs
.
sender
===
'
me
'
&&
_
(
'
me
'
)
||
fullname
;
}
this
.
$content
.
find
(
'
div.chat-event
'
).
remove
();
if
(
text
.
length
>
8000
)
{
text
=
text
.
substring
(
0
,
10
)
+
'
...
'
;
this
.
showStatusNotification
(
_
(
"
A very large message has been received.
"
+
"
This might be due to an attack meant to degrade the chat performance.
"
+
"
Output has been shortened.
"
),
true
,
true
);
}
const
msg_time
=
moment
(
attrs
.
time
)
||
moment
;
const
$msg
=
$
(
template
(
_
.
extend
(
this
.
getExtraMessageTemplateAttributes
(
attrs
),
{
'
msgid
'
:
attrs
.
msgid
,
'
sender
'
:
attrs
.
sender
,
'
time
'
:
msg_time
.
format
(
_converse
.
time_format
),
'
isodate
'
:
msg_time
.
format
(),
'
username
'
:
username
,
'
extra_classes
'
:
this
.
getExtraMessageClasses
(
attrs
)
})
));
const
msg_content
=
$msg
[
0
].
querySelector
(
'
.chat-msg-content
'
);
let
msg
=
this
.
__super__
.
renderMessage
.
apply
(
this
,
arguments
);
console
.
log
(
msg
);
// const msg_content = $msg[0].querySelector('.chat-msg-content');
//Spoiler logic
if
(
'
spoiler
'
in
attrs
)
{
...
...
@@ -261,13 +224,10 @@
container
.
append
(
content
);
msg_content
.
append
(
container
);
}
else
{
return
this
.
__super__
.
renderMessage
.
apply
(
this
,
arguments
);
msg
.
append
(
container
);
}
return
$
msg
;
return
msg
;
}
},
'
ChatBox
'
:
{
...
...
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