Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleTopicUpdateRequest(topicName, pub, priv, permissions) {
const topic = this.tinode.getTopic(topicName);
if (topic) {
const params = {};
if (pub) {
params.public = pub;
}
if (priv) {
params.private = (priv === Tinode.DEL_CHAR) ?
Tinode.DEL_CHAR : {comment: priv};
}
if (permissions) {
params.defacs = permissions;
}
topic.setMeta({desc: params}).catch((err) => {
this.handleError(err.message, 'err');
});
}
}
handleClear(e) {
e.preventDefault();
if (this.state.edited) {
this.props.onSearchContacts(Tinode.DEL_CHAR);
}
this.setState({search: '', edited: false});
}
handlePrivateUpdate(comment) {
comment = comment.trim().substring(0, MAX_TITLE_LENGTH);
if (this.state.private !== comment) {
this.setState({private: comment});
this.props.onTopicDescUpdate(this.props.topic, null, comment || Tinode.DEL_CHAR);
}
}
handleImageChanged(img) {
this.setState({avatar: img});
this.props.onUpdateAccount(undefined, vcard(null, img || Tinode.DEL_CHAR));
}
handleTopicUpdateRequest(topicName, pub, priv, permissions) {
const topic = this.tinode.getTopic(topicName);
if (topic) {
const params = {};
if (pub) {
params.public = pub;
}
if (priv) {
params.private = (priv === Tinode.DEL_CHAR) ?
Tinode.DEL_CHAR : {comment: priv};
}
if (permissions) {
params.defacs = permissions;
}
topic.setMeta({desc: params}).catch((err) => {
this.handleError(err.message, 'err');
});
}
}