Remaining code review items.

This commit is contained in:
aforge
2022-04-28 22:00:11 -07:00
parent ed62fe17c5
commit 706a7e0aaa
8 changed files with 59 additions and 35 deletions
+3 -3
View File
@@ -202,11 +202,11 @@ class InfoView extends React.Component {
deleter: acs && acs.isDeleter(),
muted: acs && acs.isMuted(),
fullName: clipStr(topic.public ? topic.public.fn : undefined, MAX_TITLE_LENGTH),
description: clipStr(topic.public ? topic.public.note : undefined, MAX_TOPIC_DESCRIPTION_LENGTH),
fullName: clipStr(topic.public && topic.public.fn, MAX_TITLE_LENGTH),
description: clipStr(topic.public && topic.public.note, MAX_TOPIC_DESCRIPTION_LENGTH),
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
trustedBadges: badges,
private: clipStr(topic.private ? topic.private.comment : null, MAX_TITLE_LENGTH),
private: clipStr(topic.private && topic.private.comment, MAX_TITLE_LENGTH),
archived: topic.isArchived(),
address: topic.name,
groupTopic: topic.isGroupType(),
+3 -7
View File
@@ -310,9 +310,7 @@ class MessagesView extends React.Component {
});
if (nextProps.callTopic == topic.name && shouldPresentCallPanel(nextProps.callState)) {
Object.assign(nextState, {
rtcPanel: nextProps.callTopic,
});
nextState.rtcPanel = nextProps.callTopic;
}
} else {
// Invalid topic.
@@ -330,9 +328,7 @@ class MessagesView extends React.Component {
// We are still in same topic. Show the call panel if necessary.
if (nextProps.callTopic == prevState.topic && !prevState.rtcPanel &&
shouldPresentCallPanel(nextProps.callState)) {
Object.assign(nextState, {
rtcPanel: nextProps.callTopic,
});
nextState.rtcPanel = nextProps.callTopic;
}
}
@@ -1149,7 +1145,7 @@ class MessagesView extends React.Component {
}
let duration;
if (msg.head && isVideoCall(msg.head.mime)) {
topic.messageVersions(msg, (cur, before, unused1, unused2) => {
topic.messageVersions(msg, (cur, before) => {
if (cur.content == 'finished' && before.content == 'accepted') {
duration = msg.ts - before.ts;
}
+5 -9
View File
@@ -1304,15 +1304,11 @@ class TinodeWeb extends React.Component {
// If the current URl contains the old topic name, replace it with new.
// Update the name of the selected topic first so the navigator doen't clear
// the state.
const newTopic = {topicSelected: newName};
this.setState(...nextState, ...newTopic, () => {
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', newName));
});
} else {
this.setState(nextState, () => {
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', newName));
});
nextState.topicSelected = newName;
}
this.setState(nextState, _ => {
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', newName));
});
}
handleTopicUpdateRequest(topicName, pub, priv, defacs) {
@@ -1814,7 +1810,7 @@ class TinodeWeb extends React.Component {
case 'accept':
console.log('TinodeWeb: received accept msg ', info);
// If another my session has accepted the call.
if (info.topic == 'me' && info.from == this.state.myUserId) {
if (Tinode.isMeTopicName(info.topic) && this.tinode.isMe(info.from)) {
this.setState({
callTopic: null,
callState: CALL_STATE_NONE,