diff --git a/src/headless/plugins/bookmarks/collection.js b/src/headless/plugins/bookmarks/collection.js index 8e1d561f7..1829470d7 100644 --- a/src/headless/plugins/bookmarks/collection.js +++ b/src/headless/plugins/bookmarks/collection.js @@ -1,4 +1,5 @@ import "@converse/headless/plugins/muc/index.js"; +import Bookmark from './model.js'; import log from "@converse/headless/log.js"; import { __ } from 'i18n'; import { _converse, api, converse } from "@converse/headless/core"; @@ -9,6 +10,7 @@ const u = converse.env.utils; const Bookmarks = { + model: Bookmark, comparator: (item) => item.get('name').toLowerCase(), initialize () { @@ -25,10 +27,6 @@ const Bookmarks = { this.browserStorage = _converse.createStore(cache_key); }, - model (attrs, options) { - return new _converse.Bookmark(attrs, options); - }, - async openBookmarkedRoom (bookmark) { if ( api.settings.get('muc_respect_autojoin') && bookmark.get('autojoin')) { const groupchat = await api.rooms.create( diff --git a/src/headless/plugins/bookmarks/index.js b/src/headless/plugins/bookmarks/index.js index 44843a590..44749d74b 100644 --- a/src/headless/plugins/bookmarks/index.js +++ b/src/headless/plugins/bookmarks/index.js @@ -102,7 +102,7 @@ converse.plugins.add('converse-bookmarks', { api.promises.add('bookmarksInitialized'); - _converse.Bookmark = Model.extend(Bookmark); + _converse.Bookmark = Bookmark; _converse.Bookmarks = Collection.extend(Bookmarks); _converse.BookmarksList = Model.extend({ diff --git a/src/headless/plugins/bookmarks/model.js b/src/headless/plugins/bookmarks/model.js index 6e8826f20..238ca68c0 100644 --- a/src/headless/plugins/bookmarks/model.js +++ b/src/headless/plugins/bookmarks/model.js @@ -1,12 +1,13 @@ import { converse } from '@converse/headless/core'; +import { Model } from '@converse/skeletor/src/model.js'; const { Strophe } = converse.env; -const Bookmark = { +const Bookmark = Model.extend({ idAttribute: 'jid', getDisplayName () { return Strophe.xmlunescape(this.get('name')); } -}; +}); export default Bookmark;