Commit 4c924a66 authored by JC Brand's avatar JC Brand

Split bookmarks plugin into headless and views

Fixes #1577
parent 0e49ebf6
......@@ -48,7 +48,7 @@ converse.plugins.add('converse-roomslist', {
comparator (room) {
if (room.get('bookmarked')) {
const bookmark = _.head(_converse.bookmarksview.model.where({'jid': room.get('jid')}));
const bookmark = _.head(_converse.bookmarks.where({'jid': room.get('jid')}));
return bookmark.get('name');
} else {
return room.get('name');
......@@ -139,8 +139,8 @@ converse.plugins.add('converse-roomslist', {
},
getRoomsListElementName () {
if (this.model.get('bookmarked') && _converse.bookmarksview) {
const bookmark = _.head(_converse.bookmarksview.model.where({'jid': this.model.get('jid')}));
if (this.model.get('bookmarked') && _converse.bookmarks) {
const bookmark = _.head(_converse.bookmarks.where({'jid': this.model.get('jid')}));
return bookmark.get('name');
} else {
return this.model.get('name');
......
......@@ -8,8 +8,9 @@ import "@converse/headless/converse-mam"; // XEP-0313 Message Archiv
import "@converse/headless/converse-ping"; // XEP-0199 XMPP Ping
import "@converse/headless/converse-pubsub"; // XEP-0060 PubSub
import "@converse/headless/converse-vcard"; // XEP-0054 VCard-temp
import "@converse/headless/converse-bookmarks"; // XEP-0048 Bookmarks
import "converse-autocomplete";
import "converse-bookmarks"; // XEP-0048 Bookmarks
import "converse-bookmark-views"; // Views for XEP-0048 Bookmarks
import "converse-chatview"; // Renders standalone chat boxes for single user chat
import "converse-controlbox"; // The control box
import "converse-dragresize"; // Allows chat boxes to be resized by dragging them
......@@ -31,7 +32,7 @@ import converse from "@converse/headless/converse-core";
const WHITELISTED_PLUGINS = [
'converse-autocomplete',
'converse-bookmarks',
'converse-bookmark-views',
'converse-chatboxviews',
'converse-chatview',
'converse-controlbox',
......
// Converse.js (A browser based XMPP chat client)
// https://conversejs.org
//
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2019, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
......@@ -65,6 +65,8 @@ converse.plugins.add('converse-bookmarks', {
allow_public_bookmarks: false
});
_converse.api.promises.add('bookmarksInitialized');
/**
* Check if the user has a bookmark with a saved nickanme
* for this groupchat and return it.
......@@ -72,7 +74,7 @@ converse.plugins.add('converse-bookmarks', {
* @method _converse#getNicknameFromBookmark
*/
_converse.getNicknameFromBookmark = function (jid) {
if (_converse.bookmarks || !_converse.allow_bookmarks) {
if (!_converse.bookmarks || !_converse.allow_bookmarks) {
return null;
}
const bookmark = _converse.bookmarks.findWhere({'jid': jid});
......
......@@ -86,6 +86,7 @@ pluggable.enable(_converse, '_converse', 'pluggable');
// These are just the @converse/headless plugins, for the full converse,
// the other plugins are whitelisted in src/converse.js
_converse.core_plugins = [
'converse-bookmarks',
'converse-caps',
'converse-chatboxes',
'converse-disco',
......
......@@ -3,6 +3,7 @@
* Any of the following components may be removed if they're not needed.
*/
import "./converse-pubsub"; // XEP-0199 XMPP Ping
import "./converse-bookmarks"; // XEP-0199 XMPP Ping
import "./converse-chatboxes"; // Backbone Collection and Models for chat boxes
import "./converse-disco"; // Service discovery plugin
import "./converse-mam"; // XEP-0313 Message Archive Management
......
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