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
f84c2014
Commit
f84c2014
authored
Apr 10, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide the textarea when a user is muted in a groupchat
parent
aa90ebd7
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
172 additions
and
110 deletions
+172
-110
CHANGES.md
CHANGES.md
+1
-0
css/converse.css
css/converse.css
+8
-0
dist/converse.js
dist/converse.js
+118
-82
sass/_chatrooms.scss
sass/_chatrooms.scss
+9
-0
spec/messages.js
spec/messages.js
+4
-4
spec/muc.js
spec/muc.js
+0
-6
src/converse-chatview.js
src/converse-chatview.js
+1
-1
src/converse-muc-views.js
src/converse-muc-views.js
+15
-2
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+6
-6
src/headless/converse-muc.js
src/headless/converse-muc.js
+1
-1
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+6
-6
src/templates/chatarea.html
src/templates/chatarea.html
+1
-1
src/templates/chatbox.html
src/templates/chatbox.html
+1
-1
src/templates/chatroom_bottom_panel.html
src/templates/chatroom_bottom_panel.html
+1
-0
No files found.
CHANGES.md
View file @
f84c2014
...
...
@@ -5,6 +5,7 @@
*
Bugfix: Don't set
`muc_domain`
for roomspanel if
`locked_muc_domain`
is
`true`
.
*
Bugfix: Modal auto-closes when you open it for a second time.
*
Take roster nickname into consideration when rendering messages and chat headings.
*
Hide the textarea when a user is muted in a groupchat.
## 4.2.0 (2019-04-04)
...
...
css/converse.css
View file @
f84c2014
...
...
@@ -11680,6 +11680,14 @@ body.converse-fullscreen {
#conversejs
.converse-embedded
.chatroom
.box-flyout
.chatroom-body
.chatroom-form-container
.button-primary
,
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chatroom-form-container
.button-primary
{
background-color
:
var
(
--chatroom-head-button-color
);
}
#conversejs
.converse-embedded
.chatroom
.muc-bottom-panel
,
#conversejs
.chatroom
.muc-bottom-panel
{
border-top
:
var
(
--message-input-border-top
);
height
:
4em
;
padding
:
1em
;
font-size
:
var
(
--font-size-small
);
background-color
:
var
(
--chatroom-head-color
);
color
:
white
;
}
#conversejs
.converse-embedded
.chatroom
.sendXMPPMessage
.suggestion-box__results--above
,
#conversejs
.chatroom
.sendXMPPMessage
.suggestion-box__results--above
{
bottom
:
4.5em
;
}
...
...
dist/converse.js
View file @
f84c2014
This diff is collapsed.
Click to expand it.
sass/_chatrooms.scss
View file @
f84c2014
...
...
@@ -306,6 +306,15 @@
}
}
.muc-bottom-panel
{
border-top
:
var
(
--
message-input-border-top
);
height
:
4em
;
padding
:
1em
;
font-size
:
var
(
--
font-size-small
);
background-color
:
var
(
--
chatroom-head-color
);
color
:
white
;
}
.sendXMPPMessage
{
.suggestion-box__results--above
{
...
...
spec/messages.js
View file @
f84c2014
...
...
@@ -1630,7 +1630,7 @@
let
fullname
=
_converse
.
xmppstatus
.
get
(
'
fullname
'
);
fullname
=
_
.
isEmpty
(
fullname
)?
_converse
.
bare_jid
:
fullname
;
await
_converse
.
api
.
chats
.
open
(
sender_jid
)
var
msg_text
=
'
This message will not be sent, due to an error
'
;
let
msg_text
=
'
This message will not be sent, due to an error
'
;
const
view
=
_converse
.
api
.
chatviews
.
get
(
sender_jid
);
let
message
=
view
.
model
.
messages
.
create
({
'
msgid
'
:
'
82bc02ce-9651-4336-baf0-fa04762ed8d2
'
,
...
...
@@ -1639,7 +1639,7 @@
'
time
'
:
moment
().
format
(),
'
message
'
:
msg_text
});
view
.
model
.
sendMessage
(
m
essage
);
view
.
model
.
sendMessage
(
m
sg_text
);
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
const
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
let
msg_txt
=
sizzle
(
'
.chat-msg:last .chat-msg__text
'
,
chat_content
).
pop
().
textContent
;
...
...
@@ -1656,7 +1656,7 @@
'
time
'
:
moment
().
format
(),
'
message
'
:
msg_text
});
view
.
model
.
sendMessage
(
m
essage
);
view
.
model
.
sendMessage
(
m
sg_text
);
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
msg_txt
=
sizzle
(
'
.chat-msg:last .chat-msg__text
'
,
chat_content
).
pop
().
textContent
;
expect
(
msg_txt
).
toEqual
(
msg_text
);
...
...
@@ -1724,7 +1724,7 @@
'
time
'
:
moment
().
format
(),
'
message
'
:
msg_text
});
view
.
model
.
sendMessage
(
m
essage
);
view
.
model
.
sendMessage
(
m
sg_text
);
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
msg_txt
=
sizzle
(
'
.chat-msg:last .chat-msg__text
'
,
chat_content
).
pop
().
textContent
;
expect
(
msg_txt
).
toEqual
(
msg_text
);
...
...
spec/muc.js
View file @
f84c2014
...
...
@@ -4645,12 +4645,6 @@
async
function
(
done
,
_converse
)
{
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
trollbox
'
,
'
localhost
'
,
'
troll
'
);
let
sent_IQ
,
IQ_id
;
const
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
sent_IQ
=
iq
;
IQ_id
=
sendIQ
.
bind
(
this
)(
iq
,
callback
,
errback
);
});
const
view
=
_converse
.
chatboxviews
.
get
(
'
trollbox@localhost
'
);
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
Hello world
'
;
...
...
src/converse-chatview.js
View file @
f84c2014
...
...
@@ -402,7 +402,7 @@ converse.plugins.add('converse-chatview', {
}
else
{
placeholder
=
__
(
'
Message
'
);
}
const
form_container
=
this
.
el
.
querySelector
(
'
.
message-form-container
'
);
const
form_container
=
this
.
el
.
querySelector
(
'
.
bottom-panel
'
);
form_container
.
innerHTML
=
tpl_chatbox_message_form
(
_
.
extend
(
this
.
model
.
toJSON
(),
{
'
hint_value
'
:
_
.
get
(
this
.
el
.
querySelector
(
'
.spoiler-hint
'
),
'
value
'
),
...
...
src/converse-muc-views.js
View file @
f84c2014
...
...
@@ -16,6 +16,7 @@ import muc_utils from "@converse/headless/utils/muc";
import
tpl_add_chatroom_modal
from
"
templates/add_chatroom_modal.html
"
;
import
tpl_chatarea
from
"
templates/chatarea.html
"
;
import
tpl_chatroom
from
"
templates/chatroom.html
"
;
import
tpl_chatroom_bottom_panel
from
"
templates/chatroom_bottom_panel.html
"
;
import
tpl_chatroom_destroyed
from
"
templates/chatroom_destroyed.html
"
;
import
tpl_chatroom_details_modal
from
"
templates/chatroom_details_modal.html
"
;
import
tpl_chatroom_disconnect
from
"
templates/chatroom_disconnect.html
"
;
...
...
@@ -539,6 +540,7 @@ converse.plugins.add('converse-muc-views', {
this
.
model
.
on
(
'
change:connection_status
'
,
this
.
afterConnected
,
this
);
this
.
model
.
on
(
'
change:jid
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:name
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:role
'
,
this
.
renderBottomPanel
,
this
);
this
.
model
.
on
(
'
change:subject
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:subject
'
,
this
.
setChatRoomSubject
,
this
);
this
.
model
.
on
(
'
configurationNeeded
'
,
this
.
getAndRenderConfigurationForm
,
this
);
...
...
@@ -585,8 +587,7 @@ converse.plugins.add('converse-muc-views', {
this
.
el
.
innerHTML
=
tpl_chatroom
();
this
.
renderHeading
();
this
.
renderChatArea
();
this
.
renderMessageForm
();
this
.
initMentionAutoComplete
();
this
.
renderBottomPanel
();
if
(
this
.
model
.
get
(
'
connection_status
'
)
!==
converse
.
ROOMSTATUS
.
ENTERED
)
{
this
.
showSpinner
();
}
...
...
@@ -598,6 +599,18 @@ converse.plugins.add('converse-muc-views', {
this
.
el
.
querySelector
(
'
.chat-head-chatroom
'
).
innerHTML
=
this
.
generateHeadingHTML
();
},
renderBottomPanel
()
{
const
container
=
this
.
el
.
querySelector
(
'
.bottom-panel
'
);
if
(
this
.
model
.
get
(
'
role
'
)
===
'
visitor
'
)
{
container
.
innerHTML
=
tpl_chatroom_bottom_panel
({
'
__
'
:
__
});
}
else
{
if
(
!
container
.
firstElementChild
||
!
container
.
querySelector
(
'
.sendXMPPMessage
'
))
{
this
.
renderMessageForm
();
this
.
initMentionAutoComplete
();
}
}
},
renderChatArea
()
{
/* Render the UI container in which groupchat messages will appear.
*/
...
...
src/headless/converse-chatboxes.js
View file @
f84c2014
...
...
@@ -696,6 +696,12 @@ converse.plugins.add('converse-chatboxes', {
return
!
_
.
isNil
(
sizzle
(
`result[xmlns="
${
Strophe
.
NS
.
MAM
}
"]`
,
original_stanza
).
pop
());
},
getErrorMessage
(
stanza
)
{
const
error
=
stanza
.
querySelector
(
'
error
'
);
return
_
.
propertyOf
(
error
.
querySelector
(
'
text
'
))(
'
textContent
'
)
||
__
(
'
Sorry, an error occurred:
'
)
+
'
'
+
error
.
innerHTML
;
},
getMessageBody
(
stanza
)
{
/* Given a message stanza, return the text contained in its body.
*/
...
...
@@ -899,12 +905,6 @@ converse.plugins.add('converse-chatboxes', {
chatbox
.
messages
.
create
(
attrs
);
},
getErrorMessage
(
stanza
)
{
const
error
=
stanza
.
querySelector
(
'
error
'
);
return
_
.
propertyOf
(
error
.
querySelector
(
'
text
'
))(
'
textContent
'
)
||
__
(
'
Sorry, an error occurred:
'
)
+
'
'
+
error
.
innerHTML
;
},
/**
* Handler method for all incoming single-user chat "message" stanzas.
* @private
...
...
src/headless/converse-muc.js
View file @
f84c2014
...
...
@@ -718,7 +718,7 @@ converse.plugins.add('converse-muc', {
*/
saveAffiliationAndRole
(
pres
)
{
const
item
=
sizzle
(
`x[xmlns="
${
Strophe
.
NS
.
MUC_USER
}
"] item`
,
pres
).
pop
();
const
is_self
=
pres
.
querySelector
(
"
status[code='110']
"
);
const
is_self
=
!
_
.
isNull
(
pres
.
querySelector
(
"
status[code='110']
"
)
);
if
(
is_self
&&
!
_
.
isNil
(
item
))
{
const
affiliation
=
item
.
getAttribute
(
'
affiliation
'
);
const
role
=
item
.
getAttribute
(
'
role
'
);
...
...
src/headless/dist/converse-headless.js
View file @
f84c2014
...
...
@@ -41045,6 +41045,11 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
return !_.isNil(sizzle(`result[xmlns="${Strophe.NS.MAM}"]`, original_stanza).pop());
},
getErrorMessage(stanza) {
const error = stanza.querySelector('error');
return _.propertyOf(error.querySelector('text'))('textContent') || __('Sorry, an error occurred:') + ' ' + error.innerHTML;
},
getMessageBody(stanza) {
/* Given a message stanza, return the text contained in its body.
*/
...
...
@@ -41265,11 +41270,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
chatbox.messages.create(attrs);
},
getErrorMessage(stanza) {
const error = stanza.querySelector('error');
return _.propertyOf(error.querySelector('text'))('textContent') || __('Sorry, an error occurred:') + ' ' + error.innerHTML;
},
/**
* Handler method for all incoming single-user chat "message" stanzas.
* @private
...
...
@@ -45819,7 +45819,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
*/
saveAffiliationAndRole(pres) {
const item = sizzle(`x[xmlns="${Strophe.NS.MUC_USER}"] item`, pres).pop();
const is_self =
pres.querySelector("status[code='110']"
);
const is_self =
!_.isNull(pres.querySelector("status[code='110']")
);
if (is_self && !_.isNil(item)) {
const affiliation = item.getAttribute('affiliation');
src/templates/chatarea.html
View file @
f84c2014
<div
class=
"chat-area col-md-9 col-8"
>
<div
class=
"chat-content {[ if (o.show_send_button) { ]}chat-content-sendbutton{[ } ]}"
aria-live=
"polite"
></div>
<div
class=
"
message-form-container
"
/>
<div
class=
"
bottom-panel
"
/>
</div>
src/templates/chatbox.html
View file @
f84c2014
<div
class=
"flyout box-flyout"
>
<div
class=
"chat-body"
>
<div
class=
"chat-content {[ if (o.show_send_button) { ]}chat-content-sendbutton{[ } ]}"
aria-live=
"polite"
></div>
<div
class=
"
message-form-container
"
></div>
<div
class=
"
bottom-panel
"
></div>
</div>
</div>
src/templates/chatroom_bottom_panel.html
0 → 100644
View file @
f84c2014
<div
class=
"muc-bottom-panel"
>
{{{o.__("You're not allowed to send messages in this room")}}}
</div>
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