Browse Source

pioneer and types: renamed bureaucracy module to working-group

Mokhtar Naamani 4 years ago
parent
commit
f6a2f406bf

+ 1 - 1
pioneer/packages/joy-media/src/DiscoveryProvider.tsx

@@ -2,7 +2,7 @@ import React, { useState, useEffect, useContext, createContext } from 'react';
 import { Message } from 'semantic-ui-react';
 import axios, { CancelToken } from 'axios';
 
-import { StorageProviderId } from '@joystream/types/bureaucracy';
+import { StorageProviderId } from '@joystream/types/working-group';
 import { Vec } from '@polkadot/types';
 import { Url } from '@joystream/types/discovery';
 import ApiContext from '@polkadot/react-api/ApiContext';

+ 1 - 1
pioneer/packages/joy-media/src/Upload.tsx

@@ -23,7 +23,7 @@ import { ChannelId } from '@joystream/types/content-working-group';
 import { EditVideoView } from './upload/EditVideo.view';
 import { JoyInfo } from '@polkadot/joy-utils/JoyStatus';
 import { IterableFile } from './IterableFile';
-import { StorageProviderId } from '@joystream/types/bureaucracy';
+import { StorageProviderId } from '@joystream/types/working-group';
 
 const MAX_FILE_SIZE_MB = 500;
 const MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024;

+ 1 - 1
pioneer/packages/joy-media/src/common/MediaPlayerWithResolver.tsx

@@ -6,7 +6,7 @@ import { ApiProps } from '@polkadot/react-api/types';
 import { I18nProps } from '@polkadot/react-components/types';
 import { withMulti } from '@polkadot/react-api/with';
 import { Option } from '@polkadot/types/codec';
-import { StorageProviderId, Worker } from '@joystream/types/bureaucracy';
+import { StorageProviderId, Worker } from '@joystream/types/working-group';
 
 import translate from '../translate';
 import { DiscoveryProviderProps, withDiscoveryProvider } from '../DiscoveryProvider';

+ 2 - 2
pioneer/packages/joy-roles/src/transport.substrate.ts

@@ -25,7 +25,7 @@ import {
 
 import {
   WorkerApplication, WorkerApplicationId, WorkerOpening, WorkerOpeningId
-} from '@joystream/types/bureaucracy';
+} from '@joystream/types/working-group';
 
 import { Application, Opening } from '@joystream/types/hiring';
 import { Stake, StakeId } from '@joystream/types/stake';
@@ -76,7 +76,7 @@ type GroupOpeningId = CuratorOpeningId | WorkerOpeningId;
 
 const wgApiMethodsMapping: WGToApiMethodsMapping = {
   [WorkingGroups.StorageProviders]: {
-    module: 'storageBureaucracy',
+    module: 'storageWorkingGroup',
     methods: {
       nextOpeningId: 'nextWorkerOpeningId',
       openingById: 'workerOpeningById',

+ 2 - 2
types/src/index.ts

@@ -13,7 +13,7 @@ import { registerHiringTypes } from "./hiring";
 import { registerVersionedStoreTypes } from "./versioned-store";
 import { registerVersionedStorePermissionsTypes } from "./versioned-store/permissions";
 import { registerContentWorkingGroupTypes } from "./content-working-group";
-import { registerBureaucracyTypes } from "./bureaucracy";
+import { registerWorkingGroupTypes } from "./working-group";
 import { registerDiscoveryTypes } from "./discovery";
 import { registerMediaTypes } from "./media";
 import { registerProposalTypes } from "./proposals";
@@ -37,7 +37,7 @@ export function registerJoystreamTypes() {
   registerVersionedStoreTypes();
   registerVersionedStorePermissionsTypes();
   registerContentWorkingGroupTypes();
-  registerBureaucracyTypes();
+  registerWorkingGroupTypes();
   registerDiscoveryTypes();
   registerMediaTypes();
   registerProposalTypes();

+ 1 - 1
types/src/media.ts

@@ -2,7 +2,7 @@ import { Enum, Struct, Option, Vec as Vector, H256 } from '@polkadot/types';
 import { getTypeRegistry, u64, bool, Text } from '@polkadot/types';
 import { BlockAndTime } from './common';
 import { MemberId } from './members';
-import { StorageProviderId } from './bureaucracy'; // this should be in discovery really
+import { StorageProviderId } from './working-group'; // this should be in discovery really
 
 import { randomAsU8a } from '@polkadot/util-crypto';
 import { encodeAddress, decodeAddress } from '@polkadot/keyring';

+ 14 - 14
types/src/bureaucracy/index.ts → types/src/working-group/index.ts

@@ -176,7 +176,7 @@ export class SlashingTerms extends Enum {
   }
 };
 
-export type IBureaucracyOpeningPolicyCommitment = {
+export type IWorkingGroupOpeningPolicyCommitment = {
   application_rationing_policy: Option<ApplicationRationingPolicy>,
   max_review_period_length: BlockNumber,
   application_staking_policy: Option<StakingPolicy>,
@@ -191,19 +191,19 @@ export type IBureaucracyOpeningPolicyCommitment = {
   exit_worker_role_stake_unstaking_period: Option<BlockNumber>,
 };
 
-// This type represents OpeningPolicyCommitment defined inside the runtime's bureaucracy module.
+// This type represents OpeningPolicyCommitment defined inside the runtime's working-grpup module.
 // The only difference between this and the one defined in /content-working-group is in the names of some fields.
 //
 // There is also a minor issue here:
-// Because api metadata still says that ie. the "commitment" argument of "forumBureaucracy.addWorkerOpening" extrinsic
-// is of type "OpeningPolicyCommitment" (not the "BureaucracyOpeningPolicyCommitment" defined here), the CWG's OpeningPolicyCommitment
+// Because api metadata still says that ie. the "commitment" argument of "storageWorkingGroup.addWorkerOpening" extrinsic
+// is of type "OpeningPolicyCommitment" (not the "WorkingGroupOpeningPolicyCommitment" defined here), the CWG's OpeningPolicyCommitment
 // type is used when sending this extrinsic (it has "terminate_curator_role_stake_unstaking_period" field insted
 // of "terminate_worker_role_stake_unstaking_period" etc.).
 // Since both those types are basically the same structs (only filed names are different) nothing seems to break, but it's
-// very fragile atm and any change to this type in bureaucracy module could result in "unsolvable" inconsistencies
-// (this won't be an issue after CWG gets refactored to use the bureaucracy module too)
-export class BureaucracyOpeningPolicyCommitment extends JoyStruct<IBureaucracyOpeningPolicyCommitment> {
-  constructor (value?: BureaucracyOpeningPolicyCommitment) {
+// very fragile atm and any change to this type in working-group module could result in "unsolvable" inconsistencies
+// (this won't be an issue after CWG gets refactored to use the working-grpup module too)
+export class WorkingGroupOpeningPolicyCommitment extends JoyStruct<IWorkingGroupOpeningPolicyCommitment> {
+  constructor (value?: WorkingGroupOpeningPolicyCommitment) {
     super({
       application_rationing_policy: Option.with(ApplicationRationingPolicy),
       max_review_period_length: "BlockNumber",
@@ -272,7 +272,7 @@ export class BureaucracyOpeningPolicyCommitment extends JoyStruct<IBureaucracyOp
 export type IWorkerOpening = {
   opening_id: OpeningId,
   worker_applications: BTreeSet<WorkerApplicationId>,
-  policy_commitment: BureaucracyOpeningPolicyCommitment,
+  policy_commitment: WorkingGroupOpeningPolicyCommitment,
 }
 
 export class WorkerOpening extends JoyStruct<IWorkerOpening> {
@@ -280,7 +280,7 @@ export class WorkerOpening extends JoyStruct<IWorkerOpening> {
     super({
       opening_id: OpeningId,
       worker_applications: BTreeSet.with(WorkerApplicationId),
-      policy_commitment: BureaucracyOpeningPolicyCommitment,
+      policy_commitment: WorkingGroupOpeningPolicyCommitment,
     }, value);
   }
 
@@ -292,12 +292,12 @@ export class WorkerOpening extends JoyStruct<IWorkerOpening> {
     return this.getField<BTreeSet<WorkerApplicationId>>('worker_applications');
   }
 
-  get policy_commitment(): BureaucracyOpeningPolicyCommitment {
-    return this.getField<BureaucracyOpeningPolicyCommitment>('policy_commitment');
+  get policy_commitment(): WorkingGroupOpeningPolicyCommitment {
+    return this.getField<WorkingGroupOpeningPolicyCommitment>('policy_commitment');
   }
 }
 
-export function registerBureaucracyTypes() {
+export function registerWorkingGroupTypes() {
   try {
     getTypeRegistry().register({
       // Note that it actually HAS TO be "LeadOf" in the runtime,
@@ -315,6 +315,6 @@ export function registerBureaucracyTypes() {
       StorageProviderId
     });
   } catch (err) {
-    console.error('Failed to register custom types of bureaucracy module', err);
+    console.error('Failed to register custom types of working-group module', err);
   }
 }