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
720087be
Commit
720087be
authored
Dec 11, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
controlbox: remove unnecessary overrides
parent
a4567ee0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
49 deletions
+36
-49
src/converse-chatboxviews.js
src/converse-chatboxviews.js
+0
-3
src/converse-controlbox.js
src/converse-controlbox.js
+36
-46
No files found.
src/converse-chatboxviews.js
View file @
720087be
...
...
@@ -131,9 +131,6 @@ converse.plugins.add('converse-chatboxviews', {
},
closeAllChatBoxes
()
{
/* This method gets overridden in src/converse-controlbox.js if
* the controlbox plugin is active.
*/
return
Promise
.
all
(
this
.
map
(
v
=>
v
.
close
({
'
name
'
:
'
closeAllChatBoxes
'
})));
}
});
...
...
src/converse-controlbox.js
View file @
720087be
...
...
@@ -72,10 +72,12 @@ converse.plugins.add('converse-controlbox', {
*/
dependencies
:
[
"
converse-modal
"
,
"
converse-chatboxes
"
,
"
converse-chat
"
,
"
converse-rosterview
"
,
"
converse-chatview
"
],
enabled
(
_converse
)
{
return
!
_converse
.
singleton
;
},
overrides
:
{
// Overrides mentioned here will be picked up by converse.js's
// plugin architecture they will replace existing methods on the
...
...
@@ -92,52 +94,10 @@ converse.plugins.add('converse-controlbox', {
return
this
.
__super__
.
model
.
apply
(
this
,
arguments
);
}
}
},
ChatBoxViews
:
{
closeAllChatBoxes
()
{
const
{
_converse
}
=
this
.
__super__
;
this
.
forEach
(
function
(
view
)
{
if
(
view
.
model
.
get
(
'
id
'
)
===
'
controlbox
'
&&
(
_converse
.
disconnection_cause
!==
_converse
.
LOGOUT
||
_converse
.
show_controlbox_by_default
))
{
return
;
}
view
.
close
();
});
return
this
;
}
},
ChatBox
:
{
validate
(
attrs
)
{
const
{
_converse
}
=
this
.
__super__
;
if
(
attrs
.
type
===
_converse
.
CONTROLBOX_TYPE
)
{
if
(
_converse
.
view_mode
===
'
embedded
'
&&
_converse
.
singleton
)
{
return
'
Controlbox not relevant in embedded view mode
'
;
}
return
;
}
return
this
.
__super__
.
validate
.
apply
(
this
,
arguments
);
},
maybeShow
(
force
)
{
if
(
!
force
&&
this
.
get
(
'
id
'
)
===
'
controlbox
'
)
{
// Must return the chatbox
return
this
;
}
return
this
.
__super__
.
maybeShow
.
apply
(
this
,
arguments
);
},
initialize
()
{
if
(
this
.
get
(
'
id
'
)
===
'
controlbox
'
)
{
this
.
set
({
'
time_opened
'
:
dayjs
(
0
).
valueOf
()});
}
else
{
this
.
__super__
.
initialize
.
apply
(
this
,
arguments
);
}
}
}
},
initialize
()
{
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
...
...
@@ -156,8 +116,6 @@ converse.plugins.add('converse-controlbox', {
_converse
.
api
.
promises
.
add
(
'
controlBoxInitialized
'
);
const
addControlBox
=
()
=>
_converse
.
chatboxes
.
add
({
'
id
'
:
'
controlbox
'
});
_converse
.
ControlBox
=
_converse
.
ChatBox
.
extend
({
defaults
()
{
...
...
@@ -173,10 +131,42 @@ converse.plugins.add('converse-controlbox', {
}
},
onReconnection
:
function
onReconnection
()
{}
initialize
()
{
if
(
this
.
get
(
'
id
'
)
===
'
controlbox
'
)
{
this
.
set
({
'
time_opened
'
:
dayjs
(
0
).
valueOf
()});
}
else
{
_converse
.
ChatBox
.
prototype
.
initialize
.
apply
(
this
,
arguments
);
}
},
validate
(
attrs
)
{
if
(
attrs
.
type
===
_converse
.
CONTROLBOX_TYPE
)
{
if
(
_converse
.
view_mode
===
'
embedded
'
&&
_converse
.
singleton
)
{
return
'
Controlbox not relevant in embedded view mode
'
;
}
return
;
}
return
_converse
.
ChatBox
.
prototype
.
validate
.
call
(
this
,
attrs
);
},
maybeShow
(
force
)
{
if
(
!
force
&&
this
.
get
(
'
id
'
)
===
'
controlbox
'
)
{
// Must return the chatbox
return
this
;
}
return
_converse
.
ChatBox
.
prototype
.
maybeShow
.
call
(
this
,
force
);
},
onReconnection
:
function
onReconnection
()
{}
});
function
addControlBox
()
{
const
m
=
new
_converse
.
ControlBox
({
'
id
'
:
'
controlbox
'
});
return
_converse
.
chatboxes
.
add
(
m
);
}
_converse
.
ControlBoxView
=
_converse
.
ChatBoxView
.
extend
({
tagName
:
'
div
'
,
className
:
'
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