Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Changes to the working post branch #53

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

james-logan
Copy link
Member

No description provided.

@sscotth
Copy link
Contributor

sscotth commented Aug 25, 2015

Horrible Pull Request title btw

@james-logan james-logan changed the title monday morning, tests failing Changes to the working post branch Aug 25, 2015
@james-logan
Copy link
Member Author

@ScottH this should be ready to merge as well

@@ -21,3 +21,8 @@ module.exports.show = function (req, res) {
res.render('post/show', {post: post});
});
};

module.exports.parse = function (req, res, next) {
req.body.text = Post.parse(req.body.text);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this is correct as req.body.text becomes an object here?

@sscotth
Copy link
Contributor

sscotth commented Aug 25, 2015

Pull the lastest changes from master and you should see a failing test

…ongo now has a content key with an object that contains text
… submitting it to the database, and added tests for the constructor
@james-logan
Copy link
Member Author

@sscotth updates have been made to Post.create and passing tests were added

@james-logan james-logan reopened this Aug 25, 2015

Post.validate = function (post) {
var postArray = post.trim().split(' ');
if (postArray[0] === ''){
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use different variable names here.
Try:

var words = post.trim().split(' ');
var firstWord = words[0];
var secondWord = words[0];

@sscotth
Copy link
Contributor

sscotth commented Aug 26, 2015

I think you should consider making validation your middleware and not mangling the post text into an array. Simply validate and pass to ctrl.create.

Run your parse function during the new Post() construction;

Let me know if you are unsure what I mean.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants