Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
00c787f8
Unverified
Commit
00c787f8
authored
2 years ago
by
Filipe Marins
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] Not allowed error in discussion room with a private parent channel (#26394)
parent
655a6fd7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/meteor/client/hooks/useRoomInfoEndpoint.ts
+20
-0
20 additions, 0 deletions
apps/meteor/client/hooks/useRoomInfoEndpoint.ts
apps/meteor/client/views/room/Header/ParentRoomWithEndpointData.tsx
+6
-10
6 additions, 10 deletions
...r/client/views/room/Header/ParentRoomWithEndpointData.tsx
with
26 additions
and
10 deletions
apps/meteor/client/hooks/useRoomInfoEndpoint.ts
0 → 100644
+
20
−
0
View file @
00c787f8
import
{
IRoom
}
from
'
@rocket.chat/core-typings
'
;
import
{
OperationResult
}
from
'
@rocket.chat/rest-typings
'
;
import
{
useEndpoint
}
from
'
@rocket.chat/ui-contexts
'
;
import
{
useQuery
,
UseQueryResult
}
from
'
@tanstack/react-query
'
;
import
{
minutesToMilliseconds
}
from
'
date-fns
'
;
import
type
{
Meteor
}
from
'
meteor/meteor
'
;
export
const
useRoomInfoEndpoint
=
(
rid
:
IRoom
[
'
_id
'
]):
UseQueryResult
<
OperationResult
<
'
GET
'
,
'
/v1/rooms.info
'
>>
=>
{
const
getRoomInfo
=
useEndpoint
(
'
GET
'
,
'
/v1/rooms.info
'
);
return
useQuery
([
'
rooms/info
'
,
rid
],
()
=>
getRoomInfo
({
roomId
:
rid
}),
{
cacheTime
:
minutesToMilliseconds
(
15
),
staleTime
:
minutesToMilliseconds
(
5
),
retry
:
(
count
,
error
:
Meteor
.
Error
)
=>
{
if
(
count
>
2
||
error
.
error
===
'
not-allowed
'
)
{
return
false
;
}
return
true
;
},
});
};
This diff is collapsed.
Click to expand it.
apps/meteor/client/views/room/Header/ParentRoomWithEndpointData.tsx
+
6
−
10
View file @
00c787f8
import
type
{
IRoom
}
from
'
@rocket.chat/core-typings
'
;
import
type
{
IRoom
}
from
'
@rocket.chat/core-typings
'
;
import
React
,
{
ReactElement
,
useMemo
}
from
'
react
'
;
import
React
,
{
ReactElement
}
from
'
react
'
;
import
Header
from
'
../../../components/Header
'
;
import
Header
from
'
../../../components/Header
'
;
import
{
AsyncStatePhase
}
from
'
../../../hooks/useAsyncState
'
;
import
{
useRoomInfoEndpoint
}
from
'
../../../hooks/useRoomInfoEndpoint
'
;
import
{
useEndpointData
}
from
'
../../../hooks/useEndpointData
'
;
import
ParentRoom
from
'
./ParentRoom
'
;
import
ParentRoom
from
'
./ParentRoom
'
;
type
ParentRoomWithEndpointDataProps
=
{
type
ParentRoomWithEndpointDataProps
=
{
...
@@ -11,20 +10,17 @@ type ParentRoomWithEndpointDataProps = {
...
@@ -11,20 +10,17 @@ type ParentRoomWithEndpointDataProps = {
};
};
const
ParentRoomWithEndpointData
=
({
rid
}:
ParentRoomWithEndpointDataProps
):
ReactElement
|
null
=>
{
const
ParentRoomWithEndpointData
=
({
rid
}:
ParentRoomWithEndpointDataProps
):
ReactElement
|
null
=>
{
const
{
phase
,
value
}
=
useEndpointData
(
const
{
data
,
isLoading
,
isError
}
=
useRoomInfoEndpoint
(
rid
);
'
/v1/rooms.info
'
,
useMemo
(()
=>
({
roomId
:
rid
}),
[
rid
]),
);
if
(
AsyncStatePhase
.
LOADING
===
phase
)
{
if
(
isLoading
)
{
return
<
Header
.
Tag
.
Skeleton
/>;
return
<
Header
.
Tag
.
Skeleton
/>;
}
}
if
(
AsyncStatePhase
.
REJECTED
===
phase
||
!
value
?.
room
)
{
if
(
isError
||
!
data
?.
room
)
{
return
null
;
return
null
;
}
}
return
<
ParentRoom
room
=
{
value
.
room
}
/>;
return
<
ParentRoom
room
=
{
data
.
room
}
/>;
};
};
export
default
ParentRoomWithEndpointData
;
export
default
ParentRoomWithEndpointData
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment