Skip to content

Commit

Permalink
- Small bugfix with default value
Browse files Browse the repository at this point in the history
- Updated dependencies
  • Loading branch information
M. Peter committed Oct 27, 2016
1 parent 20924fe commit bfa9378
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ It's up to you to implement the DB read and Write methods and do the notificatio
## Release History
|Version|Date|Description|
|:--:|:--:|:--|
|0.2.1|2016-10-27|Small bugfix with default value (Thanks to [Anton Rau](https://github.com/plankter) for [#3](https://github.com/mpneuried/redis-notifications/issues/3)). Updated dependencies|
|0.2.0|2016-07-18|Updated dev env and dependencies|
|0.1.1|2015-01-30|Logo update|
|0.1.0|2015-01-30|Added docs and optimized code and API|
Expand Down
2 changes: 1 addition & 1 deletion _src/lib/schemas/message-content.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ module.exports = new ( class MessageContentSchema extends require( "obj-schema"
sanitize: true
striphtml: true
default: ( data, def )->
return utils.truncate( data.body, 100 )
return utils.truncate( data?.body or "", 100 )

, name: "messagecontent" ).validateCb
2 changes: 2 additions & 0 deletions _src/lib/utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ module.exports =
@return { String } the truncated string
###
truncate: ( str, len = 100, add = "...", tolerance = 5 )->
if not str?
return ""
if str.length > ( len * ( 1 + tolerance/100 ) )
return str.substr( 0, str.indexOf( " ", len ) ) + ( add or "" )
return str
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redis-notifications",
"version": "0.2.0",
"version": "0.2.1",
"description": "A redis based notification engine. It implements the rsmq-worker to savely create notifications and recurring reports",
"keywords": [],
"homepage": "https://github.com/mpneuried/redis-notifications",
Expand All @@ -27,14 +27,14 @@
"rsmq-worker": "0.5.x",
"lodash": "4.x",
"moment-timezone": "0.5.x",
"obj-schema": "1.1.x"
"obj-schema": "1.2.x"
},
"devDependencies": {
"should": "9.x",
"should": "11.x",
"grunt": "1.0.x",
"grunt-contrib-watch": "1.0.x",
"grunt-contrib-coffee": "1.x",
"grunt-include-replace": "4.x",
"grunt-include-replace": "5.x",
"grunt-mocha-cli": "2.x",
"grunt-contrib-clean": "1.x"
}
Expand Down

0 comments on commit bfa9378

Please sign in to comment.