Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE: #67 - Remove Slack and remaining Intercom references #79

Merged
merged 6 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
node_modules/
npm-debug.log
polis.config.js
.DS_Store
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#67](https://github.com/DFE-Digital/polis-whitelabel/issues/67) Remove Slack and more Intercom (Upstream alignment)
- [#66](https://github.com/DFE-Digital/polis-whitelabel/issues/66) Improve language support including left-to-right, Farsi translation and improvements to German (Upstream Alignment)
- [#52](https://github.com/DFE-Digital/polis-whitelabel/issues/52) Example reverse-proxy for production
- [#11](https://github.com/DFE-Digital/polis-whitelabel/issues/11) Added Devcontainer based development environment
Expand Down
2 changes: 0 additions & 2 deletions client-admin/src/strings/en_us.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ s.polis_err_reg_need_name = 'Please include your name.'

s.polis_err_post_comment_duplicate =
'Error posting: This comment already exists!'
s.waitinglist_add_success =
"You've been added to the waiting list! We'll be in touch."

s.polis_err_fetching_tweet =
'Error fetching tweet. Expected a URL to a twitter tweet.'
Expand Down
2 changes: 0 additions & 2 deletions client-admin/src/strings/pt_br.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ s.polis_err_reg_need_name = 'Por favor inclua seu nome.'

s.polis_err_post_comment_duplicate =
'Erro ao publicar. Este comentário já existe!'
s.waitinglist_add_success =
'Você já foi incluído na lista de email! Manteremos contato.'

s.polis_err_fetching_tweet =
'Erro buscando tuíte. Verifique se esse link é mesmo de um tuíte.'
Expand Down
11 changes: 0 additions & 11 deletions client-participation/css/awesome_config/font-awesome.scss

This file was deleted.

1 change: 0 additions & 1 deletion client-participation/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ window.twitterStatus = function(status) {
eb.trigger(eb.twitterStatus, status);
};


preloadHelper.firstConvPromise.then(function() {
PostMessageUtils.postInitEvent("ok");
}, function() {
Expand Down
3 changes: 0 additions & 3 deletions client-participation/js/stores/polis.js
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,6 @@ module.exports = function(params) {
var numComments = pcaCenter.length;
var numVotes = o.votes.length;

// https://files.slack.com/files-pri/T02G773HK-F02N30MKD/slack_for_ios_upload.jpg
if (numVotes > 0 && (o.pid !== -1 || USE_JETPACK_FOR_SELF)) {
var jetpack_aka_sparsity_compensation_factor = Math.sqrt(numComments / numVotes);
x *= jetpack_aka_sparsity_compensation_factor;
Expand Down Expand Up @@ -2427,8 +2426,6 @@ module.exports = function(params) {

var numComments = pcaCenter.length;

// https://files.slack.com/files-pri/T02G773HK-F02N30MKD/slack_for_ios_upload.jpg

var numVotes = 1; // pretend the comment is a person who voted for only itself
var jetpack_aka_sparsity_compensation_factor = Math.sqrt(numComments / numVotes);

Expand Down
2 changes: 1 addition & 1 deletion client-participation/js/util/facebookButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function facebookLoginOkHandler(response, optionalPassword) {
if (response && response.authResponse && response.authResponse.grantedScopes) {
data.fb_granted_scopes = response.authResponse.grantedScopes;
}
data.owner = false;
data.owner = false; // since this is the participation view, don't assume they're an owner


M.add(M.FB_AUTH_INIT);
Expand Down
18 changes: 4 additions & 14 deletions database/migrations/000000_initial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ CREATE TABLE contexts(
CREATE TABLE slack_oauth_access_tokens (
slack_access_token VARCHAR(100) NOT NULL,
slack_scope VARCHAR(100) NOT NULL,
-- slack_team VARCHAR(100) NOT NULL,
-- slack_team VARCHAR(100) NOT NULL,
slack_auth_response json NOT NULL,
created BIGINT DEFAULT now_as_millis()
-- UNIQUE(slack_team)
Expand Down Expand Up @@ -733,7 +733,7 @@ CREATE TABLE reports (
modified BIGINT DEFAULT now_as_millis(),

report_name VARCHAR(999),

label_x_neg VARCHAR(999),
label_x_pos VARCHAR(999),
label_y_neg VARCHAR(999),
Expand Down Expand Up @@ -784,7 +784,7 @@ CREATE TABLE math_ticks (
modified BIGINT NOT NULL DEFAULT now_as_millis(),
UNIQUE (zid, math_env)
);
-- insert into math_ticks (zid) values ($1) on conflict (zid)
-- insert into math_ticks (zid) values ($1) on conflict (zid)
-- do update set modified = now_as_millis(), math_tick = (math_tick + 1) returning *;

CREATE TABLE math_main (
Expand Down Expand Up @@ -896,7 +896,7 @@ CREATE INDEX votes_zid_pid_idx ON votes USING btree (zid, pid);
-- if that fails, run this and retry
-- delete from votes a where a.ctid <> (select min(b.ctid) from votes b where a.zid = b.zid and a.tid = b.tid and a.pid = b.pid and a.vote = b.vote and a.created = b.created);

CREATE TABLE votes_latest_unique (
CREATE TABLE votes_latest_unique (
zid INTEGER NOT NULL,
pid INTEGER NOT NULL,
tid INTEGER NOT NULL,
Expand Down Expand Up @@ -969,16 +969,6 @@ CREATE TABLE contributer_agreement_signatures(
);


CREATE TABLE waitinglist (
email VARCHAR(256) NOT NULL,
campaign VARCHAR(100) NOT NULL,
name VARCHAR(746),
affiliation VARCHAR(999),
role VARCHAR(999),
intercom_lead_user_id VARCHAR(100),
created BIGINT DEFAULT now_as_millis()
);

-- -- This should be updated from math nodes, who will have an entire conversation loaded in memory.
-- CREATE TABLE stats_per_comment(
-- zid INTEGER NOT NULL,
Expand Down
7 changes: 7 additions & 0 deletions database/migrations/000006_remove_slack.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Remove any references in database to slack

ALTER TABLE conversations DROP COLUMN IF EXISTS is_slack;
DROP TABLE IF EXISTS slack_oauth_access_tokens;
DROP TABLE IF EXISTS slack_users;
DROP TABLE IF EXISTS slack_user_invites;
DROP TABLE IF EXISTS slack_bot_events;
1 change: 1 addition & 0 deletions database/migrations/000007_drop_waitinglist_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS waitinglist;
6 changes: 0 additions & 6 deletions server-routes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
get "/api/v3/auth/slack/redirect_uri",
get "/api/v3/bid",
get "/api/v3/bidToPid",
get "/api/v3/changePlanWithCoupon",
Expand Down Expand Up @@ -61,7 +60,6 @@ post "/api/v3/auth/password",
post "/api/v3/auth/pwresettoken",
post "/api/v3/charge",
post "/api/v3/comments",
post "/api/v3/comments/slack",
post "/api/v3/contexts",
post "/api/v3/contributors",
post "/api/v3/conversation/close",
Expand All @@ -86,15 +84,12 @@ post "/api/v3/reports",
post "/api/v3/reserve_conversation_id",
post "/api/v3/sendCreatedLinkToEmail",
post "/api/v3/sendEmailExportReady",
post "/api/v3/slack/interactive_messages",
post "/api/v3/slack/user/invites",
post "/api/v3/stars",
post "/api/v3/trashes",
post "/api/v3/tutorial",
post "/api/v3/upvotes",
post "/api/v3/users/invite",
post "/api/v3/votes",
post "/api/v3/waitinglist",
post "/api/v3/xidWhitelist",
post "/api/v3/zinvites/:zid",

Expand Down Expand Up @@ -162,7 +157,6 @@ get /^\/settings\/enterprise}.*$/, makeFetchIndexWithoutPreloadData());
get /^\/share\/[0-9][0-9A-Za-z]+(\/.*)?/, fetchIndexForConversation); // share view
get /^\/signin(\/.*)?/, fetchIndexForAdminPage);
get /^\/signout(\/.*)?/, fetchIndexForAdminPage);
get /^\/slack_login_code.*/,
get /^\/summary\/[0-9][0-9A-Za-z]+(\/.*)?/, fetchIndexForConversation); // summary view
get /^\/thirdPartyCookieTestPt1\.html$/, fetchThirdPartyCookieTestPt1);
get /^\/thirdPartyCookieTestPt2\.html$/, fetchThirdPartyCookieTestPt2);
Expand Down
3 changes: 0 additions & 3 deletions server/.envrc.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ export MAILDEV_SMTP_PORT=1025
# export GOOGLE_APPLICATION_CREDENTIALS=
# export MAILGUN_API_KEY=
# export MAILGUN_DOMAIN=
# export POLIS_SLACK_APP_CLIENT_ID=
# export POLIS_SLACK_APP_CLIENT_SECRET=
# export POSTMARK_API_KEY=
# export PRIMARY_POLIS_URL=
# export PUSHOVER_GROUP_POLIS_DEV=
# export PUSHOVER_POLIS_PROXY_API_KEY=
# export RUN_PERIODIC_EXPORT_TESTS=
# export SERVICE_HOSTNAME=
# export SLACK_API_TOKEN=
# export TWITTER_CONSUMER_KEY=
# export TWITTER_CONSUMER_SECRET=
67 changes: 0 additions & 67 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ helpersInitialized.then(
handle_GET_ptptois,
handle_GET_reports,
handle_GET_setup_assignment_xml,
handle_GET_slack_login,
handle_GET_snapshot,
hangle_GET_testConnection,
hangle_GET_testDatabase,
Expand All @@ -128,9 +127,7 @@ helpersInitialized.then(
handle_POST_auth_new,
handle_POST_auth_password,
handle_POST_auth_pwresettoken,
handle_POST_auth_slack_redirect_uri,
handle_POST_comments,
handle_POST_comments_slack,
handle_POST_contexts,
handle_POST_contributors,
handle_POST_conversation_close,
Expand All @@ -155,15 +152,12 @@ helpersInitialized.then(
handle_POST_reserve_conversation_id,
handle_POST_sendCreatedLinkToEmail,
handle_POST_sendEmailExportReady,
handle_POST_slack_interactive_messages,
handle_POST_slack_user_invites,
handle_POST_stars,
handle_POST_trashes,
handle_POST_tutorial,
handle_POST_upvotes,
handle_POST_users_invite,
handle_POST_votes,
handle_POST_waitinglist,
handle_POST_xidWhitelist,
handle_POST_zinvites,
handle_PUT_comments,
Expand Down Expand Up @@ -593,20 +587,6 @@ helpersInitialized.then(
handle_GET_snapshot
);

app.get(
"/api/v3/auth/slack/redirect_uri",
moveToBody,
need("code", getStringLimitLength(1, 999), assignToP),
want("state", getStringLimitLength(999), assignToP),
handle_POST_auth_slack_redirect_uri
);

app.post(
"/api/v3/slack/interactive_messages",
need("payload", getOptionalStringLimitLength(9999), assignToP, ""),
handle_POST_slack_interactive_messages
);

// this endpoint isn't really ready for general use TODO_SECURITY
app.get(
"/api/v3/facebook/delete",
Expand Down Expand Up @@ -748,28 +728,6 @@ helpersInitialized.then(
handle_POST_comments
);

app.post(
"/api/v3/comments/slack",
auth(assignToP),
want("slack_team", getOptionalStringLimitLength(99), assignToP),
want("slack_user_id", getOptionalStringLimitLength(99), assignToP),
need(
"conversation_id",
getConversationIdFetchZid,
assignToPCustom("zid")
),
want("txt", getOptionalStringLimitLength(997), assignToP),
want("vote", getIntInRange(-1, 1), assignToP, -1), // default to agree
want("twitter_tweet_id", getStringLimitLength(999), assignToP),
want("quote_twitter_screen_name", getStringLimitLength(999), assignToP),
want("quote_txt", getStringLimitLength(999), assignToP),
want("quote_src_url", getUrlLimitLength(999), assignToP),
want("anon", getBool, assignToP),
want("is_seed", getBool, assignToP),
resolve_pidThing("pid", assignToP, "post:comments"),
handle_POST_comments_slack
);

app.get(
"/api/v3/comments/translations",
auth(assignToP),
Expand Down Expand Up @@ -1317,7 +1275,6 @@ helpersInitialized.then(
want("topic", getOptionalStringLimitLength(1000), assignToP, ""),
want("description", getOptionalStringLimitLength(50000), assignToP, ""),
want("conversation_id", getStringLimitLength(6, 300), assignToP, ""),
want("is_slack", getBool, assignToP, false),
want("is_data_open", getBool, assignToP, false),
want("ownerXid", getStringLimitLength(1, 999), assignToP),
handle_POST_conversations
Expand Down Expand Up @@ -1531,20 +1488,6 @@ helpersInitialized.then(
handle_POST_users_invite
);

app.get(
/^\/slack_login_code.*/,
moveToBody,
authOptional(assignToP),
handle_GET_slack_login
);

app.post(
"/api/v3/slack/user/invites",
need("slack_team", getStringLimitLength(1, 20), assignToP),
need("slack_user_id", getStringLimitLength(1, 20), assignToP),
handle_POST_slack_user_invites
);

app.get(
/^\/polis_site_id.*/,
moveToBody,
Expand Down Expand Up @@ -1638,16 +1581,6 @@ helpersInitialized.then(
handle_POST_contributors
);

app.post(
"/api/v3/waitinglist",
need("name", getStringLimitLength(746), assignToP),
need("email", getEmail, assignToP),
want("affiliation", getStringLimitLength(999), assignToP),
want("role", getStringLimitLength(999), assignToP),
need("campaign", getStringLimitLength(100), assignToP),
handle_POST_waitinglist
);

app.post(
"/api/v3/metrics",
authOptional(assignToP),
Expand Down
Loading