Filter incoming bodyRanges, also filter before display
This commit is contained in:
parent
ec1246f60a
commit
4c9baaef80
10 changed files with 84 additions and 126 deletions
|
@ -53,7 +53,7 @@ import * as expirationTimer from '../util/expirationTimer';
|
|||
import { getUserLanguages } from '../util/userLanguages';
|
||||
|
||||
import type { ReactionType } from '../types/Reactions';
|
||||
import { isValidUuid, UUID, UUIDKind } from '../types/UUID';
|
||||
import { UUID, UUIDKind } from '../types/UUID';
|
||||
import * as reactionUtil from '../reactions/util';
|
||||
import * as Stickers from '../types/Stickers';
|
||||
import * as Errors from '../types/errors';
|
||||
|
@ -1957,30 +1957,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
id,
|
||||
|
||||
attachments: quote.attachments.slice(),
|
||||
bodyRanges: quote.bodyRanges
|
||||
.map(({ start, length, mentionUuid }) => {
|
||||
strictAssert(
|
||||
start != null,
|
||||
'Received quote with a bodyRange.start == null'
|
||||
);
|
||||
strictAssert(
|
||||
length != null,
|
||||
'Received quote with a bodyRange.length == null'
|
||||
);
|
||||
if (!isValidUuid(mentionUuid)) {
|
||||
log.warn(
|
||||
`copyFromQuotedMessage: invalid mentionUuid ${mentionUuid}`
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
start,
|
||||
length,
|
||||
mentionUuid,
|
||||
};
|
||||
})
|
||||
.filter(isNotNil),
|
||||
bodyRanges: quote.bodyRanges?.slice(),
|
||||
|
||||
// Just placeholder values for the fields
|
||||
referencedMessageNotFound: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue