This repository has been archived on 2022-09-21. You can view files and clone it, but cannot push or open issues or pull requests.
converse.js/src/headless/plugins/chat/model-with-contact.js

22 lines
579 B
JavaScript

import { Model } from '@converse/skeletor/src/model.js';
import { api } from "../../core.js";
import { getOpenPromise } from '@converse/openpromise';
const ModelWithContact = Model.extend({
initialize () {
this.rosterContactAdded = getOpenPromise();
},
async setRosterContact (jid) {
const contact = await api.contacts.get(jid);
if (contact) {
this.contact = contact;
this.set('nickname', contact.get('nickname'));
this.rosterContactAdded.resolve();
}
}
});
export default ModelWithContact;