Skip to content

Add a Privacy Policy option #425

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"description": "A URL to a Code of Conduct people must agree on before joining.",
"required": false
},
"SLACK_PRIVACY": {
"description": "A URL to a privacy policy people must agree on before joining.",
"required": false
},
"SLACKIN_CHANNELS": {
"description": "Comma-separated list of single guest channels to invite them to (leave blank for a normal, all-channel invite). In order to make this work, you have to have a paid account. You'll only be able to invite as many people as your number of paying members times 5.",
"required": false
Expand Down
4 changes: 2 additions & 2 deletions assets/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
div.style.lineHeight = '0'
div.style.backgroundColor = '#fafafa'
div.style.width = '25em'
div.style.height = '15.5em'
div.style.height = '30em'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The badge changes are unrelated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The badge popup size had to be increased to make room for another checkbox

div.style.position = 'absolute'
div.style.left = '-10000px'
div.style.top = '-10000px'
Expand All @@ -123,7 +123,7 @@
var ni = document.createElement('iframe')
ni.className = '__slackin'
ni.style.width = '25em'
ni.style.height = '15.5em'
ni.style.height = '30em'
ni.style.borderWidth = 0
ni.src = iframe.src.replace('iframe', 'iframe/dialog')
ni.addEventListener('load', function () {
Expand Down
6 changes: 4 additions & 2 deletions assets/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var form = body.querySelector('form#invite')
var channel = form.elements.channel || {}
var email = form.elements.email
var coc = form.elements.coc
var privacy = form.elements.privacy
var button = body.querySelector('button')

// remove loading state
Expand All @@ -28,7 +29,7 @@ function submitForm(ev) {
return grecaptcha.execute()
}

invite(channel ? channel.value : null, coc && coc.checked ? 1 : 0, email.value, gcaptcha_token, function (err, msg) {
invite(channel ? channel.value : null, coc && coc.checked ? 1 : 0, privacy && privacy.checked ? 1 : 0, email.value, gcaptcha_token, function (err, msg) {
if (err) {
button.removeAttribute('disabled')
button.classList.add('error')
Expand All @@ -42,12 +43,13 @@ function submitForm(ev) {

body.addEventListener('submit', submitForm)

function invite(chan, coc, email, gcaptcha_response_value, fn) {
function invite(chan, coc, privacy, email, gcaptcha_response_value, fn) {
request
.post(data.path + 'invite')
.send({
'g-recaptcha-response': gcaptcha_response_value,
coc: coc,
privacy: privacy,
channel: chan,
email: email
})
Expand Down
4 changes: 4 additions & 0 deletions bin/slackin.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ args
['C', 'coc'], 'Full URL to a CoC that needs to be agreed to',
process.env.SLACKIN_COC,
)
.option(
['O', 'privacy'], 'Full URL to a privacy policy that must be agreed to',
process.env.SLACKIN_PRIVACY,
)
.option(
['S', 'css'], 'Full URL to a custom CSS file to use on the main page',
process.env.SLACKIN_CSS,
Expand Down
6 changes: 6 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function slackin({
channels,
emails,
coc,
privacy,
proxy,
pageDelay = 0,
redirectFQDN,
Expand Down Expand Up @@ -182,6 +183,7 @@ function slackin({
.type('html')
.render('main', {
coc,
privacy,
path: relativePath,
name,
org,
Expand All @@ -204,6 +206,7 @@ function slackin({
name,
org,
coc,
privacy,
logo,
active,
total,
Expand Down Expand Up @@ -231,6 +234,8 @@ function slackin({
errorMessage = 'Your email is not on the accepted list.';
} else if (coc && Number(req.body.coc) !== 1) {
errorMessage = 'Agreement to CoC is mandatory';
} else if (privacy && Number(req.body.privacy) !== 1) {
errorMessage = 'Agreement to the Privacy Policy is mandatory';
}

if (errorMessage) {
Expand Down Expand Up @@ -317,6 +322,7 @@ function slackin({
res.type('html');
res.render('main', {
coc,
privacy,
path: relativePath,
name,
org,
Expand Down
9 changes: 6 additions & 3 deletions scss/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ body {
}
}

.coc {
.coc,
.privacy {
font-size: 1.2rem;
padding: 1.5rem 0 .5rem;
color: #666;
Expand Down Expand Up @@ -125,12 +126,14 @@ body {
}

html.iframe {
.coc {
.coc,
.privacy {
font-size: 1.1rem;
padding-top: 1rem;
}

.coc input {
.coc input,
.privacy input {
position: relative;
top: -.2rem;
}
Expand Down
4 changes: 4 additions & 0 deletions scss/_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ html.theme-dark {
darken($foreground, 20),
// $color-coc-link:
darken($foreground, 20),
// $color-privacy:
darken($foreground, 20),
// $color-privacy-link:
darken($foreground, 20),
// $color-button-text:
$button-text,
// $color-button-background:
Expand Down
4 changes: 4 additions & 0 deletions scss/_light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ html.theme-light {
lighten($foreground, 40),
// $color-coc-link:
lighten($foreground, 40),
// $color-privacy:
lighten($foreground, 40),
// $color-privacy-link:
lighten($foreground, 40),
// $color-button-text:
$button-text,
// $color-button-background:
Expand Down
16 changes: 16 additions & 0 deletions scss/_mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
$color-signin-link,
$color-coc,
$color-coc-link,
$color-privacy,
$color-privacy-link,
$color-button-text,
$color-button-background,
$color-button-success-text,
Expand Down Expand Up @@ -53,6 +55,20 @@
}
}

// Privacy Policy:
.privacy {
color: $color-privacy;

a {
color: $color-privacy-link;

&:hover {
background-color: $color-privacy-link;
color: $color-background;
}
}
}

// Button:
button {
color: $color-button-text;
Expand Down
6 changes: 6 additions & 0 deletions views/main.pug
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ html(lang='en', class=`${large ? 'large' : ''}${iframe ? 'iframe' : ''} theme-${
input(type='checkbox', name='coc', value='1', required)
| I agree to the #[a(href=coc, rel='noopener', target='_blank') Code of Conduct].

if privacy
.privacy
label
input(type='checkbox', name='privacy', value='1', required)
| I agree to the #[a(href=privacy, rel='noopener', target='_blank') Privacy Policy].

button.loading Get my Invite

p.signin or #[a(href=`https://${org}.slack.com/`, target='_top') sign in].
Expand Down