Browse Source

CLI censorship: remove prompts for channels and videos

iorveth 4 years ago
parent
commit
c2e27791c6

+ 1 - 27
cli/src/base/ContentDirectoryCommandBase.ts

@@ -1,6 +1,6 @@
 import ExitCodes from '../ExitCodes'
 import { WorkingGroups } from '../Types'
-import { Channel, CuratorGroup, CuratorGroupId, ContentActor, Video } from '@joystream/types/content'
+import { CuratorGroup, CuratorGroupId, ContentActor } from '@joystream/types/content'
 import { Worker } from '@joystream/types/working-group'
 import { CLIError } from '@oclif/errors'
 import { RolesCommandBase } from './WorkingGroupsCommandBase'
@@ -79,32 +79,6 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
     return createType('ContentActor', { Curator: [groupId, curator.workerId.toNumber()] })
   }
 
-  async promptForChannel(message = 'Select a channel'): Promise<Channel> {
-    const channels = await this.getApi().availableChannels()
-    const choices = channels.map(([id, c]) => ({ id: id.toString(), value: c }))
-    if (!choices.length) {
-      this.warn('No channels exist to choose from!')
-      this.exit(ExitCodes.InvalidInput)
-    }
-
-    const selectedChannel = await this.simplePrompt({ message, type: 'list', choices })
-
-    return selectedChannel
-  }
-
-  async promptForVideo(message = 'Select a video'): Promise<Video> {
-    const videos = await this.getApi().availableVideos()
-    const choices = videos.map(([id, c]) => ({ id: id.toString(), value: c }))
-    if (!choices.length) {
-      this.warn('No videos exist to choose from!')
-      this.exit(ExitCodes.InvalidInput)
-    }
-
-    const selectedVideo = await this.simplePrompt({ message, type: 'list', choices })
-
-    return selectedVideo
-  }
-
   private async curatorGroupChoices(ids?: CuratorGroupId[]) {
     const groups = await this.getApi().availableCuratorGroups()
     return groups

+ 2 - 5
cli/src/commands/content/updateChannelCensorshipStatus.ts

@@ -7,10 +7,11 @@ export default class UpdateChannelCensorshipStatusCommand extends ContentDirecto
   static flags = {
     context: ContentDirectoryCommandBase.contextFlag,
   }
+
   static args = [
     {
       name: 'id',
-      required: false,
+      required: true,
       description: 'ID of the Channel',
     },
     {
@@ -39,10 +40,6 @@ export default class UpdateChannelCensorshipStatusCommand extends ContentDirecto
 
     const actor = await this.getActor(context)
 
-    if (id === undefined) {
-      id = await this.promptForChannel()
-    }
-
     if (status === undefined) {
       status = await this.simplePrompt({
         type: 'list',

+ 2 - 5
cli/src/commands/content/updateVideoCensorshipStatus.ts

@@ -7,10 +7,11 @@ export default class UpdateChannelCensorshipStatusCommand extends ContentDirecto
   static flags = {
     context: ContentDirectoryCommandBase.contextFlag,
   }
+
   static args = [
     {
       name: 'id',
-      required: false,
+      required: true,
       description: 'ID of the Video',
     },
     {
@@ -39,10 +40,6 @@ export default class UpdateChannelCensorshipStatusCommand extends ContentDirecto
 
     const actor = await this.getActor(context)
 
-    if (id === undefined) {
-      id = await this.promptForVideo()
-    }
-
     if (status === undefined) {
       status = await this.simplePrompt({
         type: 'list',