Skip to content

Commit

Permalink
Updating with Daniel's review: plain-text transform was renamed, comm…
Browse files Browse the repository at this point in the history
…ent fixed, and improving the if statement to get the right room
  • Loading branch information
llvieira committed Oct 19, 2017
1 parent cb7752f commit 02fe2ae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
6 changes: 2 additions & 4 deletions src/listener/ov-listener.js
Expand Up @@ -62,14 +62,12 @@ export default function(robot, client) {

let checkedMessage = filter.check(resource);
if (typeof checkedMessage !== 'undefined' && checkedMessage.length > 0) {
let room = '';
let room = '#' + client.notificationsRoom;

if (robot.adapterName === 'flowdock') {
room = client.notificationsRoom;
} else {
room = '#' + client.notificationsRoom;
}

transform.messageRoom(room, resource.resource);
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/listener/server-hardware.js
Expand Up @@ -181,13 +181,13 @@ export default class ServerHardwareListener extends Listener {
this.client.ServerHardware.getHardwareByStatus(status).then((res) => {

if (res.members.length === 0) {
return this.transform.text(msg, msg.message.user.name + ", I didn't find any blades with a " + status.toLowerCase() + " status.");
return this.transform.text(msg, msg.message.user.name + ", I didn't find any blades with a " + status.toUpperCase() + " status.");
}
else {
if (status.toLowerCase() === "ok") {
return this.transform.send(msg, res, "Okay " + msg.message.user.name + ", the following blades have an " + status.toLowerCase() + " status.");
return this.transform.send(msg, res, "Okay " + msg.message.user.name + ", the following blades have an " + status.toUpperCase() + " status.");
} else {
return this.transform.send(msg, res, "Okay " + msg.message.user.name + ", the following blades have a " + status.toLowerCase() + " status.");
return this.transform.send(msg, res, "Okay " + msg.message.user.name + ", the following blades have a " + status.toUpperCase() + " status.");
}
}
}).catch((err) => {
Expand Down
2 changes: 1 addition & 1 deletion src/listener/utils/resource-transforms.js
Expand Up @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

import PlainTextTransform from './transforms/plain-text-transformer';
import PlainTextTransform from './transforms/plain-text';
import ShellTransform from './transforms/shell';
import SlackTransform from './transforms/slack';

Expand Down
Expand Up @@ -77,9 +77,7 @@ function output(resource) {
return [];
}

/**
* PlainTextTransform it's a commom transformer to HipChat and Flowdock.
*/
// PlainTextTransform it's a common transformer to HipChat and Flowdock.
export default class PlainTextTransform {
hyperlink(uri, name) {
return name ? name : uri;
Expand Down
4 changes: 1 addition & 3 deletions src/oneview.js
Expand Up @@ -55,12 +55,10 @@ const main = (robot) => {
client.ServerProfiles.getAllServerProfiles().then((sp) => {
client.ServerProfileTemplates.getAllServerProfileTemplates()
.then((spt) => {
let room = '';
let room = '#' + client.notificationsRoom;

if (robot.adapterName === 'flowdock') {
room = client.notificationsRoom;
} else {
room = '#' + client.notificationsRoom;
}

robot.messageRoom(room,
Expand Down

0 comments on commit 02fe2ae

Please sign in to comment.