Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brown-ads-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Clear message box related items from local storage on logout
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { afterLogoutCleanUpCallback } from '../../../lib/callbacks/afterLogoutCl

Meteor.startup(() => {
const purgeAllDrafts = (): void => {
Object.keys(Meteor._localStorage)
Object.keys(localStorage)
.filter((key) => key.indexOf('messagebox_') === 0)
.forEach((key) => Meteor._localStorage.removeItem(key));
.forEach((key) => localStorage.removeItem(key));
};

afterLogoutCleanUpCallback.add(purgeAllDrafts, callbacks.priority.MEDIUM, 'chatMessages-after-logout-cleanup');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const MessageBox = ({
const messageComposerRef = useRef<HTMLElement>(null);
const shadowRef = useRef(null);

const storageID = `${room._id}${tmid ? `-${tmid}` : ''}`;
const storageID = `messagebox_${room._id}${tmid ? `-${tmid}` : ''}`;

const callbackRef = useCallback(
(node: HTMLTextAreaElement) => {
Expand Down