diff --git a/app/logging.js b/app/logging.js index 720c187b6e..95a87d67e6 100644 --- a/app/logging.js +++ b/app/logging.js @@ -21,11 +21,6 @@ let logger; module.exports = { initialize, getLogger, - // for tests only: - isLineAfterDate, - eliminateOutOfDateFiles, - eliminateOldEntries, - fetchLog, fetch, }; @@ -39,6 +34,10 @@ function initialize() { mkdirp.sync(logPath); return cleanupLogs(logPath).then(() => { + if (logger) { + return; + } + const logFile = path.join(logPath, 'log.log'); logger = bunyan.createLogger({ @@ -64,6 +63,8 @@ function initialize() { }); ipc.on('fetch-log', event => { + mkdirp.sync(logPath); + fetch(logPath).then( data => { event.sender.send('fetched-log', data); @@ -107,7 +108,7 @@ async function deleteAllLogs(logPath) { async function cleanupLogs(logPath) { const now = new Date(); const earliestDate = new Date( - Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() - 3) + Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() - 6) ); try { @@ -217,6 +218,11 @@ function fetchLog(logFile) { } function fetch(logPath) { + // Check that the file exists locally + if (!fs.existsSync(logPath)) { + console._log('Log folder not found while fetching its content. Quick! Creating it.'); + mkdirp.sync(logPath); + } const files = fs.readdirSync(logPath); const paths = files.map(file => path.join(logPath, file)); diff --git a/ts/components/conversation/message/OutgoingMessageStatus.tsx b/ts/components/conversation/message/OutgoingMessageStatus.tsx index 0701ce1310..c710adfde8 100644 --- a/ts/components/conversation/message/OutgoingMessageStatus.tsx +++ b/ts/components/conversation/message/OutgoingMessageStatus.tsx @@ -9,6 +9,7 @@ const MessageStatusSendingContainer = styled.div` align-self: flex-end; margin-bottom: 2px; margin-inline-start: 5px; + cursor: pointer; `; const MessageStatusSending = () => { diff --git a/ts/components/session/conversation/SessionCompositionBox.tsx b/ts/components/session/conversation/SessionCompositionBox.tsx index c65b52b765..b71117a1d3 100644 --- a/ts/components/session/conversation/SessionCompositionBox.tsx +++ b/ts/components/session/conversation/SessionCompositionBox.tsx @@ -109,18 +109,21 @@ const StartRecordingButton = (props: { onClick: () => void }) => { ); }; -const ToggleEmojiButton = (props: { onClick: () => void }) => { - return ( - - ); -}; +const ToggleEmojiButton = React.forwardRef void }>( + (props, ref) => { + return ( + + ); + } +); const SendMessageButton = (props: { onClick: () => void }) => { return ( @@ -205,7 +208,8 @@ const getDefaultState = (newConvoId?: string) => { class SessionCompositionBoxInner extends React.Component { private readonly textarea: React.RefObject; private readonly fileInput: React.RefObject; - private emojiPanel: any; + private readonly emojiPanel: any; + private readonly emojiPanelButton: any; private linkPreviewAbortController?: AbortController; private container: any; private readonly mentionsRegex = /@\uFFD205[0-9a-f]{64}\uFFD7[^\uFFD2]+\uFFD2/gu; @@ -219,7 +223,8 @@ class SessionCompositionBoxInner extends React.Component { this.fileInput = React.createRef(); // Emojis - this.emojiPanel = null; + this.emojiPanel = React.createRef(); + this.emojiPanelButton = React.createRef(); autoBind(this); this.toggleEmojiPanel = debounce(this.toggleEmojiPanel.bind(this), 100); } @@ -271,7 +276,10 @@ class SessionCompositionBoxInner extends React.Component { } private handleClick(e: any) { - if (this.emojiPanel && this.emojiPanel.contains(e.target)) { + if ( + (this.emojiPanel?.current && this.emojiPanel.current.contains(e.target)) || + (this.emojiPanelButton?.current && this.emojiPanelButton.current.contains(e.target)) + ) { return; } @@ -421,11 +429,13 @@ class SessionCompositionBoxInner extends React.Component { {this.renderTextArea()} - {typingEnabled && } + {typingEnabled && ( + + )} {typingEnabled && ( -
(this.emojiPanel = ref)} onKeyDown={this.onKeyDown} role="button"> +
{showEmojiPanel && ( )} diff --git a/ts/components/session/icon/SessionIconButton.tsx b/ts/components/session/icon/SessionIconButton.tsx index f0cd37585e..48271ec53c 100644 --- a/ts/components/session/icon/SessionIconButton.tsx +++ b/ts/components/session/icon/SessionIconButton.tsx @@ -12,7 +12,7 @@ interface SProps extends SessionIconProps { margin?: string; } -const SessionIconButtonInner = (props: SProps) => { +const SessionIconButtonInner = React.forwardRef((props, ref) => { const { iconType, iconSize, @@ -40,6 +40,7 @@ const SessionIconButtonInner = (props: SProps) => {
@@ -58,6 +59,6 @@ const SessionIconButtonInner = (props: SProps) => { {Boolean(notificationCount) && }
); -}; +}); export const SessionIconButton = React.memo(SessionIconButtonInner, _.isEqual); diff --git a/ts/interactions/conversations/unsendingInteractions.ts b/ts/interactions/conversations/unsendingInteractions.ts index d360941fd3..5686bbb5d6 100644 --- a/ts/interactions/conversations/unsendingInteractions.ts +++ b/ts/interactions/conversations/unsendingInteractions.ts @@ -53,7 +53,6 @@ async function unsendMessagesForEveryone( // sending to recipient all the messages separately for now await Promise.all( unsendMsgObjects.map(unsendObject => { - console.warn('sending unsend message', unsendObject); getMessageQueue() .sendToGroup(unsendObject, undefined, new PubKey(destinationId)) .catch(window?.log?.error);