diff --git a/pages/admin/profiles.js b/pages/admin/profiles.js
index 00acb9889a4..2e29601a1db 100644
--- a/pages/admin/profiles.js
+++ b/pages/admin/profiles.js
@@ -68,6 +68,7 @@ export default function Users({ profiles }) {
Recently updated
+
diff --git a/pages/api/admin/profiles.js b/pages/api/admin/profiles.js
index fb5956d2a1d..5f9fa5b03f0 100644
--- a/pages/api/admin/profiles.js
+++ b/pages/api/admin/profiles.js
@@ -41,6 +41,29 @@ export async function getProfiles(filter = "recently updated") {
}
}
+ if (filter === "premium") {
+ try {
+ profiles = await Profile.aggregate([
+ {
+ $lookup: {
+ from: "users",
+ localField: "user",
+ foreignField: "_id",
+ as: "user",
+ },
+ },
+ {
+ $match: {
+ "user.type": "premium",
+ },
+ },
+ ]).limit(20);
+ } catch (e) {
+ logger.error(e, "failed loading profiles");
+ return profiles;
+ }
+ }
+
if (filter === "by rank") {
try {
profiles = await Profile.aggregate([
diff --git a/tests/profile.spec.js b/tests/profile.spec.js
index 51382657c3a..68d42acb7da 100644
--- a/tests/profile.spec.js
+++ b/tests/profile.spec.js
@@ -21,22 +21,21 @@ test("Name appears on the page", async ({ page }) => {
test("Tabs change correctly", async ({ page }) => {
const username = "_test-profile-user-6";
await page.goto(`/${username}`);
- await expect(page.getByRole("link", { name: /My Links/ })).toHaveAttribute(
+ await expect(page.getByRole("button", { name: /My Links/ })).toHaveAttribute(
"class",
/border-tertiary-medium/,
);
await expect(page.locator("main")).not.toHaveText(/Top Teacher Award/);
- await page.getByRole("link", { name: /Milestones/ }).click();
+ await page.getByRole("button", { name: /Milestones/ }).click();
await expect(page.locator("h3").first()).toHaveText(/Top Teacher Award/);
});
test("Tabs have deep linking test milestone", async ({ page }) => {
const username = "_test-profile-user-6";
await page.goto(`/${username}?tab=milestones`);
- await expect(page.getByRole("link", { name: /Milestones/ })).toHaveAttribute(
- "class",
- /border-tertiary-medium/,
- );
+ await expect(
+ page.getByRole("button", { name: /Milestones/ }),
+ ).toHaveAttribute("class", /border-tertiary-medium/);
await expect(page.locator("h3").first()).toHaveText(/Top Teacher Award/);
});
@@ -44,7 +43,7 @@ test("Tabs have deep linking test repos", async ({ page }) => {
const username = "_test-profile-user-6";
await page.goto(`/${username}?tab=repos`);
await expect(
- page.locator("main").getByRole("link", { name: /Repos/ }),
+ page.locator("main").getByRole("button", { name: /Repos/ }),
).toHaveAttribute("class", /border-tertiary-medium/);
await expect(
page.getByRole("link", { name: "EddieHubCommunity/BioDrop" }),