bug fixes: crash in editing group member permissions, fnd not working sometimes, var -> let, const
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
// This is a generated file. Don't edit.
|
||||
|
||||
export const PACKAGE_VERSION = "0.15.10";
|
||||
export const PACKAGE_VERSION = "0.15.11-rc1";
|
||||
|
||||
+11
-8
@@ -97,8 +97,8 @@ class InfoView extends React.Component {
|
||||
}
|
||||
|
||||
// No need to separately handle component mount.
|
||||
UNSAFE_componentWillReceiveProps(props) {
|
||||
var topic = this.props.tinode.getTopic(props.topic);
|
||||
componentDidUpdate(props) {
|
||||
let topic = this.props.tinode.getTopic(props.topic);
|
||||
if (!topic) {
|
||||
return;
|
||||
}
|
||||
@@ -137,17 +137,17 @@ class InfoView extends React.Component {
|
||||
}
|
||||
|
||||
resetSubs(topic, props) {
|
||||
var newState = {contactList: []};
|
||||
const newState = {contactList: []};
|
||||
if (topic.getType() == 'p2p') {
|
||||
// Fetch the other party in the p2p conversation.
|
||||
// Topic may not be ready yet, so check if user is found.
|
||||
var user2 = topic.subscriber(props.topic);
|
||||
const user2 = topic.subscriber(props.topic);
|
||||
if (user2) {
|
||||
newState.modeGiven2 = user2.acs.getGiven();
|
||||
newState.modeWant2 = user2.acs.getWant();
|
||||
}
|
||||
} else {
|
||||
topic.subscribers(function(sub) {
|
||||
topic.subscribers((sub) => {
|
||||
newState.contactList.push(sub);
|
||||
}, this);
|
||||
}
|
||||
@@ -156,12 +156,15 @@ class InfoView extends React.Component {
|
||||
}
|
||||
|
||||
resetDesc(topic, props) {
|
||||
var defacs = topic.getDefaultAccess() || {};
|
||||
var acs = topic.getAccessMode();
|
||||
const defacs = topic.getDefaultAccess() || {};
|
||||
const acs = topic.getAccessMode();
|
||||
|
||||
console.log("Desc:", defacs, acs);
|
||||
|
||||
this.setState({
|
||||
owner: acs && acs.isOwner(),
|
||||
admin: acs && acs.isAdmin(),
|
||||
sharer: acs && (acs.isAdmin() || acs.isSharer()),
|
||||
sharer: acs && acs.isSharer(),
|
||||
muted: acs && acs.isMuted(),
|
||||
|
||||
fullName: topic.public ? topic.public.fn : undefined,
|
||||
|
||||
@@ -15,8 +15,7 @@ export default class NewTopicView extends React.Component {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
tabSelected: 'p2p',
|
||||
contactList: props.searchResults
|
||||
tabSelected: 'p2p'
|
||||
};
|
||||
|
||||
this.handleTabClick = this.handleTabClick.bind(this);
|
||||
@@ -29,12 +28,6 @@ export default class NewTopicView extends React.Component {
|
||||
this.props.onInitFind();
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState) {
|
||||
return {
|
||||
contactList: nextProps.searchResults
|
||||
};
|
||||
}
|
||||
|
||||
handleTabClick(e) {
|
||||
e.preventDefault();
|
||||
HashNavigation.navigateTo(HashNavigation.addUrlParam(window.location.hash, 'tab', e.currentTarget.dataset.id));
|
||||
@@ -93,10 +86,9 @@ export default class NewTopicView extends React.Component {
|
||||
<FormattedMessage id="search_for_contacts" defaultMessage="Use search to find contacts"
|
||||
description="Prompt in search field.">{
|
||||
(search_for_contacts) => <ContactList
|
||||
contacts={this.state.contactList}
|
||||
contacts={this.props.searchResults}
|
||||
myUserId={this.props.myUserId}
|
||||
emptyListMessage={search_for_contacts}
|
||||
topicSelected={this.state.selectedContact}
|
||||
showOnline={false}
|
||||
showUnread={false}
|
||||
showContextMenu={false}
|
||||
|
||||
@@ -552,7 +552,7 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
// Sending "received" notifications
|
||||
tnData(data) {
|
||||
let topic = this.tinode.getTopic(data.topic);
|
||||
const topic = this.tinode.getTopic(data.topic);
|
||||
if (topic.msgStatus(data) >= Tinode.MESSAGE_STATUS_SENT) {
|
||||
clearTimeout(this.receivedTimer);
|
||||
this.receivedTimer = setTimeout(() => {
|
||||
@@ -564,11 +564,11 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
/* Fnd topic: find contacts by tokens */
|
||||
tnInitFind() {
|
||||
let fnd = this.tinode.getFndTopic();
|
||||
const fnd = this.tinode.getFndTopic();
|
||||
fnd.onSubsUpdated = this.tnFndSubsUpdated;
|
||||
if (fnd.isSubscribed()) {
|
||||
this.tnFndSubsUpdated();
|
||||
} else {
|
||||
fnd.onSubsUpdated = this.tnFndSubsUpdated;
|
||||
fnd.subscribe(fnd.startMetaQuery().withSub().withTags().build()).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
@@ -576,7 +576,7 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
|
||||
tnFndSubsUpdated() {
|
||||
let foundContacts = [];
|
||||
const foundContacts = [];
|
||||
// Don't attempt to create P2P topics which already exist. Server will reject the duplicates.
|
||||
this.tinode.getFndTopic().contacts((s) => {
|
||||
foundContacts.push(s);
|
||||
@@ -591,7 +591,7 @@ class TinodeWeb extends React.Component {
|
||||
@param query {Array} is an array of contacts to search for
|
||||
*/
|
||||
handleSearchContacts(query) {
|
||||
var fnd = this.tinode.getFndTopic();
|
||||
const fnd = this.tinode.getFndTopic();
|
||||
fnd.setMeta({desc: {public: query}}).then((ctrl) => {
|
||||
return fnd.getMeta(fnd.startMetaQuery().withSub().build());
|
||||
}).catch((err) => {
|
||||
@@ -848,9 +848,9 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
|
||||
handleTopicUpdateRequest(topicName, pub, priv, permissions) {
|
||||
var topic = this.tinode.getTopic(topicName);
|
||||
const topic = this.tinode.getTopic(topicName);
|
||||
if (topic) {
|
||||
var params = {};
|
||||
const params = {};
|
||||
if (pub) {
|
||||
params.public = pub;
|
||||
}
|
||||
@@ -868,9 +868,9 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
|
||||
handleChangePermissions(topicName, mode, uid) {
|
||||
var topic = this.tinode.getTopic(topicName);
|
||||
const topic = this.tinode.getTopic(topicName);
|
||||
if (topic) {
|
||||
var am = topic.getAccessMode();
|
||||
const am = topic.getAccessMode();
|
||||
if (uid) {
|
||||
am.updateGiven(mode);
|
||||
mode = am.getGiven();
|
||||
|
||||
@@ -27,11 +27,11 @@ class ContactList extends React.Component {
|
||||
const contactNodes = [];
|
||||
if (this.props.contacts && this.props.contacts.length > 0) {
|
||||
this.props.contacts.map((c) => {
|
||||
var key = c.topic ? c.topic : c.user;
|
||||
let key = c.topic ? c.topic : c.user;
|
||||
// If filter function is provided, filter out the items
|
||||
// which don't satisfy the condition.
|
||||
if (this.props.filterFunc && this.props.filter) {
|
||||
var content = [key];
|
||||
let content = [key];
|
||||
if (c.private && c.private.comment) {
|
||||
content.push(('' + c.private.comment).toLowerCase());
|
||||
}
|
||||
@@ -43,10 +43,10 @@ class ContactList extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
var selected = showCheckmark ?
|
||||
let selected = showCheckmark ?
|
||||
(this.props.topicSelected.indexOf(key) > -1) :
|
||||
(this.props.topicSelected === key);
|
||||
var badges = [];
|
||||
let badges = [];
|
||||
if (this.props.showMode) {
|
||||
if (key === this.props.myUserId) {
|
||||
badges.push({name: formatMessage(messages.badge_you), color: 'green'});
|
||||
@@ -55,7 +55,7 @@ class ContactList extends React.Component {
|
||||
badges.push({name: formatMessage(messages.badge_owner), color: 'blue'});
|
||||
}
|
||||
}
|
||||
var comment = Array.isArray(c.private) ?
|
||||
let comment = Array.isArray(c.private) ?
|
||||
c.private.join(',') : (c.private ? c.private.comment : null);
|
||||
|
||||
contactNodes.push(
|
||||
|
||||
@@ -36,9 +36,9 @@ export default class Contact extends React.Component {
|
||||
// FIXME: this is probably wrong for RTL languages.
|
||||
title = title.substring(0, 28) + '...';
|
||||
}
|
||||
let online = this.props.now ? 'online' : 'offline';
|
||||
let avatar = this.props.avatar ? this.props.avatar : true;
|
||||
let badges = this.props.badges.slice();
|
||||
const online = this.props.now ? 'online' : 'offline';
|
||||
const avatar = this.props.avatar ? this.props.avatar : true;
|
||||
const badges = this.props.badges ? this.props.badges.slice() : [];
|
||||
if (this.props.showMode && this.props.acs) {
|
||||
badges.push({name: this.props.acs.getMode(), key: 'mode'});
|
||||
}
|
||||
|
||||
@@ -8,21 +8,11 @@ import { makeImageUrl } from '../lib/blob-helpers.js';
|
||||
export default class GroupSubs extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
onlineSubs: props.subscribers || []
|
||||
};
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState) {
|
||||
return {
|
||||
onlineSubs: nextProps.subscribers ? nextProps.subscribers : []
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
var usersOnline = [];
|
||||
this.state.onlineSubs.map((sub) => {
|
||||
const usersOnline = [];
|
||||
(this.props.subscribers || []).map((sub) => {
|
||||
usersOnline.push(
|
||||
<div className="avatar-box" key={sub.user}>
|
||||
<LetterTile
|
||||
|
||||
Reference in New Issue
Block a user