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

Revert "Fix broken private messages, and increase code coverage" #60

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@
"grunt-release": "^0.14.0",
"hubot": "^3.0.0",
"hubot-mock-adapter-v3": "^1.0.0",
"hubot-test-helper": "^1.8.1",
"matchdep": "^0.1.2",
"mocha": "^3.0.2",
"nyc": "^11.0.3",
"semantic-release": "^6.3.6",
"sinon": "^1.4.2",
"sinon-chai": "^2.8.0",
"standard": "^10.0.2"
"standard": "^10.0.2",
"semantic-release": "^6.3.6"
},
"main": "index.coffee",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions src/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const helpContents = (name, commands) => `\
`

module.exports = (robot) => {
const replyInPrivate = process.env.HUBOT_HELP_REPLY_IN_PRIVATE

robot.respond(/help(?:\s+(.*))?$/i, (msg) => {
let cmds = getHelpCommands(robot)
const filter = msg.match[1]
Expand All @@ -72,9 +74,9 @@ module.exports = (robot) => {

const emit = cmds.join('\n')

if (process.env.HUBOT_HELP_REPLY_IN_PRIVATE && msg.message && msg.message.user && msg.message.user.name && msg.message.user.name !== msg.message.room) {
msg.reply('I just replied to you in private.')
return msg.sendPrivate(emit)
if (replyInPrivate && msg.message && msg.message.user && msg.message.user.name && msg.message.user.name !== msg.message.room) {
msg.reply('replied to you in private!')
return robot.send({ room: msg.message.user.name }, emit)
Copy link

Choose a reason for hiding this comment

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

This should be msg.message.user.id not name.

} else {
return msg.send(emit)
}
Expand Down
58 changes: 0 additions & 58 deletions test/help_message_visibility_test.js

This file was deleted.