mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
* WIP unsending message. * retrieving message with hash from db on receiving unsend request. * outgoing messages hashes updated on message sent success * unsend messaging * unsend message - deleting messages and marking as isDeleted. * add msg hash to unprocessed records. * Message unsending working for closed groups provided the message has been updated with a hash from server. * adding 2-stage confirmation modal for message deletion * adding rendering of removed incoming messages, disabling rendering of unsent outgoing messages in coversation screen. * Adding logging * debugging. * outgoing only saved for sync message instead of regular message. * deleting locally * adding post unsend deletioncode. * starting adding feature flag. * Added feature flag. * addding mandatory messageHash pollling pipeline methods swarm polling. * Conversation list item message preview showing deletion placeholder text if deleted. * add condition to drop unsend requests not send by message author * refactoring deleteMessage. Saving response hash for closed group message sending * running yarn ready * removing logging. * Adding PR fixes * Minor changes and running yarn ready * fix typo * Moved feature flag to lokiFeatureFlags. Fixing linting errors Co-authored-by: Audric Ackermann <audric@loki.network>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
|
|
import _ from 'lodash';
|
|
import uuid from 'uuid';
|
|
import { QuoteClickOptions } from '../../models/messageType';
|
|
import { GenericReadableMessage } from './message/GenericReadableMessage';
|
|
import { useSelector } from 'react-redux';
|
|
import { getGenericReadableMessageSelectorProps } from '../../state/selectors/conversations';
|
|
|
|
// Same as MIN_WIDTH in ImageGrid.tsx
|
|
export const MINIMUM_LINK_PREVIEW_IMAGE_WIDTH = 200;
|
|
|
|
type Props = {
|
|
messageId: string;
|
|
isDetailView?: boolean; // when the detail is shown for a message, we disble click and some other stuff
|
|
onQuoteClick?: (options: QuoteClickOptions) => Promise<void>;
|
|
};
|
|
|
|
export const Message = (props: Props) => {
|
|
const msgProps = useSelector(state =>
|
|
getGenericReadableMessageSelectorProps(state as any, props.messageId)
|
|
);
|
|
|
|
const ctxMenuID = `ctx-menu-message-${uuid()}`;
|
|
const onQuoteClick = (quote: QuoteClickOptions) => {
|
|
void props.onQuoteClick?.(quote);
|
|
};
|
|
|
|
if (msgProps?.isDeleted && msgProps.direction === 'outgoing') {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<GenericReadableMessage
|
|
onQuoteClick={onQuoteClick}
|
|
ctxMenuID={ctxMenuID}
|
|
messageId={props.messageId}
|
|
isDetailView={props.isDetailView}
|
|
/>
|
|
);
|
|
};
|