diff --git a/app.js b/app.js index 281200b..709e51b 100644 --- a/app.js +++ b/app.js @@ -12,10 +12,9 @@ const path = require('path'); const session = require("express-session"); const MongoStore = require('connect-mongo')(session); const flash = require("connect-flash"); -const axios = require('axios'); mongoose - .connect(process.env.MONGODB_URI || 'mongodb://localhost/project2', {useNewUrlParser: true}) + .connect(process.env.MONGO_URI || 'mongodb://localhost/project2', {useNewUrlParser: true}) .then(x => { console.log(`Connected to Mongo! Database name: "${x.connections[0].name}"`) }) @@ -69,21 +68,18 @@ hbs.registerHelper('ifUndefined', (value, options) => { } }); - // default value for title local app.locals.title = 'Express - Generated with IronGenerator'; - // Enable authentication using session + passport app.use(session({ - secret: 'irongenerator', + secret: process.env.SESSION_SECRET, resave: true, saveUninitialized: true, store: new MongoStore( { mongooseConnection: mongoose.connection }) })) app.use(flash()); require('./passport')(app); - app.use('/', require('./routes/index')); app.use('/', require('./routes/homepages')); diff --git a/bin/seeds.js b/bin/seeds.js index 77aafa1..ecf9b5e 100644 --- a/bin/seeds.js +++ b/bin/seeds.js @@ -57,7 +57,7 @@ let sources = [ category: "general", language: "en", country: "gb", - reputation: 4.3, + reputation: 231, comments: [], profileImg: `https://liquidcinemavr.com/wp-content/uploads/2019/03/bbc-logo.jpg`, politicalBias: "The BBC has historically been a centre-right organisation. It's a publically funded, urban organisation with a higher proportion of young people and ethnic minorities. Therefore it tends to hold a liberal bias and, whilst it aligns with the Liberal Party ideals, it also closely allies with the Tories. Writers can often flex their own political opinions and agendas so it's best to be aware.", @@ -76,7 +76,7 @@ let sources = [ category: "general", language: "en", country: "us", - reputation: 4.2, + reputation: 97, comments: [], profileImg: `https://s.abcnews.com/assets/beta/assets/abcn_images/abcnews_pearl_stacked.png`, politicalBias: "ABC is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, ABC holds a centre left swing with a left leaning and liberal view on many convtroversial topics. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", @@ -93,7 +93,7 @@ let sources = [ category: "business", language: "en", country: "us", - reputation: 4.1, + reputation: 211, comments: [], profileImg: `https://amp.businessinsider.com/images/597a0306b50ab126008b4b46-750-342.png`, politicalBias: 'Business Insider is a privately held corporation and, as such, is more susceptible to the political leanings of it\'s leaders. Therefore readers should be aware that the company owners, Brian Anthony and Chris Gunning, are staunchly left-wing and liberal thinkers. This can be conveyed through the leanings of the content that is present in both the print and online editions of Business Insider.', @@ -110,7 +110,7 @@ let sources = [ category: "general", language: "en", country: "us", - reputation: 4.2, + reputation: 56, comments: [], profileImg: `https://www.nlgja.org/wp-content/uploads/2018/01/Reuters-logo-square-2017.png`, politicalBias: "Reuters is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, Reuters holds a centre political stance with a left leaning and liberal view on many convtroversial topics. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", @@ -127,7 +127,7 @@ let sources = [ category: "general", language: "en", country: "us", - reputation: 4.2, + reputation: 52, comments: [], profileImg: `https://upload.wikimedia.org/wikipedia/commons/b/b1/CNN.svg`, politicalBias: "CNN is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, CNN holds a right of centre political stance. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", @@ -138,12 +138,12 @@ let sources = [ { id: "cnbc", name: "CNBC", - description: "CNBC, the Cable News Network, is one of the most prominent names in the American national broadcasting sphere relating to the stock market and is known around the global. CNBC is owned by NBC Universal Broadcast which is in turn owned by Comcast.", - url: "www.cnn.com", + description: "CNBC, the Cable News Network, is one of the most prominent names in the American national broadcasting sphere relating to the stock market and is known around the global. CNBC is owned by NBC Universal Broadcast which is in turn owned by Comcast. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel quam ac odio auctor laoreet sit amet in orci. Duis accumsan sed elit sed dictum. Curabitur convallis semper sapien nec iaculis. ", + url: "www.cnbc.com", category: "general", language: "en", country: "us", - reputation: 4.2, + reputation: 112, comments: [], profileImg: `https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/CNBC_logo.svg/701px-CNBC_logo.svg.png`, politicalBias: "CNN is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, CNN holds a right of centre political stance. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", @@ -151,7 +151,71 @@ let sources = [ 'Advertising Revenue: $89 million - Source: CNN Income Report 2018', 'Cable Company Subscriptions: $75 million - Source: CNN Income Report 2018' ]}, - + { + id: "fox-news", + name: "Fox News", + description: "Fox News is one of the most prominent names in the American national broadcasting sphere relating to the stock market and is known around the global. Fox News is owned by NBC Universal Broadcast which is in turn owned by Comcast. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel quam ac odio auctor laoreet sit amet in orci. Duis accumsan sed elit sed dictum. Curabitur convallis semper sapien nec iaculis. ", + url: "www.fox-news.com", + category: "general", + language: "en", + country: "us", + reputation: 174, + comments: [], + profileImg: `https://upload.wikimedia.org/wikipedia/commons/6/67/Fox_News_Channel_logo.svg`, + politicalBias: "Fox News is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, Fox News holds a right of centre political stance. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", + fundingSources: [ + 'Advertising Revenue: $89 million - Source: Fox News Income Report 2018', + 'Cable Company Subscriptions: $75 million - Source: Fox News Income Report 2018' + ]}, + { + id: "usa-today", + name: "USA Today", + description: "USA Today is one of the most prominent names in the American national broadcasting sphere relating to the stock market and is known around the global. USA Today is owned by NBC Universal Broadcast which is in turn owned by Comcast. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel quam ac odio auctor laoreet sit amet in orci. Duis accumsan sed elit sed dictum. Curabitur convallis semper sapien nec iaculis. ", + url: "www.usatoday.com", + category: "general", + language: "en", + country: "us", + reputation: 174, + comments: [], + profileImg: `https://www.american.edu/uploads/standard/large/01_Primary_01_FullColor_USATODAY_Logo_Prm_FullClr_RGB_600copy.png`, + politicalBias: "USA Today is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, USA Today holds a right of centre political stance. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", + fundingSources: [ + 'Advertising Revenue: $89 million - Source: USA Today Income Report 2018', + 'Cable Company Subscriptions: $75 million - Source: USA Today Income Report 2018' + ]}, + { + id: "nbc-news", + name: "NBC News", + description: "NBC News is one of the most prominent names in the American national broadcasting sphere relating to the stock market and is known around the global. NBC News is owned by NBC Universal Broadcast which is in turn owned by Comcast. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel quam ac odio auctor laoreet sit amet in orci. Duis accumsan sed elit sed dictum. Curabitur convallis semper sapien nec iaculis. ", + url: "www.nbc-news.com", + category: "general", + language: "en", + country: "us", + reputation: 174, + comments: [], + profileImg: `https://i0.wp.com/www.icingsmiles.org/wp-content/uploads/2015/09/NBC-Logo.png?ssl=1`, + politicalBias: "NBC News is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, NBC News holds a right of centre political stance. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", + fundingSources: [ + 'Advertising Revenue: $89 million - Source: NBC News Income Report 2018', + 'Cable Company Subscriptions: $75 million - Source: NBC News Income Report 2018' + ]}, + { + id: "politico", + name: "Politico", + description: "Politico is one of the most prominent names in the American national broadcasting sphere relating to the stock market and is known around the global. Politico is owned by NBC Universal Broadcast which is in turn owned by Comcast. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel quam ac odio auctor laoreet sit amet in orci. Duis accumsan sed elit sed dictum. Curabitur convallis semper sapien nec iaculis. ", + url: "www.politico.com", + category: "general", + language: "en", + country: "us", + reputation: 174, + comments: [], + profileImg: `https://pmcvariety.files.wordpress.com/2016/05/politico-logo.jpg?w=913&h=513&crop=1`, + politicalBias: "Politico is one of America's leading media corporations and, as such, is suspecible to the ever pervading influence, and push and pull, of mainstream American politics. Traditionally, Politico holds a right of centre political stance. The broadcasting network's host of hosts and representatives deliberately reinforces this left leaning political stance to appease the viewing audience.", + fundingSources: [ + 'Advertising Revenue: $89 million - Source: Politico Income Report 2018', + 'Cable Company Subscriptions: $75 million - Source: Politico Income Report 2018' + ]} + ]; User.deleteMany() @@ -190,6 +254,7 @@ const seedAPI = () => { .then(data => console.log(data.length)).catch(err=>console.log(err)); }) .then(() => { + console.log('sources successfully added') // Close properly the connection to Mongoose // mongoose.disconnect() }) @@ -199,7 +264,10 @@ const seedAPI = () => { }); } -seedAPI(); +seedAPI() +setTimeout(() => { + mongoose.disconnect() +}, 5000) module.exports; diff --git a/bin/www b/bin/www index 127267d..161a0cb 100644 --- a/bin/www +++ b/bin/www @@ -41,6 +41,8 @@ server.on('error', error => { } }); -server.listen(process.env.PORT || 'https://opinion-news.herokuapp.com/', () => { +server.listen(process.env.PORT + // || 'https://opinion-news.herokuapp.com/' + , () => { console.log(`Listening on http://localhost:${process.env.PORT}`); }); diff --git a/package-lock.json b/package-lock.json index 713c18a..37a2af9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -224,19 +224,11 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, "axios": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", - "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.1.tgz", + "integrity": "sha512-Yl+7nfreYKaLRvAvjNPkvfjnQHJM1yLBY3zhqAwcJSwR/6ETkanUgylgtIvkvz0xJ+p/vZuNw8X7Hnb7Whsbpw==", "requires": { - "follow-redirects": "1.5.10", - "is-buffer": "^2.0.2" - }, - "dependencies": { - "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" - } + "follow-redirects": "1.5.10" } }, "balanced-match": { diff --git a/package.json b/package.json index 00833c4..bbee31e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev-windows": "nodemon ./bin/www" }, "dependencies": { - "axios": "^0.19.0", + "axios": "^0.19.1", "bcrypt": "^3.0.0", "body-parser": "^1.18.3", "connect-ensure-login": "^0.1.1", diff --git a/passport/facebookStrategy.js b/passport/facebookStrategy.js index 9d98884..2e3f221 100644 --- a/passport/facebookStrategy.js +++ b/passport/facebookStrategy.js @@ -2,24 +2,23 @@ const FacebookStrategy = require("passport-facebook").Strategy; const passport = require('passport'); const User = require('../models/User'); -// passport.use(new FacebookStrategy({ -// clientID: process.env.FACEBOOK_USER_ID, -// clientSecret: process.env.FACEBOOK_KEY, -// callbackURL: 'https://opinion-news.herokuapp.com/auth/facebook/callback' -// // "http://localhost:3000/auth/facebook/callback" -// }, -// function(accessToken, refreshToken, profile, cb) { -// User.findOne({ facebookId: profile.id }).then(user => { -// if (user) return cb(null, user); -// console.log('FB user: ' + user) -// return User.create({ -// facebookId: profile.id, -// fullName: profile.displayName -// }).then(newUser => { -// return cb(null, newUser); -// }); -// }).catch(err => { -// cb(err); -// }); -// } -// )); \ No newline at end of file +passport.use(new FacebookStrategy({ + clientID: process.env.FACEBOOK_USER_ID, + clientSecret: process.env.FACEBOOK_KEY, + callbackURL: "http://opinion-news.herokuapp.com/auth/facebook/callback" + }, + function(accessToken, refreshToken, profile, cb) { + User.findOne({ facebookId: profile.id }).then(user => { + if (user) return cb(null, user); + console.log('FB user: ' + user) + return User.create({ + facebookId: profile.id, + fullName: profile.displayName + }).then(newUser => { + return cb(null, newUser); + }); + }).catch(err => { + cb(err); + }); + } +)); diff --git a/passport/githubStrategy.js b/passport/githubStrategy.js index 603d3bf..e469227 100644 --- a/passport/githubStrategy.js +++ b/passport/githubStrategy.js @@ -5,13 +5,11 @@ const User = require('../models/User'); passport.use(new GitHubStrategy({ clientID: process.env.GITHUB_CLIENT_ID, clientSecret: process.env.GITHUB_CLIENT_SECRET, - callbackURL: 'https://opinion-news.herokuapp.com/auth/github/callback' - // "http://localhost:3000/auth/github/callback" + callbackURL: "http://opinion-news.herokuapp.com/auth/github/callback" }, function(accessToken, refreshToken, profile, cb) { User.findOne({ githubId: profile.id }) .then(user => { - console.log(profile); if (user) return cb(null, user); return User.create( { diff --git a/passport/googleStrategy.js b/passport/googleStrategy.js index 09d5073..b047f5e 100644 --- a/passport/googleStrategy.js +++ b/passport/googleStrategy.js @@ -5,7 +5,7 @@ const User = require('../models/User'); passport.use(new GoogleStrategy({ clientID: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET, - callbackURL: "http://localhost:3000/auth/google/callback" + callbackURL: "http://opinion-news.herokuapp.com/auth/google/callback"//http://localhost:3000 }, function(accessToken, refreshToken, profile, cb) { User.findOne({ googleId: profile.id }) @@ -25,23 +25,3 @@ function(accessToken, refreshToken, profile, cb) { }); } )); - -//Google profile examp: - -// { id: '112678934251205388903', -// displayName: 'Stefan Culafic', -// name: { familyName: 'Culafic', givenName: 'Stefan' }, -// photos: -// [ { value: -// 'https://lh3.googleusercontent.com/-vN2r6OL7IHg/AAAAAAAAAAI/AAAAAAAAHcs/e27OZ_SW810/photo.jpg' } ], -// provider: 'google', -// _raw: -// '{\n "sub": "112678934251205388903",\n "name": "Stefan Culafic",\n "given_name": "Stefan",\n "family_name": "Culafic",\n "picture": "https://lh3.googleusercontent.com/-vN2r6OL7IHg/AAAAAAAAAAI/AAAAAAAAHcs/e27OZ_SW810/photo.jpg",\n "locale": "en"\n}', -// _json: -// { sub: '112678934251205388903', -// name: 'Stefan Culafic', -// given_name: 'Stefan', -// family_name: 'Culafic', -// picture: -// 'https://lh3.googleusercontent.com/-vN2r6OL7IHg/AAAAAAAAAAI/AAAAAAAAHcs/e27OZ_SW810/photo.jpg', -// locale: 'en' } } \ No newline at end of file diff --git a/public/images/favicon.ico b/public/images/favicon.ico index 99e29b9..9e72cce 100644 Binary files a/public/images/favicon.ico and b/public/images/favicon.ico differ diff --git a/public/javascripts/script.js b/public/javascripts/script.js index a8592d2..683ad13 100644 --- a/public/javascripts/script.js +++ b/public/javascripts/script.js @@ -44,6 +44,7 @@ const newComment = (data) => { let descriptionUser = document.createElement('p'); descriptionUser.innerHTML = data.data.data.content; let ratingUser = document.createElement('p'); + ratingUser.classList = data.data.user[0].username; ratingUser.innerHTML = `Rating: ${data.data.data.rating || 0}`; let likeButton = document.createElement('button'); likeButton.innerHTML = 'Like'; @@ -74,11 +75,15 @@ if(commentBox != undefined){ commentBox.addEventListener('click', (e)=>{ if(e.target.className == 'like-button'){ let username = e.target.parentNode.getElementsByTagName('h3')[0].innerHTML; + let ratingElement = e.target.parentNode.getElementsByTagName('p')[1]; let commentId = e.target.value; axios.patch(`${baseUrl}/comment`, {data: username, commentId: commentId}).then(data => { - document.getElementById('comment-rating').innerHTML = `Rating: ${data.data.rating}`; - if(data.data.liked)e.target.innerHTML="unlike"; - else{e.target.innerHTML="like"} + // document.getElementsByClassName('username').forEach(element => { + // element.innerHTML = `Rating: ${data.data.rating}`; + // }); + ratingElement.innerHTML = `Rating: ${data.data.rating}`; + if(data.data.liked)e.target.innerHTML="Unlike"; + else{e.target.innerHTML="Like"} }) } }); diff --git a/routes/homepages.js b/routes/homepages.js index 3e7c733..787408d 100644 --- a/routes/homepages.js +++ b/routes/homepages.js @@ -9,15 +9,23 @@ router.get('/homepages/sources', (req, res) => { }).catch(err => console.log(err)); }) - router.get('/article/:articleId', (req, res, next) => { + let liked = false; + Article.findOne({'_id': req.params.articleId }).populate({ path: 'comments', populate: {path: 'author'}}).then(article =>{ - let liked = false; - if(req.user != undefined)if(article.ratings.indexOf(req.user._id) !== -1)liked=true; + if(req.user != undefined){ + if(article.ratings.indexOf(req.user._id) !== -1)liked=true; + } article.title = article.title.substring(0, article.title.lastIndexOf('-')); article.publishDate = article.publishedAt.toDateString(); Source.findOne({ 'id': article.source.id }).then(source => { + if(req.user != undefined) { + article.comments.forEach(element => { + element.liked = element.ratings.includes(req.user._id); + element.user = req.user._id; + }); + } res.render('homepages/article', {article, source, user: req.user, liked}); }) }).catch(err=>console.log(err)); diff --git a/routes/index.js b/routes/index.js index 77072c9..e1b98a4 100644 --- a/routes/index.js +++ b/routes/index.js @@ -5,6 +5,7 @@ const Article = require('../models/Article'); /* GET home page */ router.get('/', (req, res, next) => { Article.find({}).then(data =>{ + data.forEach(el => { el.title = el.title.substring(0, el.title.lastIndexOf('-')) el.publishDate = el.publishedAt.toDateString() @@ -14,8 +15,8 @@ router.get('/', (req, res, next) => { }).catch(err=>console.log(err)); }); - router.get('/welcome', (req, res) => { - res.render('homepage') + router.get('/about', (req, res) => { + res.render('about') }) diff --git a/routes/protected.js b/routes/protected.js index e59e89c..abea447 100644 --- a/routes/protected.js +++ b/routes/protected.js @@ -25,29 +25,13 @@ const loginCheck = () => { }; router.use(loginCheck()); -try{ -router.patch('/comment', async (req, res, next)=>{ - let userId = req.session.passport.user; - const doc = await Comment.findOne({'_id': req.body.commentId}); - console.log(doc.toObject().ratings) - if(doc.toObject().ratings.indexOf(userId) === -1){ - doc.toObject().ratings.push(userId); - doc.toObject().rating++; - }else{ - doc.toObject().ratings.pull(mongoose.Types.ObjectId(userId)); - doc.toObject().rating--; - } - doc.save(doc).then(data => {res.send({rating: data.rating, liked: data.toObject().ratings.includes(req.session.passport.user)}); - }) - }); -}catch(err){console.log(err)} - //use /\w+/ regex match here router.patch('/article', (req, res, next)=>{ let articleId = req.headers.referer.match(/[^\/]\w*$/)[0]; let userId = req.session.passport.user; Article.findOne({'_id': articleId}, (err, doc)=>{ if(err)console.log(err); + if(doc.ratings === null)doc.ratings=[]; if(doc.ratings.indexOf(userId) === -1) { doc.ratings.push(userId); @@ -67,7 +51,6 @@ router.patch('/article', (req, res, next)=>{ doc.reputation--; } doc.save(doc).then(cont => { - console.log(data.ratings.includes(req.session.passport.user), req.session.passport.user) res.send({rating: cont.reputation, liked: data.ratings.includes(req.session.passport.user)}); }) if(err)console.log(err); @@ -101,5 +84,31 @@ router.post('/comment', (req, res, next) => { err =>console.log(err)); }); -module.exports = router; +router.patch('/comment', async (req, res, next)=>{ + const userId = req.session.passport.user; + Comment.findOne({'_id': req.body.commentId}, (err, doc)=> { + let docObject = doc._doc; + let incdec; + if(docObject.ratings === undefined) {docObject.ratings = []; docObject.rating = 0} + if(docObject.ratings.indexOf(userId) === -1){ + docObject.ratings.push(userId); + incdec=1; + }else{ + docObject.ratings.pull(mongoose.Types.ObjectId(userId)); + incdec=-1; + } + User.findByIdAndUpdate(docObject.author, { + $inc: {reputation: incdec} + },{ new: true }).then(data => console.log(data)) + Comment.findByIdAndUpdate(docObject._id, { + ratings: docObject.ratings, + rating: docObject.rating + incdec + }, { new: true }).then(data => { + res.send({ + rating: data.rating, liked: docObject.ratings.includes(req.session.passport.user) + }); + }) + }).catch(err => console.log(err)); +}); +module.exports = router; diff --git a/views/homepage.hbs b/views/about.hbs similarity index 100% rename from views/homepage.hbs rename to views/about.hbs diff --git a/views/homepages/article.hbs b/views/homepages/article.hbs index 9a74a40..2c66b4e 100644 --- a/views/homepages/article.hbs +++ b/views/homepages/article.hbs @@ -20,7 +20,7 @@

About this source...

{{#if user}} - Edit + Edit {{else}} Login to edit {{/if}} @@ -58,6 +58,7 @@ > {{else}}

Login here to join the discussion.

+ {{/if}} {{#each article.comments}}
@@ -66,12 +67,12 @@

{{this.author.username}}

{{this.content}}

Rating: {{this.rating}}

- {{#if user}} - + {{#if this.user}} + {{/if}}
{{/each}} - \ No newline at end of file + diff --git a/views/layout.hbs b/views/layout.hbs index b6373fa..e037afe 100644 --- a/views/layout.hbs +++ b/views/layout.hbs @@ -20,6 +20,7 @@ ×
Home + About All Sources {{#if user}} Profile @@ -30,12 +31,12 @@ {{/if}} - {{!--
+ --}} +
diff --git a/views/profile/editUser.hbs b/views/profile/editUser.hbs index 9a56308..8d55636 100644 --- a/views/profile/editUser.hbs +++ b/views/profile/editUser.hbs @@ -35,18 +35,12 @@ - +

Recent Comments

{{#each userComments}} - {{this}} + {{this}} {{/each}} -
- -
-

Venezuela opposition to resume Norway-backed talks

-

Rating: 3.4

-
-
+

No recent comments

diff --git a/views/profile/source.hbs b/views/profile/source.hbs index 23c11ea..5c67337 100644 --- a/views/profile/source.hbs +++ b/views/profile/source.hbs @@ -6,7 +6,7 @@

{{data.name}}

-

Rating: 4.8

+

Rating: {{data.reputation}}

{{data.url}} {{#if user}} Edit profile diff --git a/views/profile/user.hbs b/views/profile/user.hbs index 33d3997..724d76f 100644 --- a/views/profile/user.hbs +++ b/views/profile/user.hbs @@ -30,16 +30,11 @@

Recent Comments

{{#each userComments}} - {{this}} + {{this}} {{/each}} -
- -
-

Venezuela opposition to resume Norway-backed talks

-

Rating: 3.4

+

No recent comments

-