Skip to content

Commit

Permalink
Merge pull request #31 from EPICmynamesBG/feature/30_feedback
Browse files Browse the repository at this point in the history
Feature/30 feedback
  • Loading branch information
EPICmynamesBG committed Dec 27, 2017
2 parents d568a39 + a837f62 commit ceebaba
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 22 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules/*
coverage/
bower_components/*
LICENSE
PRIVACY
43 changes: 43 additions & 0 deletions PRIVACY
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
PRIVACY POLICY

SCOPE OF THIS PRIVACY STATEMENT
Being an open-source project, while user
security is a primary focus in development, the actual hosting
done by other users cannot be guaranteed. For all intensive purposes,
this document only ensures accuracy and coverage for the Slack store
submission of Subito bot hosted at dev.brandongroff.com.

THE PERSONAL INFORMATION WE COLLECT
Subito bot collects as little personal information as possible. When the
app is connected to a Slack team, the following info is stored:
- Slack Team Id
- Slack Team Name
- the Installer's Slack User Id
- Slack Team Domain
- a Slack Access Token (encrypted)
- a Slack Bot Token (encrypted)

When a user subscribes to notifications from Subito bot, the following
information is stored:
- the user's Slack Team Id
- the user's Slack Id
- the user's Team Username

HOW WE USE YOUR PERSONAL INFORMATION
Subito bot uses the above information for application use cases only. No outside
access or access should ever be granted.

HOW WE SHARE YOUR PERSONAL INFORMATION
Your Slack info is not shared and never will be.

SECURITY
For the security of all users, Subito bot hosting takes advantage of https encryption.
Server access is limited to only one user, and necessary security provisions are in place
to prevent unauthorized user access, both on a server and database level.

CHANGES TO THIS PRIVACY STATEMENT
This document may be updated at any time.

HOW TO CONTACT US
All feedback should be submitted as an Issue on GitHub at
https://github.com/EPICmynamesBG/subito-bot/issues.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,9 @@ Migrations can be ran via `npm run migrate-up:[local | test]`. This command will
## License

[GNU General Public License v3.0](http://www.gnu.org/licenses/gpl-3.0.txt)

## Privacy

<a href="https://github.com/EPICmynamesBG/subito-bot/blob/master/PRIVACY">Privacy Policy</a>

_Disclaimer: This privacy policy is only guaranteed for the instance of Subito hosted at dev.brandongroff.com_
4 changes: 4 additions & 0 deletions api/controllers/slackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function handleSlack(req, res) {
lodash.set(req, 'swagger.params.day.value', action.params.day);
soupCalendarController.getSoupsForDay(req, res);
break;
case 'feedback':
utils.processResponse(null,
{ text: 'Submit feedback <https://github.com/EPICmynamesBG/subito-bot/issues|here>!' }, res);
break;
default: {
logger.warn('Unsupported command', action.command);
let message = "Whoops, I don't recognize that command. Try one of these instead!";
Expand Down
34 changes: 17 additions & 17 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

require('dotenv').config({ silent: true });

const config = {
const config = {
DATABASE_HOST: process.env.DATABASE_HOST || 'localhost',

DATABASE_USER: process.env.DATABASE_USER || '',

DATABASE_PASSWORD: process.env.DATABASE_PASSWORD || '',

DATABASE_NAME: process.env.DATABASE_NAME || '',

PORT: process.env.PORT || 10010,

USE_SSL: false,

TEST_DATABASE_HOST: process.env.TEST_DATABASE_HOST || 'localhost', // TODO: Deprecated?

TEST_DATABASE_USER: process.env.TEST_DATABASE_USER || '', // TODO: Deprecated?
Expand All @@ -30,37 +30,37 @@ const config = {
SLACK_API_TOKEN: process.env.SLACK_API_TOKEN || '', // TODO: Deprecated?

SLACK_NOTIFY_ERROR_USER : process.env.SLACK_NOTIFY_ERROR_USER, // TODO: Deprecated?

SLACK_CLIENT_ID: process.env.SLACK_CLIENT_ID,

SLACK_CLIENT_SECRET: process.env.SLACK_CLIENT_SECRET,

SLACK_VERIFICATION_TOKEN: process.env.SLACK_VERIFICATION_TOKEN,

SLACK_REDIRECT_URI: process.env.SLACK_REDIRECT_URI,

ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,

ADMIN_AUTH_SECRET: process.env.ADMIN_AUTH_SECRET, // TODO: deprecate

NODE_ENV: process.env.NODE_ENV || 'development',

LOGGING_LEVEL: process.env.LOGGING_LEVEL || 'debug',

LOG_DIR: './logs',

SWAGGER: {
APP_VERSION: '6.0.0',

APP_VERSION: '6.1.0',

HOSTNAME: process.env.HOST || 'localhost',

PORT: process.env.PORT || 10010,

BASEPATH: '/subito',

SCHEMAS: ['http']

}
};

Expand Down
10 changes: 6 additions & 4 deletions config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ const lodash = require('lodash');

module.exports = {
SLACK_CONSTS: {
SUPPORTED_COMMANDS: lodash.clone(['day', 'search', 'subscribe', 'unsubscribe']),
SUPPORTED_COMMANDS: lodash.clone(['day', 'search', 'subscribe', 'unsubscribe', 'feedback']),

CMD_USAGE: {
day: '[today | tomorrow | yesterday | [YYYY-MM-DD]]',
search: '[soup name/type (example: gouda | gf)]',
subscribe: '[search (example: corn)]',
unsubscribe: ''
unsubscribe: '',
feedback: '<https://github.com/EPICmynamesBG/subito-bot/issues|Submit feedback on GitHub>'
},

CMD_PARAM_MAP: lodash.cloneDeep({
day: ['day'],
search: ['search'],
subscribe: ['search'],
unsubscribe: []
unsubscribe: [],
feedback: []
}),

CMD_TEMPLATE: lodash.cloneDeep({
Expand Down
2 changes: 1 addition & 1 deletion config/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {

SWAGGER: {

APP_VERSION: '6.0.0',
APP_VERSION: '6.1.0',

HOSTNAME: process.env.HOST || 'localhost',

Expand Down
21 changes: 21 additions & 0 deletions test/api/controllers/slackControllerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,27 @@ describe('slackController', () => {
});
});

it('should 200 and return text for "feedback"', (done) => {
request(server)
.post(url)
.type('form')
.send({
token: validAuth.token,
text: 'feedback',
user_id: 'ABC123',
user_name: 'testuser',
team_id: validAuth.team_id
})
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.end((err, res) => {
should.not.exist(err);
assert(res.body.text.includes("Submit"));
done();
});
});

it('should 200 and return a usage description when given an unknown command', (done) => {
request(server)
.post(url)
Expand Down
8 changes: 8 additions & 0 deletions test/api/helpers/slackTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ describe('slack helper', () => {
assert.deepEqual(output, expected);
});

it('should support "feedback" command', () => {
const text = 'feedback';
const output = slack.utils.parseRequestCommand(text);
const expected = lodash.cloneDeep(SLACK_CONSTS.CMD_TEMPLATE);
expected.command = 'feedback';
assert.deepEqual(output, expected);
});

it('should return command with params.unknown when unsupported', () => {
const text = 'hello bob barker';
const output = slack.utils.parseRequestCommand(text);
Expand Down

0 comments on commit ceebaba

Please sign in to comment.