diff --git a/packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx b/packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx
index afa2ebb71..6251c8d9d 100644
--- a/packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx
+++ b/packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx
@@ -185,12 +185,13 @@ export const SnapshotContainer: React.FC = ({
heading="Authors"
item={
<>
- {profile && (
-
- )}
+ {profile && !profile.scopes.includes("dataset:reviewer") &&
+ (
+
+ )}
["user"]>
+}
+
+function UserMenuList({ user }: UserMenuListProps) {
+ return (
+ <>
+
+
+ My Datasets
+
+
+
+ {user.orcid && (
+
+ Account Info
+
+ )}
+
+
+ Obtain an API Key
+
+
+ {user.provider !== "orcid" && (
+
+ Link ORCID to my account
+
+ )}
+
+ {user.admin && (
+
+ Admin
+
+ )}
+ >
+ )
+}
+
export interface UserMenuProps {
signOutAndRedirect: () => void
}
@@ -15,6 +55,8 @@ export const UserMenu: React.FC = ({ signOutAndRedirect }) => {
if (loading || !user) return null
+ const reviewer = user.id === "reviewer"
+
const inboxCount =
notifications?.filter((n) => n.status === "unread").length || 0
@@ -66,35 +108,7 @@ export const UserMenu: React.FC = ({ signOutAndRedirect }) => {
-
-
- My Datasets
-
-
-
- {user.orcid && (
-
- Account Info
-
- )}
-
-
- Obtain an API Key
-
-
- {user.provider !== "orcid" && (
-
- Link ORCID to my account
-
- )}
-
- {user.admin && (
-
- Admin
-
- )}
+ {!reviewer && }
diff --git a/packages/openneuro-server/src/graphql/resolvers/user.ts b/packages/openneuro-server/src/graphql/resolvers/user.ts
index 3eee77b27..3774ce290 100644
--- a/packages/openneuro-server/src/graphql/resolvers/user.ts
+++ b/packages/openneuro-server/src/graphql/resolvers/user.ts
@@ -7,11 +7,53 @@ function isValidOrcid(orcid: string): boolean {
return /^[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$/.test(orcid || "")
}
+// TODO - Use GraphQL codegen
+type GraphQLUserType = {
+ id: string
+ provider: "orcid" | "google"
+ avatar: string
+ orcid: string
+ created: Date
+ modified: Date
+ lastSeen: Date
+ email: string
+ name: string
+ admin: boolean
+ blocked: boolean
+ location: string
+ institution: string
+ github: string
+ githubSynced: Date
+ links: [string]
+ notifications: [Record]
+ orcidConsent: boolean
+}
+
export async function user(
obj,
{ id },
{ userInfo }: { userInfo?: Record } = {},
-) {
+): Promise | null> {
+ if (userInfo.reviewer) {
+ const oneWeekAgo = new Date()
+ oneWeekAgo.setDate(oneWeekAgo.getDate() - 7)
+ return {
+ id: "reviewer",
+ name: "Anonymous Reviewer",
+ email: "reviewer@openneuro.org",
+ provider: "orcid",
+ orcid: "0000-0000-0000-0000",
+ admin: false,
+ blocked: false,
+ location: "",
+ institution: "",
+ orcidConsent: true,
+ created: oneWeekAgo,
+ lastSeen: new Date(),
+ modified: oneWeekAgo,
+ }
+ }
+
let user
if (isValidOrcid(id)) {
user = await User.findOne({
@@ -226,6 +268,11 @@ export const updateUser = async (
export async function notifications(obj, _, { userInfo }) {
const userId = obj.id
+ // Reviewers never have notifications
+ if (userInfo.reviewer) {
+ return []
+ }
+
// --- authorization ---
if (!userInfo || (userInfo.id !== userId && !userInfo.admin)) {
throw new Error("Not authorized to view these notifications.")