ソースを参照

Fix issue with returning wrong ip in reports (#41)

Bartosz Dryl 2 年 前
コミット
2df6ecfce2
1 ファイル変更4 行追加10 行削除
  1. 4 10
      src/resolvers/reportsInfo.ts

+ 4 - 10
src/resolvers/reportsInfo.ts

@@ -181,10 +181,7 @@ export class ReportsInfosResolver {
 
   @Query(() => [VideoReportInfo])
   @Authorized()
-  async reportedVideos(
-    @Args() { orderBy, where, limit, skip }: VideoReportsArgs,
-    @Ctx() ctx: OrionContext
-  ): Promise<VideoReportInfo[]> {
+  async reportedVideos(@Args() { orderBy, where, limit, skip }: VideoReportsArgs): Promise<VideoReportInfo[]> {
     const reportedVideosDocument = await ReportedVideoModel.find({
       ...(where?.videoId ? { videoId: where?.videoId } : {}),
       ...(where?.createdAt_gt ? { timestamp: { $gte: where.createdAt_gt } } : {}),
@@ -201,16 +198,13 @@ export class ReportsInfosResolver {
         videoId: reportedVideo.videoId,
         createdAt: reportedVideo.timestamp,
         id: reportedVideo.id,
-        reporterIp: ctx.remoteHost || '',
+        reporterIp: reportedVideo.reporterIp,
       })) || []
     )
   }
   @Query(() => [ChannelReportInfo])
   @Authorized()
-  async reportedChannels(
-    @Args() { orderBy, where, limit, skip }: ChannelReportsArgs,
-    @Ctx() ctx: OrionContext
-  ): Promise<ChannelReportInfo[]> {
+  async reportedChannels(@Args() { orderBy, where, limit, skip }: ChannelReportsArgs): Promise<ChannelReportInfo[]> {
     const reportedChannelsDocument = await ReportedChannelModel.find({
       ...(where?.channelId ? { channelId: where?.channelId } : {}),
       ...(where?.createdAt_gt ? { timestamp: { $gte: where.createdAt_gt } } : {}),
@@ -227,7 +221,7 @@ export class ReportsInfosResolver {
         channelId: reportedChannel.channelId,
         createdAt: reportedChannel.timestamp,
         id: reportedChannel.id,
-        reporterIp: ctx.remoteHost || '',
+        reporterIp: reportedChannel.reporterIp,
       })) || []
     )
   }