mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
Fix reopening a hidden thread
This commit is contained in:
parent
7dc980af90
commit
082b92c9c3
@ -22,7 +22,24 @@ const useMessengerState = () =>
|
|||||||
{
|
{
|
||||||
let thread = messageThreads.find(thread => (thread.participant && (thread.participant.id === userId)));
|
let thread = messageThreads.find(thread => (thread.participant && (thread.participant.id === userId)));
|
||||||
|
|
||||||
if(thread) return thread;
|
if(thread)
|
||||||
|
{
|
||||||
|
const hiddenIndex = hiddenThreadIds.indexOf(thread.threadId);
|
||||||
|
|
||||||
|
if(hiddenIndex >= 0)
|
||||||
|
{
|
||||||
|
setHiddenThreadIds(prevValue =>
|
||||||
|
{
|
||||||
|
const newValue = [ ...prevValue ];
|
||||||
|
|
||||||
|
newValue.splice(hiddenIndex, 1);
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
const friend = getFriend(userId);
|
const friend = getFriend(userId);
|
||||||
|
|
||||||
@ -53,7 +70,7 @@ const useMessengerState = () =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
}, [ messageThreads, getFriend ]);
|
}, [ messageThreads, hiddenThreadIds, getFriend ]);
|
||||||
|
|
||||||
const closeThread = (threadId: number) =>
|
const closeThread = (threadId: number) =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user