Skip to content

Commit

Permalink
[fix] - プラベチャンネルの情報取得時、参加チャンネルに入ってるならMemberでもとれるように (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
NfoAlex authored Jun 3, 2024
1 parent b1d68ad commit b217a00
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/actionHandler/Channel/fetchChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,27 @@ export default async function fetchChannel(channelId:string, userId:string)
resolve(null);
return;
} else {
//プラベなら権限を調べて無いならnull
//プラベなら権限と参加を調べて無いならnull
if (datChannels[0].isPrivate) {
//ユーザー情報を取得
const userInfo = await fetchUser(userId, null);
//ユーザー情報がそもそもないならnull
if (userInfo === null) {
resolve(null);
return;
}
//もし参加チャンネルに入ってなければnull
if (!userInfo.channelJoined.includes(channelId)) {
resolve(null);
return;
}

//このユーザーがサーバー管理権限がありプラベを見られるか調べる
if (!(await roleCheck(userId, "ServerManage"))) {
if (
!userInfo.channelJoined.includes(channelId)
&&
!(await roleCheck(userId, "ServerManage"))
) {
//返す
resolve(null);
return;
Expand Down

0 comments on commit b217a00

Please sign in to comment.