Handling of forwarded messages in previews.

This commit is contained in:
aforge
2021-09-28 15:40:42 +03:00
parent 4f1c9e161a
commit 4ad0baf99a
10 changed files with 343 additions and 259 deletions
+1 -1
View File
@@ -855,7 +855,7 @@ class MessagesView extends React.Component {
typeof content == 'string' ?
Drafty.init(content) : content;
if (Drafty.isValid(content)) {
content = Drafty.preview(content, QUOTED_REPLY_LENGTH);
content = Drafty.preview(content, QUOTED_REPLY_LENGTH, undefined, forwarded != null);
} else {
// /!\ invalid content.
content = Drafty.append(Drafty.init('\u26A0 '),
+3 -3
View File
@@ -16,7 +16,7 @@ import MessagesView from './messages-view.jsx';
import SidepanelView from './sidepanel-view.jsx';
import { API_KEY, APP_NAME, DEFAULT_P2P_ACCESS_MODE, LOGGING_ENABLED,
MEDIA_BREAKPOINT, RECEIVED_DELAY } from '../config.js';
MEDIA_BREAKPOINT, QUOTED_REPLY_LENGTH, RECEIVED_DELAY } from '../config.js';
import { PACKAGE_VERSION } from '../version.js';
import { base64ReEncode, makeImageUrl } from '../lib/blob-helpers.js';
import { detectServerAddress, isLocalHost, isSecureConnection } from '../lib/host-name.js';
@@ -1455,8 +1455,8 @@ class TinodeWeb extends React.Component {
Tinode.Drafty.forwardedContent(params.content) :
typeof params.content == 'string' ?
Tinode.Drafty.init(params.content) : params.content;
//const content = typeof params.content == 'string' ? Tinode.Drafty.init(params.content) : params.content;
const preview = Tinode.Drafty.preview(content, 30);
const preview = Tinode.Drafty.preview(content, QUOTED_REPLY_LENGTH,
undefined, params.forwarded != null);
const msg = Tinode.Drafty.append(
Tinode.Drafty.appendLineBreak(
Tinode.Drafty.mention(header, params.userFrom)),
+2 -2
View File
@@ -82,11 +82,11 @@ class ContactList extends React.Component {
if (!this.props.showMode && c.latestMessage) {
const msg = c.latestMessage(true);
if (msg) {
forwarded = msg.head ? msg.head.forwarded : null;
deliveryStatus = msg._status || c.msgStatus(msg, true);
preview = typeof msg.content == 'string' ?
msg.content.substr(0, MESSAGE_PREVIEW_LENGTH) :
Drafty.preview(msg.content, MESSAGE_PREVIEW_LENGTH);
forwarded = msg.head ? msg.head.forwarded : undefined;
Drafty.preview(msg.content, MESSAGE_PREVIEW_LENGTH, undefined, forwarded != null);
}
}
contactNodes.push(
+3 -1
View File
@@ -65,7 +65,9 @@ export default class ForwardMenu extends React.Component {
}
render() {
const contacts = this.state.query != null ? this.props.searchResults : this.props.contacts;
let contacts = this.state.query != null ? this.props.searchResults : this.props.contacts;
// Filter out contacts without a 'W' permission.
contacts = contacts.filter((c) => { return c.acs.isJoiner() && c.acs.isWriter(); });
// Ensure that menu is inside the app-container.
const hSize = 20 * REM_SIZE;
const vSize = REM_SIZE * (0.7 + contacts.length * 3);