diff --git a/client/coral-embed-stream/src/components/Comment.css b/client/coral-embed-stream/src/components/Comment.css index 32a034f51..578df2d80 100644 --- a/client/coral-embed-stream/src/components/Comment.css +++ b/client/coral-embed-stream/src/components/Comment.css @@ -163,6 +163,7 @@ .header { display: flex; align-items: center; + margin: 10px 0; } .content { @@ -171,3 +172,7 @@ .footer { min-height: 10px; } + +.username { + margin-right: 5px; +} \ No newline at end of file diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index bb6fee981..85dee9392 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -1,7 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import AuthorName from 'talk-plugin-author-name/AuthorName'; import TagLabel from 'talk-plugin-tag-label/TagLabel'; import PubDate from 'talk-plugin-pubdate/PubDate'; import {ReplyBox, ReplyButton} from 'talk-plugin-replies'; @@ -26,6 +25,7 @@ import {EditableCommentContent} from './EditableCommentContent'; import {getActionSummary, iPerformedThisAction, forEachError, isCommentActive, getShallowChanges} from 'coral-framework/utils'; import t from 'coral-framework/services/i18n'; import CommentContainer from '../containers/Comment'; +import {CommentAuthorName} from 'coral-framework/components'; const isStaff = (tags) => !tags.every((t) => t.tag.name !== 'STAFF'); const hasTag = (tags, lookupTag) => !!tags.filter((t) => t.tag.name === lookupTag).length; @@ -434,10 +434,17 @@ export default class Comment extends React.Component { inline /> -
+
+
+ + -
- {isStaff(comment.tags) ? Staff : null} diff --git a/client/coral-embed-stream/src/containers/Comment.js b/client/coral-embed-stream/src/containers/Comment.js index 8e592d28e..e34218883 100644 --- a/client/coral-embed-stream/src/containers/Comment.js +++ b/client/coral-embed-stream/src/containers/Comment.js @@ -15,7 +15,8 @@ const slots = [ 'commentActions', 'commentContent', 'commentReactions', - 'commentAvatar' + 'commentAvatar', + 'commentAuthorName' ]; /** diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css index 6ba376096..d4078bf27 100644 --- a/client/coral-embed-stream/style/default.css +++ b/client/coral-embed-stream/style/default.css @@ -238,16 +238,6 @@ body { line-height: 1.3; } -.talk-plugin-author-name-text { - display: inline-block; - margin: 10px 5px 10px 0; - font-weight: bold; -} - -.talk-plugin-author-name-bio-flag { - float: right; -} - /* Tag Labels */ .talk-plugin-tag-label { diff --git a/client/coral-framework/components/CommentAuthorName.css b/client/coral-framework/components/CommentAuthorName.css new file mode 100644 index 000000000..c06360000 --- /dev/null +++ b/client/coral-framework/components/CommentAuthorName.css @@ -0,0 +1,3 @@ +.authorName { + font-weight: bold; +} \ No newline at end of file diff --git a/client/coral-framework/components/CommentAuthorName.js b/client/coral-framework/components/CommentAuthorName.js new file mode 100644 index 000000000..5a2e60c70 --- /dev/null +++ b/client/coral-framework/components/CommentAuthorName.js @@ -0,0 +1,9 @@ +import React from 'react'; +import styles from './CommentAuthorName.css'; + +const CommentAuthorName = ({comment}) => + + {comment.user.username} + ; + +export default CommentAuthorName; diff --git a/client/coral-framework/components/index.js b/client/coral-framework/components/index.js index b7aaef665..8ad08aa09 100644 --- a/client/coral-framework/components/index.js +++ b/client/coral-framework/components/index.js @@ -1 +1,2 @@ export {default as Slot} from './Slot'; +export {default as CommentAuthorName} from './CommentAuthorName'; diff --git a/client/talk-plugin-author-name/AuthorName.js b/client/talk-plugin-author-name/AuthorName.js deleted file mode 100644 index 89835a742..000000000 --- a/client/talk-plugin-author-name/AuthorName.js +++ /dev/null @@ -1,31 +0,0 @@ -import React, {Component} from 'react'; -const packagename = 'talk-plugin-author-name'; - -export default class AuthorName extends Component { - - state = {showTooltip: false} - - handleClick = () => { - this.setState((state) => ({ - showTooltip: !state.showTooltip - })); - } - - handleMouseLeave = () => { - setTimeout(() => { - this.setState({ - showTooltip: false - }); - }, 500); - } - - render () { - const {author} = this.props; - return ( -
- {author && author.username} -
- ); - } -} diff --git a/client/talk-plugin-author-name/styles.css b/client/talk-plugin-author-name/styles.css deleted file mode 100644 index b7870a862..000000000 --- a/client/talk-plugin-author-name/styles.css +++ /dev/null @@ -1,34 +0,0 @@ -.authorName { - color: black; - display: inline-block; - margin: 10px 8px 10px 0; -} - -.hasBio { - &:hover { - cursor: pointer; - } -} - -.arrowDown { - top: 0; - width: 0; - height: 0; - margin-top: -2px; - margin-left: 2px; - display: inline-block; - vertical-align: middle; - border-bottom: 0; - border-left: 3px solid transparent; - border-right: 3px solid transparent; - border-top: 3px solid #000000; -} - -.arrowUp { - width: 0; - height: 0; - border-top: 0; - border-left: 3px solid transparent; - border-right: 3px solid transparent; - border-bottom: 3px solid black; -} diff --git a/errors.js b/errors.js index 79731dad6..ab1667e07 100644 --- a/errors.js +++ b/errors.js @@ -5,7 +5,7 @@ class ExtendableError { constructor(message = null) { this.message = message; - this.stack = (new Error()).stack; + this.stack = (new Error(message)).stack; } } diff --git a/graph/resolvers/user.js b/graph/resolvers/user.js index 5a851233a..e566a6af0 100644 --- a/graph/resolvers/user.js +++ b/graph/resolvers/user.js @@ -22,13 +22,6 @@ const User = { } }, - created_at({roles, created_at}, _, {user}) { - if (user && user.can(SEARCH_OTHER_USERS)) { - return created_at; - } - - return null; - }, comments({id}, {query}, {loaders: {Comments}, user}) { // If the user is not an admin, only return comment list for the owner of diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql index d83d9f75f..0e430cd84 100644 --- a/graph/typeDefs.graphql +++ b/graph/typeDefs.graphql @@ -76,7 +76,7 @@ type User { username: String! # creation date of user - created_at: String! + created_at: Date! # Action summaries against the user. action_summaries: [ActionSummary!]! diff --git a/plugin-api/beta/client/components/index.js b/plugin-api/beta/client/components/index.js index 6466b9ffc..8b0448f4e 100644 --- a/plugin-api/beta/client/components/index.js +++ b/plugin-api/beta/client/components/index.js @@ -1,2 +1,3 @@ export {Slot} from 'coral-framework/components'; export {default as ClickOutside} from 'coral-framework/components/ClickOutside'; +export {default as CommentAuthorName} from 'coral-framework/components/CommentAuthorName'; diff --git a/plugins/talk-plugin-auth/client/components/FakeComment.css b/plugins/talk-plugin-auth/client/components/FakeComment.css index 8b5521aea..bc751b115 100644 --- a/plugins/talk-plugin-auth/client/components/FakeComment.css +++ b/plugins/talk-plugin-auth/client/components/FakeComment.css @@ -6,10 +6,6 @@ position: relative; } -.body { - -} - .footer { display: flex; justify-content: space-between; @@ -35,3 +31,8 @@ padding: 0 2px 0 5px; vertical-align: middle; } + +.authorName { + margin-right: 5px; + font-weight: bold; +} \ No newline at end of file diff --git a/plugins/talk-plugin-auth/client/components/FakeComment.js b/plugins/talk-plugin-auth/client/components/FakeComment.js index eefada587..9f1d90ae7 100644 --- a/plugins/talk-plugin-auth/client/components/FakeComment.js +++ b/plugins/talk-plugin-auth/client/components/FakeComment.js @@ -2,13 +2,14 @@ import React from 'react'; import t from 'coral-framework/services/i18n'; import {ReplyButton} from 'talk-plugin-replies'; import PubDate from 'talk-plugin-pubdate/PubDate'; -import AuthorName from 'talk-plugin-author-name/AuthorName'; import styles from './FakeComment.css'; import {Icon} from 'plugin-api/beta/client/components/ui'; export const FakeComment = ({username, created_at, body}) => (
- + + {username} + ;
{body} diff --git a/plugins/talk-plugin-featured-comments/client/components/Comment.css b/plugins/talk-plugin-featured-comments/client/components/Comment.css index 36f3e790e..b800401e3 100644 --- a/plugins/talk-plugin-featured-comments/client/components/Comment.css +++ b/plugins/talk-plugin-featured-comments/client/components/Comment.css @@ -64,4 +64,4 @@ .actionsContainer { text-align: right; -} +} \ No newline at end of file diff --git a/plugins/talk-plugin-featured-comments/client/components/Comment.js b/plugins/talk-plugin-featured-comments/client/components/Comment.js index 01b5f864c..ada7ae7b6 100644 --- a/plugins/talk-plugin-featured-comments/client/components/Comment.js +++ b/plugins/talk-plugin-featured-comments/client/components/Comment.js @@ -2,7 +2,7 @@ import React from 'react'; import cn from 'classnames'; import styles from './Comment.css'; import {t, timeago} from 'plugin-api/beta/client/services'; -import {Slot} from 'plugin-api/beta/client/components'; +import {Slot, CommentAuthorName} from 'plugin-api/beta/client/components'; import {Icon} from 'plugin-api/beta/client/components/ui'; import {pluginName} from '../../package.json'; @@ -22,9 +22,16 @@ class Comment extends React.Component {
- - {comment.user.username} - + + + ,{' '}{timeago(comment.created_at)} diff --git a/plugins/talk-plugin-featured-comments/client/containers/Comment.js b/plugins/talk-plugin-featured-comments/client/containers/Comment.js index bba764a1d..a647bf1b4 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/Comment.js +++ b/plugins/talk-plugin-featured-comments/client/containers/Comment.js @@ -5,6 +5,7 @@ import {getSlotFragmentSpreads} from 'plugin-api/beta/client/utils'; const slots = [ 'commentReactions', + 'commentAuthorName', ]; export default withFragments({