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
366dee0a
Commit
366dee0a
authored
Mar 05, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Allow moderators to retract their own messages
parent
a7f28cd6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
sass/_messages.scss
sass/_messages.scss
+2
-2
spec/retractions.js
spec/retractions.js
+1
-1
src/converse-message-view.js
src/converse-message-view.js
+4
-2
src/headless/converse-muc.js
src/headless/converse-muc.js
+1
-1
No files found.
sass/_messages.scss
View file @
366dee0a
...
...
@@ -234,13 +234,13 @@
height
:
var
(
--
message-font-size
);
font-size
:
var
(
--
message-font-size
);
padding
:
0
;
padding
-left
:
0
.75em
;
margin
-left
:
0
.75em
;
border
:
none
;
opacity
:
0
;
background
:
transparent
;
cursor
:
pointer
;
&
:focus
{
display
:
block
;
opacity
:
1
;
}
}
}
...
...
spec/retractions.js
View file @
366dee0a
...
...
@@ -533,7 +533,7 @@
await
view
.
model
.
queueMessage
(
received_stanza
);
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-msg__content
'
));
expect
(
view
.
el
.
querySelector
(
'
.chat-msg__content .chat-msg__action-retract
'
)).
toBe
(
null
);
const
result
=
await
view
.
model
.
can
Retract
Messages
();
const
result
=
await
view
.
model
.
can
Moderate
Messages
();
expect
(
result
).
toBe
(
false
);
done
();
}));
...
...
src/converse-message-view.js
View file @
366dee0a
...
...
@@ -234,10 +234,12 @@ converse.plugins.add('converse-message-view', {
const
is_groupchat
=
this
.
model
.
get
(
'
type
'
)
===
'
groupchat
'
;
const
is_own_message
=
this
.
model
.
get
(
'
sender
'
)
===
'
me
'
;
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
)
||
await
chatbox
.
canModerateMessages
()
);
const
may_moderate_message
=
!
is_own_message
&&
is_groupchat
&&
[
'
all
'
,
'
moderator
'
].
includes
(
_converse
.
allow_message_retraction
)
&&
await
chatbox
.
can
Retract
Messages
();
await
chatbox
.
can
Moderate
Messages
();
const
retractable
=
!
is_retracted
&&
(
may_moderate_message
||
may_retract_own_message
);
const
msg
=
u
.
stringToElement
(
tpl_message
(
...
...
src/headless/converse-muc.js
View file @
366dee0a
...
...
@@ -820,7 +820,7 @@ converse.plugins.add('converse-muc', {
return
_converse
.
ChatBox
.
prototype
.
close
.
call
(
this
);
},
can
Retract
Messages
()
{
can
Moderate
Messages
()
{
const
self
=
this
.
getOwnOccupant
();
return
self
&&
self
.
isModerator
()
&&
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
MODERATE
,
this
.
get
(
'
jid
'
));
},
...
...
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