Skip to content

Commit

Permalink
Remove promotion token
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Oct 27, 2023
1 parent e9e6cf1 commit 8e2e7e0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
3 changes: 0 additions & 3 deletions src/load-media-on-paste-or-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export async function spawnFromFileList(files: FileList) {
.then(function (response: UploadResponse) {
const srcUrl = new URL(response.origin);
srcUrl.searchParams.set("token", response.meta.access_token);
window.APP.store.update({
uploadPromotionTokens: [{ fileId: response.file_id, promotionToken: response.meta.promotion_token }]
});
return {
src: srcUrl.href,
recenter: true,
Expand Down
6 changes: 1 addition & 5 deletions src/utils/bit-pinning-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,5 @@ export const canPin = (hubChannel: HubChannel, eid: EntityID): boolean => {
if (createMessageData.prefabName !== "media") {
return false;
}
const fileId = createMessageData.initialData.fileId;
const hasFile = !!fileId;
const hasPromotableFile =
hasFile && APP.store.state.uploadPromotionTokens.some((upload: any) => upload.fileId === fileId);
return isNetworkInstantiated(eid) && !isPinned(eid) && (!hasFile || hasPromotableFile);
return isNetworkInstantiated(eid) && hubChannel.can("pin_objects");
};
10 changes: 2 additions & 8 deletions src/utils/entity-state-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,8 @@ function createEntityStatePayload(world: HubsWorld, rootEid: EntityID): CreateEn

if (prefabName == "media" && fileId && src) {
const fileAccessToken = new URL(src).searchParams.get("token") as string;
const { promotionToken } = APP.store.state.uploadPromotionTokens.find(
(upload: { fileId: string }) => upload.fileId === fileId
);
if (promotionToken) {
payload.file_id = fileId;
payload.file_access_token = fileAccessToken;
payload.promotion_token = promotionToken;
}
payload.file_id = fileId;
payload.file_access_token = fileAccessToken;
}
return payload;
}
Expand Down

0 comments on commit 8e2e7e0

Please sign in to comment.