Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update fetchHubGroup ro and follow card permission #1484

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/common/e2e/hub-groups.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Hub Groups", () => {
expect(newGroup.membershipAccess).toBe("organization");
const fetchedGroup = await fetchHubGroup(
newGroup.id,
ctxMgr.context.userRequestOptions
ctxMgr.context.hubRequestOptions
);
// verify can* flags
expect(fetchedGroup.canDelete).toBe(true);
Expand All @@ -51,7 +51,7 @@ describe("Hub Groups", () => {
expect(updatedGroup.membershipAccess).toBe("anyone");
await deleteHubGroup(newGroup.id, ctxMgr.context.userRequestOptions);
try {
await fetchHubGroup(newGroup.id, ctxMgr.context.userRequestOptions);
await fetchHubGroup(newGroup.id, ctxMgr.context.hubRequestOptions);
fail("should have thrown error");
} catch (e) {
expect((e as any).message).toBe(
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/core/fetchHubEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function fetchHubEntity(
result = await fetchTemplate(identifier, context.requestOptions);
break;
case "group":
result = await fetchHubGroup(identifier, context.userRequestOptions);
result = await fetchHubGroup(identifier, context.hubRequestOptions);
break;
case "survey":
result = await fetchSurvey(identifier, context.hubRequestOptions);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/groups/HubGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class HubGroup
context: IArcGISContext
): Promise<HubGroup> {
try {
const group = await fetchHubGroup(identifier, context.userRequestOptions);
const group = await fetchHubGroup(identifier, context.hubRequestOptions);
// create an instance of HubGroup from the group
return HubGroup.fromJson(group, context);
} catch (ex) {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/groups/HubGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function createHubGroup(
*/
export async function fetchHubGroup(
identifier: string,
requestOptions: IUserRequestOptions
requestOptions: IHubRequestOptions
vivzhang marked this conversation as resolved.
Show resolved Hide resolved
): Promise<IHubGroup> {
const group = await getGroup(identifier, requestOptions);
return convertGroupToHubGroup(group, requestOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PropertyMapper } from "../../core/_internal/PropertyMapper";
import { IHubGroup } from "../../core/types/IHubGroup";
import { computeProps } from "./computeProps";
import { getPropertyMap } from "./getPropertyMap";
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
import { IHubRequestOptions } from "../../types";

/**
* Convert an IGroup to a Hub Group
Expand All @@ -13,7 +13,7 @@ import { IUserRequestOptions } from "@esri/arcgis-rest-auth";

export function convertGroupToHubGroup(
group: IGroup,
requestOptions: IUserRequestOptions
requestOptions: IHubRequestOptions
): IHubGroup {
const mapper = new PropertyMapper<Partial<IHubGroup>, IGroup>(
getPropertyMap()
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/permissions/HubPermissionPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const SystemPermissionPolicies: IPermissionPolicy[] = [
permission: "hub:card:follow",
environments: ["qaext"],
availability: ["flag"],
licenses: ["hub-premium"],
licenses: ["hub-basic", "hub-premium"],
},
{
// When enabled, the edit & manage links will take the user to umbrella
Expand Down
2 changes: 1 addition & 1 deletion packages/common/test/core/fetchHubEntity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe("fetchHubEntity:", () => {
});
it("fetches group", async () => {
const ctx = {
userRequestOptions: "fakeRequestOptions",
hubRequestOptions: "fakeRequestOptions",
} as unknown as IArcGISContext;
const spy = spyOn(
require("../../src/groups/HubGroups"),
Expand Down
Loading