diff --git a/client-admin/src/components/conversation-admin/conversation-config.js b/client-admin/src/components/conversation-admin/conversation-config.js index ae8d18cbd..86191259a 100644 --- a/client-admin/src/components/conversation-admin/conversation-config.js +++ b/client-admin/src/components/conversation-admin/conversation-config.js @@ -166,14 +166,6 @@ class ConversationConfig extends React.Component { notifications when there are new comments to vote on. - - Show Facebook login prompt - - - - Show Twitter login prompt - - No comments shown without moderator approval - - - Participants cannot submit comments without first connecting either - Facebook or Twitter - - - - Participants cannot vote without first connecting either Facebook or - Twitter - ) } diff --git a/client-participation/js/templates/comment-form.handlebars b/client-participation/js/templates/comment-form.handlebars index 3b7c3c8b6..282f40ca6 100644 --- a/client-participation/js/templates/comment-form.handlebars +++ b/client-participation/js/templates/comment-form.handlebars @@ -152,44 +152,6 @@ - {{!-- ================ CONNECT FACEBOOK / TWITTER ================ --}} -
-

  {{s.connectToPostPrompt}}

- {{#if auth_opt_fb}} - {{#unless hasFacebook}} - - {{/unless}} - {{/if}} - {{#if auth_opt_tw}} - {{#unless hasTwitter}} - - {{/unless}} - {{/if}} -
- {{!-- ================ LOWER CONTAINER ================ --}}
-

  {{s.connectToVotePrompt}}

- {{#if auth_opt_fb}} - {{#unless hasFacebook}} - - {{/unless}} - {{/if}} - {{#if auth_opt_tw}} - {{#unless hasTwitter}} - - {{/unless}} - {{/if}} -
+ {{else}} {{!-- !needSocial --}} diff --git a/client-participation/js/views/comment-form.js b/client-participation/js/views/comment-form.js index 4aa052f51..a1c0dee78 100644 --- a/client-participation/js/views/comment-form.js +++ b/client-participation/js/views/comment-form.js @@ -44,8 +44,8 @@ module.exports = Handlebones.ModelView.extend({ Utils.shouldFocusOnTextareaWhenWritePaneShown(); ctx.hasTwitter = userObject.hasTwitter; ctx.hasFacebook = userObject.hasFacebook && Constants.FB_APP_ID; - ctx.auth_opt_tw = preload.firstConv.auth_opt_tw; - ctx.auth_opt_fb = preload.firstConv.auth_opt_fb; + ctx.auth_opt_tw = false; + ctx.auth_opt_fb = false; ctx.s = Strings; ctx.desktop = !display.xs(); ctx.hideHelp = !Utils.userCanSeeHelp() || preload.firstConv.help_type === 0; @@ -251,7 +251,7 @@ module.exports = Handlebones.ModelView.extend({ window.userObject.hasFacebook || window.userObject.hasTwitter || !_.isUndefined(xid); - var needsSocial = preload.firstConv.auth_needed_to_write; + var needsSocial = false; M.add(M.COMMENT_SUBMIT_CLICK); if (hasSocial || !needsSocial) { M.add(M.COMMENT_SUBMIT_INIT); diff --git a/e2e/cypress/e2e/client-admin/conversation.cy.js b/e2e/cypress/e2e/client-admin/conversation.cy.js index f5a8f8230..cd6502560 100644 --- a/e2e/cypress/e2e/client-admin/conversation.cy.js +++ b/e2e/cypress/e2e/client-admin/conversation.cy.js @@ -23,14 +23,10 @@ describe('Conversation: Configure', function () { cy.get('input[data-test-id="write_type"]').should('be.checked') cy.get('input[data-test-id="help_type"]').should('be.checked') cy.get('input[data-test-id="subscribe_type"]').should('be.checked') - cy.get('input[data-test-id="auth_opt_fb"]').should('be.checked') - cy.get('input[data-test-id="auth_opt_tw"]').should('be.checked') // Schemes section cy.get('input[data-test-id="is_active"]').should('be.checked') cy.get('input[data-test-id="strict_moderation"]').should('not.be.checked') - cy.get('input[data-test-id="auth_needed_to_write"]').should('be.checked') - cy.get('input[data-test-id="auth_needed_to_vote"]').should('not.be.checked') }) it('should create a new conversation with a topic and description', function () { diff --git a/e2e/cypress/e2e/client-admin/share.cy.js b/e2e/cypress/e2e/client-admin/share.cy.js index 122c91f23..b0f5610d9 100644 --- a/e2e/cypress/e2e/client-admin/share.cy.js +++ b/e2e/cypress/e2e/client-admin/share.cy.js @@ -8,7 +8,6 @@ describe('Share page', function () { .then(() => cy.visit(this.adminPath)) cy.get('input[data-test-id="strict_moderation"]').check() - cy.get('input[data-test-id="auth_needed_to_write"]').uncheck() }) beforeEach(function () { diff --git a/e2e/cypress/e2e/client-participation/social-login.cy.js b/e2e/cypress/e2e/client-participation/social-login.cy.js index f61467774..f559bb54b 100644 --- a/e2e/cypress/e2e/client-participation/social-login.cy.js +++ b/e2e/cypress/e2e/client-participation/social-login.cy.js @@ -6,8 +6,9 @@ const facebookVoteBtn = 'button#facebookButtonVoteView' const twitterAuthOpt = 'input[data-test-id="auth_opt_tw"]' const twitterCommentBtn = 'button#twitterButtonCommentForm' const twitterVoteBtn = 'button#twitterButtonVoteView' - -describe('Social login buttons', function () { +// skip this test for now +// eslint-disable-next-line mocha/no-skipped-tests +describe.skip('Social login buttons', function () { before(function () { cy.createConvo().then(() => { cy.seedComment(this.convoId) diff --git a/server/src/server.ts b/server/src/server.ts index 560487e9c..4df1c6fd9 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -663,32 +663,32 @@ function initializePolisHelpers() { if (!conv.is_active) { throw "polis_err_conversation_is_closed"; } - if (conv.auth_needed_to_vote) { - return isModerator(zid, uid).then((is_mod: any) => { - if (is_mod) { - return conv; - } - return Promise.all([ - pgQueryP( - "select * from xids where owner = ($1) and uid = ($2);", - [conv.owner, uid] - ), - getSocialInfoForUsers([uid], zid), - // Binding elements 'xids' and 'info' implicitly have an 'any' type.ts(7031) - // @ts-ignore - ]).then(([xids, info]) => { - var socialAccountIsLinked = info.length > 0; - // Object is of type 'unknown'.ts(2571) - // @ts-ignore - var hasXid = xids.length > 0; - if (socialAccountIsLinked || hasXid) { - return conv; - } else { - throw "polis_err_post_votes_social_needed"; - } - }); - }); - } + // if (conv.auth_needed_to_vote) { + // return isModerator(zid, uid).then((is_mod: any) => { + // if (is_mod) { + // return conv; + // } + // return Promise.all([ + // pgQueryP( + // "select * from xids where owner = ($1) and uid = ($2);", + // [conv.owner, uid] + // ), + // getSocialInfoForUsers([uid], zid), + // // Binding elements 'xids' and 'info' implicitly have an 'any' type.ts(7031) + // // @ts-ignore + // ]).then(([xids, info]) => { + // var socialAccountIsLinked = info.length > 0; + // // Object is of type 'unknown'.ts(2571) + // // @ts-ignore + // var hasXid = xids.length > 0; + // if (socialAccountIsLinked || hasXid) { + // return conv; + // } else { + // throw "polis_err_post_votes_social_needed"; + // } + // }); + // }); + // } if (conv.use_xid_whitelist) { return isXidWhitelisted(conv.owner, xid).then( (is_whitelisted: boolean) => { @@ -8125,10 +8125,6 @@ Email verified! You can close this tab or hit the back button. if (!_.isUndefined(req.p.write_type)) { fields.write_type = req.p.write_type; } - ifDefinedSet("auth_needed_to_vote", req.p, fields); - ifDefinedSet("auth_needed_to_write", req.p, fields); - ifDefinedSet("auth_opt_fb", req.p, fields); - ifDefinedSet("auth_opt_tw", req.p, fields); ifDefinedSet("auth_opt_allow_3rdparty", req.p, fields); if (!_.isUndefined(req.p.owner_sees_participation_stats)) { @@ -8840,12 +8836,8 @@ Email verified! You can close this tab or hit the back button. conv.auth_opt_allow_3rdparty, true ); - conv.auth_opt_fb_computed = - conv.auth_opt_allow_3rdparty && - ifDefinedFirstElseSecond(conv.auth_opt_fb, true); - conv.auth_opt_tw_computed = - conv.auth_opt_allow_3rdparty && - ifDefinedFirstElseSecond(conv.auth_opt_tw, true); + conv.auth_opt_fb_computed = false; + conv.auth_opt_tw_computed = false; conv.translations = translations; @@ -9562,15 +9554,13 @@ Email verified! You can close this tab or hit the back button. owner_sees_participation_stats: !!req.p .owner_sees_participation_stats, // Set defaults for fields that aren't set at postgres level. - auth_needed_to_vote: - req.p.auth_needed_to_vote || DEFAULTS.auth_needed_to_vote, - auth_needed_to_write: - req.p.auth_needed_to_write || DEFAULTS.auth_needed_to_write, + auth_needed_to_vote: DEFAULTS.auth_needed_to_vote, + auth_needed_to_write: DEFAULTS.auth_needed_to_write, auth_opt_allow_3rdparty: req.p.auth_opt_allow_3rdparty || DEFAULTS.auth_opt_allow_3rdparty, - auth_opt_fb: req.p.auth_opt_fb || DEFAULTS.auth_opt_fb, - auth_opt_tw: req.p.auth_opt_tw || DEFAULTS.auth_opt_tw, + auth_opt_fb: DEFAULTS.auth_opt_fb, + auth_opt_tw: DEFAULTS.auth_opt_tw, }) .returning("*") .toString(); @@ -12469,12 +12459,8 @@ Thanks for using Polis! conv.auth_opt_allow_3rdparty, DEFAULTS.auth_opt_allow_3rdparty ); - let auth_opt_fb_computed = - auth_opt_allow_3rdparty && - ifDefinedFirstElseSecond(conv.auth_opt_fb, DEFAULTS.auth_opt_fb); - let auth_opt_tw_computed = - auth_opt_allow_3rdparty && - ifDefinedFirstElseSecond(conv.auth_opt_tw, DEFAULTS.auth_opt_tw); + let auth_opt_fb_computed = false; + let auth_opt_tw_computed = false; conv = { topic: conv.topic, @@ -12490,14 +12476,8 @@ Thanks for using Polis! help_color: conv.help_color, help_bgcolor: conv.help_bgcolor, style_btn: conv.style_btn, - auth_needed_to_vote: ifDefinedFirstElseSecond( - conv.auth_needed_to_vote, - DEFAULTS.auth_needed_to_vote - ), - auth_needed_to_write: ifDefinedFirstElseSecond( - conv.auth_needed_to_write, - DEFAULTS.auth_needed_to_write - ), + auth_needed_to_vote: false, + auth_needed_to_write: false, auth_opt_allow_3rdparty: auth_opt_allow_3rdparty, auth_opt_fb_computed: auth_opt_fb_computed, auth_opt_tw_computed: auth_opt_tw_computed, @@ -12598,10 +12578,6 @@ Thanks for using Polis! let dwok = req.p.dwok; let o: ConversationType = {}; ifDefinedSet("parent_url", req.p, o); - ifDefinedSet("auth_needed_to_vote", req.p, o); - ifDefinedSet("auth_needed_to_write", req.p, o); - ifDefinedSet("auth_opt_fb", req.p, o); - ifDefinedSet("auth_opt_tw", req.p, o); ifDefinedSet("auth_opt_allow_3rdparty", req.p, o); ifDefinedSet("topic", req.p, o); if (!_.isUndefined(req.p.show_vis)) { diff --git a/server/src/utils/constants.ts b/server/src/utils/constants.ts index f0de72098..718644196 100644 --- a/server/src/utils/constants.ts +++ b/server/src/utils/constants.ts @@ -1,9 +1,9 @@ const DEFAULTS = { auth_needed_to_vote: false, - auth_needed_to_write: true, + auth_needed_to_write: false, auth_opt_allow_3rdparty: true, - auth_opt_fb: true, - auth_opt_tw: true, + auth_opt_fb: false, + auth_opt_tw: false, }; export { DEFAULTS };