Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
solid-xmpp-chat
Manage
Activity
Members
Labels
Plan
Issues
45
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Components
solid-xmpp-chat
Commits
8e7d7327
Commit
8e7d7327
authored
4 years ago
by
Emmanuel Vodor
Browse files
Options
Downloads
Plain Diff
Merge branch '262_reply_to_message' into 'beta'
#262
Reply to message See merge request
!108
parents
8821dba2
1f90250c
No related branches found
No related tags found
2 merge requests
!113
History, Reply to messages and RAI
,
!108
#262 Reply to message
Pipeline
#10471
passed with stage
in 1 minute and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/sib-reply-to-message.js
+17
-3
17 additions, 3 deletions
src/plugins/sib-reply-to-message.js
with
17 additions
and
3 deletions
src/plugins/sib-reply-to-message.js
+
17
−
3
View file @
8e7d7327
/**
* Add an action button to reply to a message.
* TODO: Add settings to handle this plugin
*/
converse
.
plugins
.
add
(
'
sib-reply-to-message
'
,
{
initialize
()
{
const
_converse
=
this
.
_converse
;
const
{
api
,
__
}
=
_converse
;
const
{
utils
}
=
converse
.
env
;
const
{
utils
,
_
}
=
converse
.
env
;
function
removeQuotedMessages
(
text
)
{
return
text
.
replace
(
/^>.*
(\n)?
/gm
,
''
);
}
api
.
listen
.
on
(
'
getMessageActionButtons
'
,
(
el
,
buttons
)
=>
{
// Do not add if the message is not from a MUC
// Do not add if the message is from the current user
if
(
el
.
model
.
get
(
'
type
'
)
!==
'
groupchat
'
||
el
.
model
.
get
(
'
from_real_jid
'
)
===
_converse
.
bare_jid
)
{
if
(
el
.
model
.
get
(
'
type
'
)
!==
'
groupchat
'
||
el
.
model
.
get
(
'
sender
'
)
===
'
me
'
)
{
return
buttons
;
}
...
...
@@ -19,7 +24,16 @@ converse.plugins.add('sib-reply-to-message', {
'
i18n_text
'
:
__
(
'
Reply
'
),
'
handler
'
:
ev
=>
{
const
chat_textarea
=
utils
.
ancestor
(
el
,
'
.chatbox
'
)?.
querySelector
(
'
.chat-textarea
'
);
chat_textarea
.
value
=
`@
${
el
.
model
.
get
(
'
nick
'
)}
`
;
chat_textarea
.
value
=
''
;
// Add the previous message without quoted messages (to avoid blockquotes into blockquotes)
const
message
=
_
.
truncate
(
removeQuotedMessages
(
el
.
model
.
get
(
'
message
'
)),
{
length
:
100
});
if
(
message
.
length
>
0
)
{
chat_textarea
.
value
+=
`
${
message
.
replace
(
/^/gm
,
'
>
'
)}
\n`
;
}
// Add mention to the initial user and focus textarea
chat_textarea
.
value
+=
`@
${
el
.
model
.
get
(
'
nick
'
)}
`
;
chat_textarea
.
focus
();
},
'
button_class
'
:
'
chat-msg__action-reply
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment