remove body pending loading of message > 2000.

Also remove the limit when sending text messages
This commit is contained in:
Audric Ackermann 2021-01-27 11:57:38 +11:00
parent 0fe026ab15
commit 7054385d4a
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
4 changed files with 17 additions and 54 deletions

View file

@ -82,9 +82,7 @@ export class MessageBody extends React.Component<Props> {
isGroup: false,
};
public addDownloading(jsx: JSX.Element): JSX.Element {
const { i18n } = this.props;
public renderJsxSelectable(jsx: JSX.Element): JSX.Element {
return <span className="text-selectable">{jsx}</span>;
}
@ -100,7 +98,7 @@ export class MessageBody extends React.Component<Props> {
const sizeClass = disableJumbomoji ? undefined : getSizeClass(text);
if (disableLinks) {
return this.addDownloading(
return this.renderJsxSelectable(
renderEmoji({
i18n,
text,
@ -113,24 +111,7 @@ export class MessageBody extends React.Component<Props> {
);
}
const bodyContents = this.addDownloading(
<Linkify
text={text}
renderNonLink={({ key, text: nonLinkText }) => {
return renderEmoji({
i18n,
text: nonLinkText,
sizeClass,
key,
renderNonEmoji: renderNewLines,
isGroup,
convoId,
});
}}
/>
);
return this.addDownloading(
return this.renderJsxSelectable(
<Linkify
text={text}
renderNonLink={({ key, text: nonLinkText }) => {

View file

@ -96,14 +96,14 @@ export const MessageMetadata = (props: Props) => {
theme={theme}
/>
) : (
<Timestamp
timestamp={serverTimestamp || timestamp}
extended={true}
withImageNoCaption={withImageNoCaption}
isConversationListItem={false}
theme={theme}
/>
)}
<Timestamp
timestamp={serverTimestamp || timestamp}
extended={true}
withImageNoCaption={withImageNoCaption}
isConversationListItem={false}
theme={theme}
/>
)}
<MetadataBadges
direction={direction}
isPublic={isPublic}
@ -122,7 +122,6 @@ export const MessageMetadata = (props: Props) => {
/>
) : null}
<MetadataSpacer />
<MetadataSpacer />
{showStatus ? (
<OutgoingMessageStatus
iconColor={messageStatusColor}

View file

@ -374,7 +374,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
spellCheck={true}
inputRef={this.textarea}
disabled={!typingEnabled}
maxLength={Constants.CONVERSATION.MAX_MESSAGE_BODY_LENGTH}
// maxLength={Constants.CONVERSATION.MAX_MESSAGE_BODY_LENGTH}
rows={1}
style={sendMessageStyle}
suggestionsPortalHost={this.container}
@ -751,25 +751,8 @@ export class SessionCompositionBox extends React.Component<Props, State> {
// tslint:disable-next-line: cyclomatic-complexity
private async onSendMessage() {
const toUnicode = (str: string) => {
return str
.split('')
.map(value => {
const temp = value
.charCodeAt(0)
.toString(16)
.toUpperCase();
if (temp.length > 2) {
return `\\u${temp}`;
}
return value;
})
.join('');
};
// this is dirty but we have to replace all @(xxx) by @xxx manually here
const cleanMentions = (text: string): string => {
const textUnicode = toUnicode(text);
const matches = text.match(this.mentionsRegex);
let replacedMentions = text;
(matches || []).forEach(match => {
@ -808,10 +791,10 @@ export class SessionCompositionBox extends React.Component<Props, State> {
}
// Verify message length
const msgLen = messagePlaintext?.length || 0;
if (msgLen > Constants.CONVERSATION.MAX_MESSAGE_BODY_LENGTH) {
ToastUtils.pushMessageBodyTooLong();
return;
}
// if (msgLen > Constants.CONVERSATION.MAX_MESSAGE_BODY_LENGTH) {
// ToastUtils.pushMessageBodyTooLong();
// return;
// }
if (msgLen === 0 && this.props.stagedAttachments?.length === 0) {
ToastUtils.pushMessageBodyMissing();
return;

View file

@ -9,7 +9,7 @@ export const TTL_DEFAULT = {
// User Interface
export const CONVERSATION = {
MAX_MESSAGE_BODY_LENGTH: 2000,
// MAX_MESSAGE_BODY_LENGTH: 2000,
DEFAULT_MEDIA_FETCH_COUNT: 50,
DEFAULT_DOCUMENTS_FETCH_COUNT: 150,
DEFAULT_MESSAGE_FETCH_COUNT: 30,