- {
- console.log('clickt', comment.user.id);
- viewUserDetail(comment.user.id);
- }}>
+ viewUserDetail(comment.user.id)}>
{comment.user.name}
diff --git a/client/coral-admin/src/graphql/queries/index.js b/client/coral-admin/src/graphql/queries/index.js
index aa5ffa505..8ab3c7292 100644
--- a/client/coral-admin/src/graphql/queries/index.js
+++ b/client/coral-admin/src/graphql/queries/index.js
@@ -95,16 +95,10 @@ export const modQueueResort = (id, fetchMore) => (sort) => {
});
};
-export const getUserDetail = ({id}) => {
- console.log('close', id);
- return graphql(USER_DETAIL, {
- options: () => {
- console.log('so close!', id);
- return {
- variables: {
- id
- }
- };
- }
- });
-};
+export const getUserDetail = graphql(USER_DETAIL, {
+ options: ({id}) => {
+ return {
+ variables: {id}
+ };
+ }
+});
diff --git a/client/coral-admin/src/reducers/moderation.js b/client/coral-admin/src/reducers/moderation.js
index a40ac865f..d8b9c59bb 100644
--- a/client/coral-admin/src/reducers/moderation.js
+++ b/client/coral-admin/src/reducers/moderation.js
@@ -6,6 +6,7 @@ const initialState = Map({
modalOpen: false,
user: Map({}),
commentId: null,
+ userDetailId: null,
banDialog: false,
shortcutsNoteVisible: window.localStorage.getItem('coral:shortcutsNote') || 'show'
});
@@ -35,6 +36,10 @@ export default function moderation (state = initialState, action) {
case actions.HIDE_SHORTCUTS_NOTE:
return state
.set('shortcutsNoteVisible', 'hide');
+ case actions.VIEW_USER_DETAIL:
+ return state.set('userDetailId', action.userId);
+ case actions.HIDE_USER_DETAIL:
+ return state.set('userDetailId', null);
default :
return state;
}
diff --git a/graph/resolvers/root_query.js b/graph/resolvers/root_query.js
index 622584310..9dd78c2fc 100644
--- a/graph/resolvers/root_query.js
+++ b/graph/resolvers/root_query.js
@@ -98,7 +98,6 @@ const RootQuery = {
// this returns an arbitrary user
user(_, {id}, {user, loaders: {Users}}) {
- console.log("user id!", id);
if (user == null || !user.hasRoles('ADMIN')) {
return null;
}
diff --git a/graph/resolvers/user.js b/graph/resolvers/user.js
index d8ed7ee15..4f6528454 100644
--- a/graph/resolvers/user.js
+++ b/graph/resolvers/user.js
@@ -20,6 +20,15 @@ const User = {
return null;
},
+ profiles({id, profiles}, _, {user}) {
+
+ // if the user is not an admin, do not return the profiles
+ if (user && (user.hasRoles('ADMIN') || user.id === id)) {
+ return profiles;
+ }
+
+ return null;
+ },
roles({id, roles}, _, {user}) {
// If the user is not an admin, only return the current user's roles.
diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql
index 4fa7a1531..f1d0acac4 100644
--- a/graph/typeDefs.graphql
+++ b/graph/typeDefs.graphql
@@ -20,6 +20,14 @@ enum USER_ROLES {
MODERATOR
}
+type UserProfile {
+ # the id is an identifier for the user profile (email, facebook id, etc)
+ id: String!
+
+ # name of the provider attached to the authentication mode
+ provider: String!
+}
+
# Any person who can author comments, create actions, and view comments on a
# stream.
type User {
@@ -39,6 +47,9 @@ type User {
# the current roles of the user.
roles: [USER_ROLES]
+ # the current profiles of the user.
+ profiles: [UserProfile]
+
# determines whether the user can edit their username
canEditName: Boolean