mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
remove body pending loading of message > 2000.
Also remove the limit when sending text messages
This commit is contained in:
parent
0fe026ab15
commit
7054385d4a
4 changed files with 17 additions and 54 deletions
|
@ -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 }) => {
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue