Commit 8a98ef87 authored by JC Brand's avatar JC Brand

Various small fixes. (Unused imports, unused vars etc).

parent 802f2b24
......@@ -30,7 +30,7 @@
</div>
</nav>
<section id="intro" class="intro" class="container">
<section id="intro" class="intro container">
<div class="row">
<div class="col-md-12 col-md-offset-2">
<h1 class="brand-heading fade-in">
......
......@@ -118,7 +118,6 @@
const jid = el.textContent.trim().replace(/ /g,'.').toLowerCase() + '@montague.lit';
el.click();
await test_utils.waitUntil(() => _converse.chatboxes.length == 2);
const chatboxview = _converse.chatboxviews.get(jid);
expect(_converse.chatboxviews.trimChats).toHaveBeenCalled();
// Check that new chat boxes are created to the left of the
// controlbox (but to the right of all existing chat boxes)
......@@ -127,7 +126,6 @@
await test_utils.waitUntil(() => _converse.chatboxes.length == 3);
el = online_contacts[1];
const new_jid = el.textContent.trim().replace(/ /g,'.').toLowerCase() + '@montague.lit';
const new_chatboxview = _converse.chatboxviews.get(new_jid);
expect(_converse.chatboxviews.trimChats).toHaveBeenCalled();
// Check that new chat boxes are created to the left of the
// controlbox (but to the right of all existing chat boxes)
......
......@@ -738,7 +738,6 @@
sent_stanza = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback);
});
const view = _converse.chatboxviews.get(contact_jid);
await test_utils.waitUntil(() => sent_stanza);
const stanza_el = sent_stanza.root().nodeTree;
const queryid = stanza_el.querySelector('query').getAttribute('queryid');
......
......@@ -1712,7 +1712,7 @@
await _converse.api.chats.open(sender_jid)
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({
view.model.messages.create({
'msgid': '82bc02ce-9651-4336-baf0-fa04762ed8d2',
'fullname': fullname,
'sender': 'me',
......@@ -1729,7 +1729,7 @@
// not be received, to test that errors appear
// after the relevant message.
msg_text = 'This message will be sent, and also receive an error';
message = view.model.messages.create({
view.model.messages.create({
'msgid': '6fcdeee3-000f-4ce8-a17e-9ce28f0ae104',
'fullname': fullname,
'sender': 'me',
......@@ -1797,7 +1797,7 @@
// not be received, to test that errors appear
// after the relevant message.
msg_text = 'This message will be sent, and also receive an error';
message = view.model.messages.create({
view.model.messages.create({
'msgid': 'another-id',
'fullname': fullname,
'sender': 'me',
......
......@@ -103,9 +103,8 @@
// (when it's a new room being created).
spyOn(_converse.ChatRoom.prototype, 'getRoomFeatures').and.callFake(() => Promise.resolve());
const sent_IQ_els = [];
let jid = 'lounge@montague.lit';
let chatroomview, sent_IQ, IQ_id;
let chatroomview, IQ_id;
test_utils.openControlBox();
test_utils.createContacts(_converse, 'current');
await test_utils.waitUntil(() => _converse.rosterview.el.querySelectorAll('.roster-group .group-toggle').length);
......@@ -163,6 +162,7 @@
'whois': 'anyone'
}
});
expect(room instanceof Backbone.Model).toBeTruthy();
chatroomview = _converse.chatboxviews.get('room@conference.example.org');
// We pretend this is a new room, so no disco info is returned.
......@@ -1436,8 +1436,9 @@
'var': 'muc#roomconfig_passwordprotectedroom'})
.c('value').t(1).up().up()
.c('field', {'type': 'fixed'})
.c('value').t('If a password is required to enter this groupchat,'+
'you must specify the password below.').up().up()
.c('value').t(
'If a password is required to enter this groupchat, you must specify the password below.'
).up().up()
.c('field', {
'label': 'Password',
'type': 'text-private',
......@@ -1521,7 +1522,6 @@
// https://xmpp.org/extensions/xep-0045.html#exit
for (let i=mock.chatroom_names.length-1; i>-1; i--) {
const name = mock.chatroom_names[i];
const role = mock.chatroom_roles[name].role;
// See example 21 https://xmpp.org/extensions/xep-0045.html#enter-pres
const presence = $pres({
to:'romeo@montague.lit/pda',
......@@ -1569,15 +1569,13 @@
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
var name;
var view = _converse.chatboxviews.get('lounge@montague.lit'),
occupants = view.el.querySelector('.occupant-list');
var presence, role, jid, model;
var presence, jid;
for (var i=0; i<mock.chatroom_names.length; i++) {
name = mock.chatroom_names[i];
role = mock.chatroom_roles[name].role;
const name = mock.chatroom_names[i];
const role = mock.chatroom_roles[name].role;
// See example 21 https://xmpp.org/extensions/xep-0045.html#enter-pres
jid =
presence = $pres({
to:'romeo@montague.lit/pda',
from:'lounge@montague.lit/'+name
......@@ -1603,8 +1601,7 @@
// Test users leaving the groupchat
// https://xmpp.org/extensions/xep-0045.html#exit
for (i=mock.chatroom_names.length-1; i>-1; i--) {
name = mock.chatroom_names[i];
role = mock.chatroom_roles[name].role;
const name = mock.chatroom_names[i];
// See example 21 https://xmpp.org/extensions/xep-0045.html#enter-pres
presence = $pres({
to:'romeo@montague.lit/pda',
......@@ -2083,7 +2080,6 @@
_converse.connection._dataRecv(test_utils.createRequest(stanza));
const view = _converse.chatboxviews.get('jdev@conference.jabber.org');
await new Promise((resolve, reject) => view.model.once('change:subject', resolve));
let chat_content = view.el.querySelector('.chat-content');
expect(sizzle('.chat-event:last').pop().textContent).toBe('Topic set by ralphm');
expect(sizzle('.chat-topic:last').pop().textContent).toBe(text);
expect(view.el.querySelector('.chatroom-description').textContent).toBe(text);
......@@ -2095,7 +2091,6 @@
</message>`);
_converse.connection._dataRecv(test_utils.createRequest(stanza));
await new Promise((resolve, reject) => view.once('messageInserted', resolve));
chat_content = view.el.querySelector('.chat-content');
expect(sizzle('.chat-topic').length).toBe(1);
expect(sizzle('.chat-msg__subject').length).toBe(1);
expect(sizzle('.chat-msg__subject').pop().textContent).toBe('This is a message subject');
......
......@@ -3,7 +3,6 @@
} (this, function (jasmine, mock, test_utils) {
const _ = converse.env._,
$iq = converse.env.$iq,
$pres = converse.env.$pres,
Strophe = converse.env.Strophe,
sizzle = converse.env.sizzle,
u = converse.env.utils;
......@@ -77,7 +76,7 @@
const IQ_stanzas = _converse.connection.IQ_stanzas;
const muc_jid = 'coven@chat.shakespeare.lit';
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.chatboxviews.get(muc_jid);
let stanza = await test_utils.waitUntil(() => _.filter(
......
......@@ -121,7 +121,6 @@
async function (done, _converse) {
const filter = _converse.rosterview.el.querySelector('.roster-filter');
const names = mock.cur_names;
test_utils.openControlBox();
expect(_.isNull(filter)).toBe(false);
test_utils.createContacts(_converse, 'current').openControlBox();
......
......@@ -10,16 +10,16 @@
* Converse.js plugin which adds views for XEP-0048 bookmarks
*/
import "backbone.nativeview";
import "@converse/headless/converse-muc";
import BrowserStorage from "backbone.browserStorage";
import { OrderedListView } from "backbone.overview";
import converse from "@converse/headless/converse-core";
import muc from "@converse/headless/converse-muc";
import tpl_bookmark from "templates/bookmark.html";
import tpl_bookmarks_list from "templates/bookmarks_list.html"
import tpl_chatroom_bookmark_form from "templates/chatroom_bookmark_form.html";
import tpl_chatroom_bookmark_toggle from "templates/chatroom_bookmark_toggle.html";
const { Backbone, Promise, Strophe, $iq, sizzle, _ } = converse.env;
const { Backbone, Strophe, _ } = converse.env;
const u = converse.env.utils;
......
......@@ -41,9 +41,8 @@ import tpl_spinner from "templates/spinner.html";
import xss from "xss/dist/xss";
const { Backbone, Promise, Strophe, dayjs, sizzle, _, $build, $iq, $msg, $pres } = converse.env;
const { Backbone, Promise, Strophe, dayjs, sizzle, _, $iq, $msg, $pres } = converse.env;
const u = converse.env.utils;
const AFFILIATION_CHANGE_COMANDS = ['admin', 'ban', 'owner', 'member', 'revoke'];
const OWNER_COMMANDS = ['owner'];
const ADMIN_COMMANDS = ['admin', 'ban', 'deop', 'destroy', 'member', 'op', 'revoke'];
const MODERATOR_COMMANDS = ['kick', 'mute', 'voice'];
......@@ -1202,11 +1201,9 @@ converse.plugins.add('converse-muc-views', {
u.hideElement(this.el.querySelector('.occupants'));
sizzle('.spinner', this.el).forEach(u.removeElement);
const message = this.model.get('destroyed_message');
const reason = this.model.get('destroyed_reason');
const moved_jid = this.model.get('moved_jid');
this.model.save({
'destroyed_message': undefined,
'destroyed_reason': undefined,
'moved_jid': undefined
});
......
......@@ -9,9 +9,9 @@
* @description
* Converse.js plugin which adds views for bookmarks specified in XEP-0048.
*/
import "@converse/headless/converse-muc";
import BrowserStorage from "backbone.browserStorage";
import converse from "@converse/headless/converse-core";
import muc from "@converse/headless/converse-muc";
const { Backbone, Promise, Strophe, $iq, sizzle, _ } = converse.env;
const u = converse.env.utils;
......
......@@ -12,7 +12,6 @@ import BrowserStorage from "backbone.browserStorage";
import converse from "./converse-core";
const { Backbone, Strophe, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-bosh', {
......
......@@ -918,7 +918,7 @@ converse.plugins.add('converse-chatboxes', {
attrs.fullname = _converse.xmppstatus.get('fullname');
} else {
attrs.sender = 'them';
attrs.fullname = this.get('fullname') || this.get('fullname')
attrs.fullname = this.get('fullname');
}
}
sizzle(`x[xmlns="${Strophe.NS.OUTOFBAND}"]`, stanza).forEach(xform => {
......
......@@ -6,10 +6,9 @@
/**
* @module converse-core
*/
import * as bosh from 'strophe.js/src/bosh';
import 'strophe.js/src/bosh';
import 'strophe.js/src/websocket';
import * as strophe from 'strophe.js/src/core';
import * as websocket from 'strophe.js/src/websocket';
import Backbone from 'backbone';
import BrowserStorage from 'backbone.browserStorage';
import Promise from 'es6-promise/dist/es6-promise.auto';
......@@ -213,7 +212,7 @@ _converse.default_settings = {
csi_waiting_time: 0, // Support for XEP-0352. Seconds before client is considered idle and CSI is sent out.
debug: false,
default_state: 'online',
geouri_regex: /https:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g,
geouri_regex: /https\:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g,
geouri_replacement: 'https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2',
idle_presence_timeout: 300, // Seconds after which an idle presence is sent
jid: undefined,
......
......@@ -23,7 +23,7 @@ const MUC_ROLE_WEIGHTS = {
'none': 2,
};
const { Strophe, Backbone, Promise, $iq, $build, $msg, $pres, sizzle, dayjs, _ } = converse.env;
const { Strophe, Backbone, Promise, $iq, $build, $msg, $pres, sizzle, _ } = converse.env;
// Add Strophe Namespaces
Strophe.addNamespace('MUC_ADMIN', Strophe.NS.MUC + "#admin");
......@@ -1445,9 +1445,8 @@ converse.plugins.add('converse-muc', {
'to': `${this.get('jid')}/${this.get('nick')}`,
'type': "get"
}).c("ping", {'xmlns': Strophe.NS.PING});
let result;
try {
result = await _converse.api.sendIQ(ping);
await _converse.api.sendIQ(ping);
} catch (e) {
const sel = `error not-acceptable[xmlns="${Strophe.NS.STANZAS}"]`;
if (_.isElement(e) && sizzle(sel, e).length) {
......
......@@ -24,7 +24,7 @@ import tpl_select_option from "../templates/select_option.html";
import tpl_video from "../templates/video.html";
import u from "../headless/utils/core";
const URL_REGEX = /\b(https?:\/\/|www\.|https?:\/\/www\.)[^\s<>]{2,200}\b\/?/g;
const URL_REGEX = /\b(https?\:\/\/|www\.|https?:\/\/www\.)[^\s<>]{2,200}\b\/?/g;
function getAutoCompleteProperty (name, options) {
return {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment