aboutsummaryrefslogtreecommitdiffstats
path: root/webui
diff options
context:
space:
mode:
authorQuentin Gliech <quentingliech@gmail.com>2019-05-22 21:46:43 +0200
committerQuentin Gliech <quentingliech@gmail.com>2019-05-22 21:46:43 +0200
commit1c2ee10ce7a32df892604846279c7e199ce0ccea (patch)
treee5534df088b309eeb2cb9096f0a4c87a46abd292 /webui
parentaa6247ce870075922a1309718e8fafee321ef51d (diff)
downloadgit-bug-1c2ee10ce7a32df892604846279c7e199ce0ccea.tar.gz
graphql: Implement `Authored` whenever possible
webui: Use a fragment for Authored nodes
Diffstat (limited to 'webui')
-rw-r--r--webui/src/Author.js12
-rw-r--r--webui/src/bug/Bug.js7
-rw-r--r--webui/src/bug/LabelChange.js8
-rw-r--r--webui/src/bug/Message.js18
-rw-r--r--webui/src/bug/SetStatus.js8
-rw-r--r--webui/src/bug/SetTitle.js8
-rw-r--r--webui/src/list/BugRow.js8
7 files changed, 33 insertions, 36 deletions
diff --git a/webui/src/Author.js b/webui/src/Author.js
index 7bb1bf3c..237a7956 100644
--- a/webui/src/Author.js
+++ b/webui/src/Author.js
@@ -1,3 +1,4 @@
+import gql from 'graphql-tag';
import Tooltip from '@material-ui/core/Tooltip/Tooltip';
import MAvatar from '@material-ui/core/Avatar';
import React from 'react';
@@ -14,6 +15,17 @@ const Author = ({ author, ...props }) => {
);
};
+Author.fragment = gql`
+ fragment authored on Authored {
+ author {
+ name
+ email
+ displayName
+ avatarUrl
+ }
+ }
+`;
+
export const Avatar = ({ author, ...props }) => {
if (author.avatarUrl) {
return <MAvatar src={author.avatarUrl} {...props} />;
diff --git a/webui/src/bug/Bug.js b/webui/src/bug/Bug.js
index 1b19149d..ff57dfa9 100644
--- a/webui/src/bug/Bug.js
+++ b/webui/src/bug/Bug.js
@@ -94,13 +94,10 @@ Bug.fragment = gql`
...Label
}
createdAt
- author {
- email
- name
- displayName
- }
+ ...authored
}
${Label.fragment}
+ ${Author.fragment}
`;
export default Bug;
diff --git a/webui/src/bug/LabelChange.js b/webui/src/bug/LabelChange.js
index 1e05b4a6..2405fdb5 100644
--- a/webui/src/bug/LabelChange.js
+++ b/webui/src/bug/LabelChange.js
@@ -44,11 +44,7 @@ LabelChange.fragment = gql`
fragment LabelChange on TimelineItem {
... on LabelChangeTimelineItem {
date
- author {
- name
- email
- displayName
- }
+ ...authored
added {
...Label
}
@@ -57,7 +53,9 @@ LabelChange.fragment = gql`
}
}
}
+
${Label.fragment}
+ ${Author.fragment}
`;
export default LabelChange;
diff --git a/webui/src/bug/Message.js b/webui/src/bug/Message.js
index ff039444..8a6cac09 100644
--- a/webui/src/bug/Message.js
+++ b/webui/src/bug/Message.js
@@ -70,32 +70,26 @@ Message.createFragment = gql`
fragment Create on TimelineItem {
... on CreateTimelineItem {
createdAt
- author {
- name
- email
- displayName
- avatarUrl
- }
+ ...authored
edited
message
}
}
+
+ ${Author.fragment}
`;
Message.commentFragment = gql`
fragment AddComment on TimelineItem {
... on AddCommentTimelineItem {
createdAt
- author {
- name
- email
- displayName
- avatarUrl
- }
+ ...authored
edited
message
}
}
+
+ ${Author.fragment}
`;
export default Message;
diff --git a/webui/src/bug/SetStatus.js b/webui/src/bug/SetStatus.js
index ab591038..eeff1a7b 100644
--- a/webui/src/bug/SetStatus.js
+++ b/webui/src/bug/SetStatus.js
@@ -26,14 +26,12 @@ SetStatus.fragment = gql`
fragment SetStatus on TimelineItem {
... on SetStatusTimelineItem {
date
- author {
- name
- email
- displayName
- }
+ ...authored
status
}
}
+
+ ${Author.fragment}
`;
export default SetStatus;
diff --git a/webui/src/bug/SetTitle.js b/webui/src/bug/SetTitle.js
index d9a09ad5..9ba5a76e 100644
--- a/webui/src/bug/SetTitle.js
+++ b/webui/src/bug/SetTitle.js
@@ -32,15 +32,13 @@ SetTitle.fragment = gql`
fragment SetTitle on TimelineItem {
... on SetTitleTimelineItem {
date
- author {
- name
- email
- displayName
- }
+ ...authored
title
was
}
}
+
+ ${Author.fragment}
`;
export default SetTitle;
diff --git a/webui/src/list/BugRow.js b/webui/src/list/BugRow.js
index cfac4616..c5fc7647 100644
--- a/webui/src/list/BugRow.js
+++ b/webui/src/list/BugRow.js
@@ -9,6 +9,7 @@ import React from 'react';
import { Link } from 'react-router-dom';
import Date from '../Date';
import Label from '../Label';
+import Author from '../Author';
const Open = ({ className }) => (
<Tooltip title="Open">
@@ -97,12 +98,11 @@ BugRow.fragment = gql`
labels {
...Label
}
- author {
- name
- displayName
- }
+ ...authored
}
+
${Label.fragment}
+ ${Author.fragment}
`;
export default BugRow;