Skip to content

Commit

Permalink
refactor: use drive privacy ferom record instead of new const string
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocarvalhodev committed Jul 19, 2024
1 parent 1b1d8b5 commit 0afa643
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/arfs/arfs_builders/arfs_drive_builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
EntityMetaDataTransactionData
} from '../../types';
import { Utf8ArrayToStr } from '../../utils/common';
import { drivePrivacyTagName, ENCRYPTED_DATA_PLACEHOLDER, fakeEntityId } from '../../utils/constants';
import { ENCRYPTED_DATA_PLACEHOLDER, fakeEntityId, gqlTagNameRecord } from '../../utils/constants';
import { ArFSPublicDrive, ArFSPrivateDrive, ArFSDriveEntity } from '../arfs_entities';
import {
ArFSMetadataEntityBuilder,
Expand Down Expand Up @@ -171,7 +171,7 @@ export class ArFSPrivateDriveBuilder extends ArFSDriveBuilder<ArFSPrivateDrive>
case 'Drive-Auth-Mode':
this.driveAuthMode = value as DriveAuthMode;
break;
case drivePrivacyTagName:
case gqlTagNameRecord.drivePrivacy:
this.drivePrivacy = value as DrivePrivacy;
break;
default:
Expand Down
6 changes: 4 additions & 2 deletions src/arfs/arfsdao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import {
defaultMaxConcurrentChunks,
ENCRYPTED_DATA_PLACEHOLDER,
turboProdUrl,
drivePrivacyTagName
gqlTagNameRecord
} from '../utils/constants';
import { PrivateKeyData } from './private_key_data';
import {
Expand Down Expand Up @@ -1790,7 +1790,9 @@ export class ArFSDAO extends ArFSDAOAnonymous {

const transactions = await this.gatewayApi.gqlRequest(gqlQuery);

const drivePrivacyFromTag = transactions.edges[0].node.tags.find((t) => t.name === drivePrivacyTagName);
const drivePrivacyFromTag = transactions.edges[0].node.tags.find(
(t) => t.name === gqlTagNameRecord.drivePrivacy
);

return drivePrivacyFromTag?.value === 'public';
}
Expand Down
2 changes: 0 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,3 @@ export const gqlTagNameRecord = {

export const gqlTagNameArray = Object.values(gqlTagNameRecord);
export type GqlTagName = typeof gqlTagNameArray[number];

export const drivePrivacyTagName = 'Drive-Privacy';

0 comments on commit 0afa643

Please sign in to comment.