another fix for #124

This commit is contained in:
or-else
2023-04-25 12:31:07 -07:00
parent 2b7c80ef2d
commit 5d56c17128
20 changed files with 55 additions and 41 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "tinode-webapp", "name": "tinode-webapp",
"description": "Tinode messenger for the web", "description": "Tinode messenger for the web",
"version": "0.22.6", "version": "0.22.7",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/tinode/webapp.git" "url": "https://github.com/tinode/webapp.git"
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "Liste: email:lisa@beispiel.de, tel:17025550003...", "translation": "Liste: email:lisa@beispiel.de, tel:17025550003...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -1000,7 +1000,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "List like email:alice@example.com, tel:17025550003...", "translation": "List like email:alice@example.com, tel:17025550003...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "Ej. email:alice@example.com, tel:17025550003...", "translation": "Ej. email:alice@example.com, tel:17025550003...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -801,7 +801,7 @@
"description": "Text shown in contacts view when query returned no results." "description": "Text shown in contacts view when query returned no results."
}, },
"search_placeholder": { "search_placeholder": {
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field" "description": "Placeholder in contacts search field"
}, },
"sidepanel_title_acc_notifications": { "sidepanel_title_acc_notifications": {
+1 -1
View File
@@ -1000,7 +1000,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "Liste comme email:alice@exemple.com, tel:17025550003...", "translation": "Liste comme email:alice@exemple.com, tel:17025550003...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "email:alice@example.com,tel:17025550003...와같은목록", "translation": "email:alice@example.com,tel:17025550003...와같은목록",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "Caută după e-mail sau număr telefon...", "translation": "Caută după e-mail sau număr telefon...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "Список, напр. email:alice@example.com, tel:+17025550003...", "translation": "Список, напр. email:alice@example.com, tel:+17025550003...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "例如 email:alice@example.com, tel:17025550003... 的清單", "translation": "例如 email:alice@example.com, tel:17025550003... 的清單",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -993,7 +993,7 @@
}, },
"search_placeholder": { "search_placeholder": {
"translation": "列表如 email:alice@example.com, tel:+17025550003...", "translation": "列表如 email:alice@example.com, tel:+17025550003...",
"defaultMessage": "List like email:alice@example.com, tel:17025550003...", "defaultMessage": "List like alice@example.com, +17025550003...",
"description": "Placeholder in contacts search field", "description": "Placeholder in contacts search field",
"missing": false, "missing": false,
"obsolete": false "obsolete": false
+1 -1
View File
@@ -1,3 +1,3 @@
// This is a generated file. Don't edit. // This is a generated file. Don't edit.
export const PACKAGE_VERSION = "0.22.6"; export const PACKAGE_VERSION = "0.22.7";
+19 -11
View File
@@ -108,6 +108,7 @@ class MessagesView extends React.Component {
this.state = MessagesView.getDerivedStateFromProps(props, {}); this.state = MessagesView.getDerivedStateFromProps(props, {});
this.componentSetup = this.componentSetup.bind(this);
this.leave = this.leave.bind(this); this.leave = this.leave.bind(this);
this.sendMessage = this.sendMessage.bind(this); this.sendMessage = this.sendMessage.bind(this);
this.retrySend = this.retrySend.bind(this); this.retrySend = this.retrySend.bind(this);
@@ -185,6 +186,8 @@ class MessagesView extends React.Component {
// Drag and drop events // Drag and drop events
this.mountDnDEvents(this.dndRef); this.mountDnDEvents(this.dndRef);
this.componentSetup({}, {});
} }
componentWillUnmount() { componentWillUnmount() {
@@ -205,9 +208,9 @@ class MessagesView extends React.Component {
} }
} }
// Scroll last message into view on component update e.g. on message received
// or vertical shrinking.
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
// Scroll last message into view on component update e.g. on message received
// or vertical shrinking.
if (this.messagesScroller && if (this.messagesScroller &&
(prevState.topic != this.state.topic || prevState.maxSeqId != this.state.maxSeqId || (prevState.topic != this.state.topic || prevState.maxSeqId != this.state.maxSeqId ||
prevState.minSeqId != this.state.minSeqId)) { prevState.minSeqId != this.state.minSeqId)) {
@@ -218,6 +221,18 @@ class MessagesView extends React.Component {
} }
} }
if (!this.props.applicationVisible) {
// If application is not visible, flush all unsent 'read' notifications.
this.clearNotificationQueue();
} else {
// Otherwise assume there are unread messages.
this.postReadNotification(0);
}
this.componentSetup(prevProps, prevState);
}
componentSetup(prevProps, prevState) {
const topic = this.props.tinode ? this.props.tinode.getTopic(this.state.topic) : undefined; const topic = this.props.tinode ? this.props.tinode.getTopic(this.state.topic) : undefined;
if (this.state.topic != prevState.topic) { if (this.state.topic != prevState.topic) {
if (prevState.topic && !Tinode.isNewGroupTopicName(prevState.topic)) { if (prevState.topic && !Tinode.isNewGroupTopicName(prevState.topic)) {
@@ -237,18 +252,11 @@ class MessagesView extends React.Component {
} }
} }
if (!this.props.applicationVisible) {
// If application is not visible, flush all unsent 'read' notifications.
this.clearNotificationQueue();
} else {
// Otherwise assume there are unread messages.
this.postReadNotification(0);
}
if (topic) { if (topic) {
if ((this.state.topic != prevState.topic) || !prevProps.ready) { if ((this.state.topic != prevState.topic) || !prevProps.ready) {
// Don't immediately subscribe to a new p2p topic, wait for the first message. // Don't immediately subscribe to a new p2p topic, wait for the first message.
if (topic._new && topic.isP2PType()) { const newTopic = (this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic);
if (topic.isP2PType() && newTopic) {
topic.getMeta(topic.startMetaQuery().withDesc().build()); topic.getMeta(topic.startMetaQuery().withDesc().build());
} else { } else {
this.subscribe(topic); this.subscribe(topic);
+3 -3
View File
@@ -25,7 +25,7 @@ const messages = defineMessages({
}, },
search_placeholder: { search_placeholder: {
id: "search_placeholder", id: "search_placeholder",
defaultMessage: "List like email:alice@example.com, tel:17025550003...", defaultMessage: "List like alice@example.com, +17025550003...",
description: "Placeholder in contacts search field" description: "Placeholder in contacts search field"
}, },
}); });
@@ -61,10 +61,10 @@ class NewTopicView extends React.Component {
this.setState({searchQuery: Tinode.isNullValue(query) ? null : query}); this.setState({searchQuery: Tinode.isNullValue(query) ? null : query});
} }
handleSearchResultSelected(name) { handleSearchResultSelected(topicName) {
if (this.state.tabSelected == 'find') { if (this.state.tabSelected == 'find') {
HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab')); HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));
this.props.onCreateTopic(name); this.props.onCreateTopic(topicName);
} }
} }
+1 -1
View File
@@ -1334,7 +1334,7 @@ class TinodeWeb extends React.Component {
const params = {}; const params = {};
if (Tinode.isP2PTopicName(topicName)) { if (Tinode.isP2PTopicName(topicName)) {
// Because we are initialing the subscription, set 'want' to all permissions. // Because we are initiating the subscription, set 'want' to all permissions.
params.sub = {mode: DEFAULT_P2P_ACCESS_MODE}; params.sub = {mode: DEFAULT_P2P_ACCESS_MODE};
// Give the other user all permissions too. // Give the other user all permissions too.
params.desc = {defacs: {auth: DEFAULT_P2P_ACCESS_MODE}}; params.desc = {defacs: {auth: DEFAULT_P2P_ACCESS_MODE}};
+16 -10
View File
@@ -3589,7 +3589,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "PACKAGE_VERSION": () => (/* binding */ PACKAGE_VERSION) /* harmony export */ "PACKAGE_VERSION": () => (/* binding */ PACKAGE_VERSION)
/* harmony export */ }); /* harmony export */ });
const PACKAGE_VERSION = "0.22.6"; const PACKAGE_VERSION = "0.22.7";
/***/ }), /***/ }),
@@ -5179,6 +5179,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
constructor(props) { constructor(props) {
super(props); super(props);
this.state = MessagesView.getDerivedStateFromProps(props, {}); this.state = MessagesView.getDerivedStateFromProps(props, {});
this.componentSetup = this.componentSetup.bind(this);
this.leave = this.leave.bind(this); this.leave = this.leave.bind(this);
this.sendMessage = this.sendMessage.bind(this); this.sendMessage = this.sendMessage.bind(this);
this.retrySend = this.retrySend.bind(this); this.retrySend = this.retrySend.bind(this);
@@ -5242,6 +5243,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
this.messagesScroller.addEventListener('scroll', this.handleScrollEvent); this.messagesScroller.addEventListener('scroll', this.handleScrollEvent);
} }
this.mountDnDEvents(this.dndRef); this.mountDnDEvents(this.dndRef);
this.componentSetup({}, {});
} }
componentWillUnmount() { componentWillUnmount() {
if (this.messagesScroller) { if (this.messagesScroller) {
@@ -5262,6 +5264,14 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
this.messagesScroller.scrollTop = this.messagesScroller.scrollHeight - this.state.scrollPosition - this.messagesScroller.offsetHeight; this.messagesScroller.scrollTop = this.messagesScroller.scrollHeight - this.state.scrollPosition - this.messagesScroller.offsetHeight;
} }
} }
if (!this.props.applicationVisible) {
this.clearNotificationQueue();
} else {
this.postReadNotification(0);
}
this.componentSetup(prevProps, prevState);
}
componentSetup(prevProps, prevState) {
const topic = this.props.tinode ? this.props.tinode.getTopic(this.state.topic) : undefined; const topic = this.props.tinode ? this.props.tinode.getTopic(this.state.topic) : undefined;
if (this.state.topic != prevState.topic) { if (this.state.topic != prevState.topic) {
if (prevState.topic && !tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.isNewGroupTopicName(prevState.topic)) { if (prevState.topic && !tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.isNewGroupTopicName(prevState.topic)) {
@@ -5279,14 +5289,10 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
topic.onPres = this.handleSubsUpdated; topic.onPres = this.handleSubsUpdated;
} }
} }
if (!this.props.applicationVisible) {
this.clearNotificationQueue();
} else {
this.postReadNotification(0);
}
if (topic) { if (topic) {
if (this.state.topic != prevState.topic || !prevProps.ready) { if (this.state.topic != prevState.topic || !prevProps.ready) {
if (topic._new && topic.isP2PType()) { const newTopic = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic;
if (topic.isP2PType() && newTopic) {
topic.getMeta(topic.startMetaQuery().withDesc().build()); topic.getMeta(topic.startMetaQuery().withDesc().build());
} else { } else {
this.subscribe(topic); this.subscribe(topic);
@@ -6583,7 +6589,7 @@ const messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_1__.defineMessages)({
id: "search_placeholder", id: "search_placeholder",
defaultMessage: [{ defaultMessage: [{
"type": 0, "type": 0,
"value": "List like email:alice@example.com, tel:17025550003..." "value": "List like alice@example.com, +17025550003..."
}] }]
} }
}); });
@@ -6616,10 +6622,10 @@ class NewTopicView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
searchQuery: tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.isNullValue(query) ? null : query searchQuery: tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.isNullValue(query) ? null : query
}); });
} }
handleSearchResultSelected(name) { handleSearchResultSelected(topicName) {
if (this.state.tabSelected == 'find') { if (this.state.tabSelected == 'find') {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_7__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_7__["default"].removeUrlParam(window.location.hash, 'tab')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_7__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_7__["default"].removeUrlParam(window.location.hash, 'tab'));
this.props.onCreateTopic(name); this.props.onCreateTopic(topicName);
} }
} }
handleNewGroupSubmit(name, description, dataUrl, priv, tags, isChannel) { handleNewGroupSubmit(name, description, dataUrl, priv, tags, isChannel) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,3 +1,3 @@
// This is a generated file. Don't edit. // This is a generated file. Don't edit.
const PACKAGE_VERSION = "0.22.6"; const PACKAGE_VERSION = "0.22.7";