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
13ffe5a6
Commit
13ffe5a6
authored
Nov 26, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various smaller retraction related fixes and improvements
parent
53df5d6b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
package.json
package.json
+1
-1
src/converse-message-view.js
src/converse-message-view.js
+11
-14
src/headless/converse-chat.js
src/headless/converse-chat.js
+3
-3
src/headless/converse-muc.js
src/headless/converse-muc.js
+1
-0
src/headless/utils/stanza.js
src/headless/utils/stanza.js
+4
-2
No files found.
package.json
View file @
13ffe5a6
{
{
"name"
:
"converse.js"
,
"name"
:
"converse.js"
,
"version"
:
"
5.0.4
"
,
"version"
:
"
6.0.0
"
,
"description"
:
"Browser based XMPP chat client"
,
"description"
:
"Browser based XMPP chat client"
,
"browser"
:
"dist/converse.js"
,
"browser"
:
"dist/converse.js"
,
"module"
:
"src/converse.js"
,
"module"
:
"src/converse.js"
,
...
...
src/converse-message-view.js
View file @
13ffe5a6
...
@@ -247,7 +247,7 @@ converse.plugins.add('converse-message-view', {
...
@@ -247,7 +247,7 @@ converse.plugins.add('converse-message-view', {
const
is_own_message
=
this
.
model
.
get
(
'
sender
'
)
===
'
me
'
;
const
is_own_message
=
this
.
model
.
get
(
'
sender
'
)
===
'
me
'
;
const
chatbox
=
this
.
model
.
collection
.
chatbox
;
const
chatbox
=
this
.
model
.
collection
.
chatbox
;
const
may_retract_own_message
=
is_own_message
&&
[
'
all
'
,
'
own
'
].
includes
(
_converse
.
allow_message_retraction
);
const
may_retract_own_message
=
is_own_message
&&
[
'
all
'
,
'
own
'
].
includes
(
_converse
.
allow_message_retraction
);
const
may_moderate_message
=
is_groupchat
&&
const
may_moderate_message
=
!
is_own_message
&&
is_groupchat
&&
[
'
all
'
,
'
moderator
'
].
includes
(
_converse
.
allow_message_retraction
)
&&
[
'
all
'
,
'
moderator
'
].
includes
(
_converse
.
allow_message_retraction
)
&&
await
chatbox
.
canRetractMessages
();
await
chatbox
.
canRetractMessages
();
...
@@ -306,22 +306,19 @@ converse.plugins.add('converse-message-view', {
...
@@ -306,22 +306,19 @@ converse.plugins.add('converse-message-view', {
},
},
getRetractionText
()
{
getRetractionText
()
{
const
username
=
this
.
model
.
getDisplayName
();
if
(
this
.
model
.
get
(
'
type
'
)
===
'
groupchat
'
&&
this
.
model
.
get
(
'
moderated_by
'
))
{
let
retraction_text
=
__
(
'
%1$s has retracted this message
'
,
username
);
if
(
this
.
model
.
get
(
'
type
'
)
===
'
groupchat
'
)
{
const
retracted_by_mod
=
this
.
model
.
get
(
'
moderated_by
'
);
const
retracted_by_mod
=
this
.
model
.
get
(
'
moderated_by
'
);
if
(
retracted_by_mod
)
{
const
chatbox
=
this
.
model
.
collection
.
chatbox
;
const
chatbox
=
this
.
model
.
collection
.
chatbox
;
if
(
!
this
.
model
.
mod
)
{
if
(
!
this
.
model
.
mod
)
{
this
.
model
.
mod
=
this
.
model
.
mod
=
chatbox
.
occupants
.
findOccupant
({
'
jid
'
:
retracted_by_mod
})
||
chatbox
.
occupants
.
findOccupant
({
'
jid
'
:
retracted_by_mod
})
||
chatbox
.
occupants
.
findOccupant
({
'
nick
'
:
Strophe
.
getResourceFromJid
(
retracted_by_mod
)});
chatbox
.
occupants
.
findOccupant
({
'
nick
'
:
Strophe
.
getResourceFromJid
(
retracted_by_mod
)});
}
const
modname
=
this
.
model
.
mod
?
this
.
model
.
mod
.
getDisplayName
()
:
'
A moderator
'
;
retraction_text
=
__
(
'
%1$s has retracted this message from %2$s
'
,
modname
,
username
);
}
}
const
modname
=
this
.
model
.
mod
?
this
.
model
.
mod
.
getDisplayName
()
:
'
A moderator
'
;
return
__
(
'
%1$s has retracted this message
'
,
modname
);
}
else
{
return
__
(
'
%1$s has retracted this message
'
,
this
.
model
.
getDisplayName
());
}
}
return
retraction_text
;
},
},
renderErrorMessage
()
{
renderErrorMessage
()
{
...
...
src/headless/converse-chat.js
View file @
13ffe5a6
...
@@ -582,7 +582,7 @@ converse.plugins.add('converse-chat', {
...
@@ -582,7 +582,7 @@ converse.plugins.add('converse-chat', {
* whether a message was retracted or not.
* whether a message was retracted or not.
*/
*/
handleRetraction
(
attrs
)
{
handleRetraction
(
attrs
)
{
const
RETRACTION_ATTRIBUTES
=
[
'
retracted
'
,
'
retracted_id
'
];
const
RETRACTION_ATTRIBUTES
=
[
'
retracted
'
,
'
retracted_id
'
,
'
editable
'
];
if
(
attrs
.
retracted
)
{
if
(
attrs
.
retracted
)
{
if
(
attrs
.
is_tombstone
)
{
if
(
attrs
.
is_tombstone
)
{
return
false
;
return
false
;
...
@@ -877,7 +877,7 @@ converse.plugins.add('converse-chat', {
...
@@ -877,7 +877,7 @@ converse.plugins.add('converse-chat', {
return
;
return
;
}
}
if
(
_converse
.
allow_message_corrections
===
'
all
'
)
{
if
(
_converse
.
allow_message_corrections
===
'
all
'
)
{
attrs
.
editable
=
!
(
attrs
.
file
||
'
oob_url
'
in
attrs
);
attrs
.
editable
=
!
(
attrs
.
file
||
attrs
.
retracted
||
'
oob_url
'
in
attrs
);
}
else
if
((
_converse
.
allow_message_corrections
===
'
last
'
)
&&
}
else
if
((
_converse
.
allow_message_corrections
===
'
last
'
)
&&
(
send_time
>
this
.
get
(
'
time_sent
'
)))
{
(
send_time
>
this
.
get
(
'
time_sent
'
)))
{
this
.
set
({
'
time_sent
'
:
send_time
});
this
.
set
({
'
time_sent
'
:
send_time
});
...
@@ -885,7 +885,7 @@ converse.plugins.add('converse-chat', {
...
@@ -885,7 +885,7 @@ converse.plugins.add('converse-chat', {
if
(
msg
)
{
if
(
msg
)
{
msg
.
save
({
'
editable
'
:
false
});
msg
.
save
({
'
editable
'
:
false
});
}
}
attrs
.
editable
=
!
(
attrs
.
file
||
'
oob_url
'
in
attrs
);
attrs
.
editable
=
!
(
attrs
.
file
||
attrs
.
retracted
||
'
oob_url
'
in
attrs
);
}
}
},
},
...
...
src/headless/converse-muc.js
View file @
13ffe5a6
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
* @description
* @description
* Implements the non-view logic for XEP-0045 Multi-User Chat
* Implements the non-view logic for XEP-0045 Multi-User Chat
*/
*/
import
"
./converse-chat
"
;
import
"
./converse-disco
"
;
import
"
./converse-disco
"
;
import
"
./converse-emoji
"
;
import
"
./converse-emoji
"
;
import
{
clone
,
get
,
intersection
,
invoke
,
isElement
,
isObject
,
isString
,
pick
,
uniq
,
zipObject
}
from
"
lodash
"
;
import
{
clone
,
get
,
intersection
,
invoke
,
isElement
,
isObject
,
isString
,
pick
,
uniq
,
zipObject
}
from
"
lodash
"
;
...
...
src/headless/utils/stanza.js
View file @
13ffe5a6
...
@@ -130,6 +130,7 @@ const stanza_utils = {
...
@@ -130,6 +130,7 @@ const stanza_utils = {
const
delay
=
sizzle
(
`delay[xmlns="
${
Strophe
.
NS
.
DELAY
}
"]`
,
original_stanza
).
pop
();
const
delay
=
sizzle
(
`delay[xmlns="
${
Strophe
.
NS
.
DELAY
}
"]`
,
original_stanza
).
pop
();
const
time
=
delay
?
dayjs
(
delay
.
getAttribute
(
'
stamp
'
)).
toISOString
()
:
(
new
Date
()).
toISOString
();
const
time
=
delay
?
dayjs
(
delay
.
getAttribute
(
'
stamp
'
)).
toISOString
()
:
(
new
Date
()).
toISOString
();
return
{
return
{
'
editable
'
:
false
,
'
retracted
'
:
time
,
'
retracted
'
:
time
,
'
retracted_id
'
:
applies_to_id
'
retracted_id
'
:
applies_to_id
}
}
...
@@ -138,8 +139,9 @@ const stanza_utils = {
...
@@ -138,8 +139,9 @@ const stanza_utils = {
const
tombstone
=
sizzle
(
`> retracted[xmlns="
${
Strophe
.
NS
.
RETRACT
}
"]`
,
stanza
).
pop
();
const
tombstone
=
sizzle
(
`> retracted[xmlns="
${
Strophe
.
NS
.
RETRACT
}
"]`
,
stanza
).
pop
();
if
(
tombstone
)
{
if
(
tombstone
)
{
return
{
return
{
'
retracted
'
:
tombstone
.
getAttribute
(
'
stamp
'
),
'
editable
'
:
false
,
'
is_tombstone
'
:
true
'
is_tombstone
'
:
true
,
'
retracted
'
:
tombstone
.
getAttribute
(
'
stamp
'
)
}
}
}
}
}
}
...
...
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