diff --git a/client/coral-embed-stream/src/components/Embed.js b/client/coral-embed-stream/src/components/Embed.js index 7445bf300..22c6146bd 100644 --- a/client/coral-embed-stream/src/components/Embed.js +++ b/client/coral-embed-stream/src/components/Embed.js @@ -38,7 +38,7 @@ export default class Embed extends React.Component { ]; if (can(user, 'UPDATE_CONFIG')) { tabs.push( - + {t('framework.configure_stream')} ); @@ -90,7 +90,7 @@ export default class Embed extends React.Component { , - + , ]} @@ -101,8 +101,18 @@ export default class Embed extends React.Component { } Embed.propTypes = { + setActiveTab: PropTypes.func, + auth: PropTypes.object, + blurSignInDialog: PropTypes.func, + focusSignInDialog: PropTypes.func, + hideSignInDialog: PropTypes.func, + router: PropTypes.object, + commentId: PropTypes.string, + root: PropTypes.object, + activeTab: PropTypes.string, data: PropTypes.shape({ loading: PropTypes.bool, - error: PropTypes.object + error: PropTypes.object, + refetch: PropTypes.func, }).isRequired }; diff --git a/client/coral-embed-stream/src/tabs/configure/components/AssetStatusInfo.js b/client/coral-embed-stream/src/tabs/configure/components/AssetStatusInfo.js index d3c2f14d7..81221dfe3 100644 --- a/client/coral-embed-stream/src/tabs/configure/components/AssetStatusInfo.js +++ b/client/coral-embed-stream/src/tabs/configure/components/AssetStatusInfo.js @@ -46,14 +46,16 @@ class AssetStatusInfo extends React.Component { render() { const {isClosed, closedAt, onClose, onOpen} = this.props; return ( -
+

{!isClosed ? t('configure.close') : t('configure.open')} {t('configure.comment_stream')}

{(!isClosed && closedAt) ?

{t('configure.comment_stream_will_close')} {timeago(new Date(closedAt))}.

: ''} -
+

{!isClosed ? t('configure.open_stream_configuration') : t('configure.close_stream_configuration')}

-
diff --git a/client/coral-embed-stream/src/tabs/stream/components/Comment.js b/client/coral-embed-stream/src/tabs/stream/components/Comment.js index ba14e3c7f..9748747f0 100644 --- a/client/coral-embed-stream/src/tabs/stream/components/Comment.js +++ b/client/coral-embed-stream/src/tabs/stream/components/Comment.js @@ -547,6 +547,7 @@ export default class Comment extends React.Component { queryData={queryData} inline /> + {!disableReply &&
+
+ button', profileTabButton: '.talk-embed-stream-profile-tab > button', + configTabButton: '.talk-embed-stream-config-tab > button', banDialog: '.talk-ban-user-dialog', banDialogConfirmButton: '.talk-ban-user-dialog-button-confirm', }, @@ -95,6 +102,7 @@ module.exports = { firstComment: '.talk-stream-comment.talk-stream-comment-level-0', firstCommentContent: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-content', flagButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-flags-button', + replyButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-replies-reply-button', respectButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button', restrictedMessageBox: '.talk-restricted-message-box', changeUsernameInput: '.talk-change-username-username-input', @@ -132,5 +140,26 @@ module.exports = { myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body', }, }, + config: { + selector: '.talk-embed-stream-config-tab-pane', + elements: { + openStream: '.talk-config-close-comments-open-button', + closeStream: '.talk-config-close-comments-close-button', + }, + commands: [{ + openStream: function() { + this.waitForElementVisible('@openStream'); + this.click('@openStream'); + this.waitForElementVisible('@closeStream'); + return this.section.config; + }, + closeStream: function() { + this.waitForElementVisible('@closeStream'); + this.click('@closeStream'); + this.waitForElementVisible('@openStream'); + return this.section.config; + }, + }] + }, }, }; diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index 073456b0f..ee870033a 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -111,4 +111,42 @@ module.exports = { profile .assert.visible('@notLoggedIn'); }, + 'admin logs in': (client) => { + const {testData: {admin}} = client.globals; + const embedStream = client.page.embedStream(); + + embedStream + .navigate() + .ready() + .openLoginPopup((popup) => popup.login(admin)); + }, + 'admin closes stream, users won\'t be able to perform some actions: reply ': (client) => { + + const embedStream = client.page.embedStream(); + + embedStream + .goToCommentsSection() + .waitForElementVisible('@firstComment') + .waitForElementVisible('@replyButton'); + + embedStream + .goToConfigSection() + .closeStream(); + + embedStream + .goToCommentsSection() + .waitForElementVisible('@firstComment') + .waitForElementNotPresent('@replyButton'); + + embedStream + .goToConfigSection() + .openStream(); + }, + 'admin logs out': (client) => { + const embedStream = client.page.embedStream(); + const comments = embedStream.goToCommentsSection(); + + comments + .logout(); + }, };