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

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

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

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

@ -20,7 +20,7 @@ import { ReleasedFeatures } from '../../../../util/releaseFeature';
import { allowOnlyOneAtATime } from '../../Promise'; import { allowOnlyOneAtATime } from '../../Promise';
import { isSignInByLinking } from '../../../../util/storage'; 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; const defaultMaxAttempts = 2;
/** /**

Loading…
Cancel
Save