Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pipakin committed Feb 24, 2017
1 parent e260b47 commit 6eb916e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ jspm_packages

public/bundle.js
lib
*.tgz
2 changes: 1 addition & 1 deletion src/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class CourtbotConversation extends EventEmitter {
.then(() => this.registrationSource.updateRegistrationState(conversation.registration_id, registrationState.UNSUBSCRIBED));
}
else {
return this.emitReply(messaging.badMessage(text, messaging.askReminder(from, conversation, conversation.party)))
return this.emitReply(messaging.badMessage(text, messaging.askReminder(from, conversation, {name: conversation.name})))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "messaging-en";
import "./messaging-en";

export { setRegistrationSource } from "./sources";
export { default as registrationState } from "./registrationState";
Expand Down
6 changes: 3 additions & 3 deletions src/messaging-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ evt.message = `Reminder: It appears you have an event on ${evt.evt.date}
description: ${evt.evt.description}. You should confirm your case date and time by going to ${process.env.COURT_PUBLIC_URL}. - ${process.env.COURTBOT_TITLE}`);

emitter.on("courtbot-messaging-ask-reminder", evt =>
evt.message = `We found a case for ${evt.party}. Would you like a courtesy reminder the day before any events? (reply YES or NO)`);
evt.message = `We found a case for ${evt.party.name}. Would you like a courtesy reminder the day before any events? (reply YES or NO)`);

emitter.on("courtbot-messaging-ask-party", evt =>
evt.message = `We found a case for multiple parties, please specify which party you are by entering the number shown:
${evt.parties.map((p, i) => `${i} - ${p}
`)}`);
${evt.parties.map((p, i) => `${i + 1} - ${p.name}
`).join("")}`);

emitter.on("courtbot-messaging-expired-registration", evt =>
evt.message = `We haven't been able to find your court case. You can go to ${process.env.process.env.COURT_PUBLIC_URL} for more information. - ${process.env.COURTBOT_TITLE}`);
Expand Down
4 changes: 2 additions & 2 deletions src/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export function askReminder(phone, registration, party) {
export function noCaseMessage(caseNumber) {
const evt = {caseNumber, message: noMessage};
emitter.emit("courtbot-messaging-no-case-message", evt);
return evt;
return evt.message;
}

export function askParty(phone, registration, parties) {
const evt = {phone, registration, parties, message: noMessage};
emitter.emit("courtbot-messaging-ask-party", evt);
return evt;
return evt.message;
}

export function expiredRegistration() {
Expand Down

0 comments on commit 6eb916e

Please sign in to comment.