Merge pull request #2806 from Bilb/quote_fixes_form_will

Quote fixes + reorder of pinned conversations
pull/2807/head
Audric Ackermann 2 years ago committed by GitHub
commit 97c9672fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,7 +29,7 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
const { author, isIncoming } = props;
const isPublic = useSelectedIsPublic();
const authorName = useQuoteAuthorName(author);
const { authorName, isMe } = useQuoteAuthorName(author);
if (!author || !authorName) {
return null;
@ -41,7 +41,7 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
pubkey={PubKey.shorten(author)}
name={authorName}
compact={true}
shouldShowPubkey={Boolean(authorName && isPublic)}
shouldShowPubkey={Boolean(authorName && !isMe && isPublic)}
/>
</StyledQuoteAuthor>
);

@ -112,6 +112,7 @@ export class LeftPaneMessageSection extends React.Component<Props> {
rowRenderer={this.renderRow}
width={width}
autoHeight={false}
conversationIds={conversationIds}
/>
)}
</AutoSizer>

@ -264,11 +264,17 @@ export function useIsTyping(conversationId?: string): boolean {
return useConversationPropsById(conversationId)?.isTyping || false;
}
export function useQuoteAuthorName(authorId?: string) {
export function useQuoteAuthorName(
authorId?: string
): { authorName: string | undefined; isMe: boolean } {
const convoProps = useConversationPropsById(authorId);
return authorId && isUsAnySogsFromCache(authorId)
const isMe = Boolean(authorId && isUsAnySogsFromCache(authorId));
const authorName = isMe
? window.i18n('you')
: convoProps?.nickname || convoProps?.isPrivate
? convoProps?.displayNameInProfile
: undefined;
return { authorName, isMe };
}

@ -218,17 +218,18 @@ async function processQuoteAttachments(
const isOpenGroupV2 = convo.isOpenGroupV2();
const openGroupV2Details = (isOpenGroupV2 && convo.toOpenGroupV2()) || undefined;
quote.attachments = await Promise.all(
quote.attachments.map(async (item: any, index: any) => {
for (let index = 0; index < quote.attachments.length; index++) {
// If we already have a path, then we copied this image from the quoted
// message and we don't need to download the attachment.
if (!item.thumbnail || item.thumbnail.path) {
return item;
const attachment = quote.attachments[index];
if (!attachment.thumbnail || attachment.thumbnail.path) {
continue;
}
addedCount += 1;
const thumbnail = await AttachmentDownloads.addJob(item.thumbnail, {
const thumbnail = await AttachmentDownloads.addJob(attachment.thumbnail, {
messageId: message.id,
type: 'quote',
index,
@ -236,9 +237,8 @@ async function processQuoteAttachments(
openGroupV2Details,
});
return { ...item, thumbnail };
})
);
quote.attachments[index] = { ...attachment, thumbnail };
}
message.set({ quote });

@ -20,7 +20,7 @@ import { ReleasedFeatures } from '../../../../util/releaseFeature';
import { allowOnlyOneAtATime } from '../../Promise';
import { isSignInByLinking } from '../../../../util/storage';
const defaultMsBetweenRetries = 30000; // a long time between retries, to avoid running multiple jobs at the same time, when one was postponed at the same time as one already planned (5s)
const defaultMsBetweenRetries = 15000; // a long time between retries, to avoid running multiple jobs at the same time, when one was postponed at the same time as one already planned (5s)
const defaultMaxAttempts = 2;
/**

Loading…
Cancel
Save