Skip to content

Commit

Permalink
0.8.4 Bump. Поправлен пересчет статистики пользователя
Browse files Browse the repository at this point in the history
  • Loading branch information
klimashkin committed Jul 26, 2013
1 parent ed58d38 commit 9481cef
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions controllers/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,19 +537,19 @@ function givePhotosForApprove(socket, data, cb) {

//Отдаем галерею пользователя в компактном виде
function giveUserPhotos(socket, data, cb) {
var user = socket.handshake.session.user;
User.collection.findOne({login: data.login}, {_id: 1, pfcount: 1}, function (err, user) {
var iAm = socket.handshake.session.user;
User.collection.findOne({login: data.login}, {_id: 1}, function (err, user) {
if (err || !user) {
return cb({message: err && err.message || 'Such user does not exist', error: true});
}
var query = {user: user._id},
noPublic = user && (user.role > 4 || user._id.equals(user._id)),
noPublic = iAm && (iAm.role > 4 || user._id.equals(iAm._id)),
photosFresh,
skip = data.skip || 0,
limit = Math.min(data.limit || 20, 100);

if (noPublic) {
findPhotosAll(query, compactFields, {sort: {stamp: -1}, skip: skip, limit: limit}, user, true, finish);
findPhotosAll(query, compactFields, {sort: {stamp: -1}, skip: skip, limit: limit}, iAm, true, finish);
} else {
Photo.find(query, compactFields, {lean: true, sort: {adate: -1}, skip: skip, limit: limit}, finish);
}
Expand Down
9 changes: 8 additions & 1 deletion controllers/systemjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ module.exports.loadController = function (app, db) {
$set,
$unset,
pcount,
pfcount,
//bcount,
ccount;

Expand All @@ -163,12 +164,18 @@ module.exports.loadController = function (app, db) {
$set = {};
$unset = {};
pcount = db.photos.count({user: user._id});
ccount = db.comments.count({user: user._id});
pfcount = db.photos_fresh.count({user: user._id});
ccount = db.comments.count({user: user._id}) + db.commentsn.count({user: user._id});
if (pcount > 0) {
$set.pcount = pcount;
} else {
$unset.pcount = 1;
}
if (pfcount > 0) {
$set.pfcount = pfcount;
} else {
$unset.pfcount = 1;
}
if (ccount > 0) {
$set.ccount = ccount;
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pastvu",
"version": "0.8.4-dev",
"version": "0.8.4",
"description": "Retrospective topography of media content",
"homepage": "https://github.com/klimashkin/pastvu",
"keywords": ["oldmos", "pastvu"],
Expand Down
4 changes: 3 additions & 1 deletion public/history.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
0.8.4 / 2013-07-25
0.8.4 / 2013-07-26
==================

* (added) Google analytics с генерацие переходов страниц и событий авторизаци, комментариев и фотографий (создание, редактирование, удаление и т.д.)
* (added) Имя пользователя в ленте последних комментариев на главной
* (fixed) Счетчик комментариев в рэйтинге на главной странице
* (fixed) Вкладка настроек пользователя видна только ему самому и администраторам
* (fixed) Неавторизованные пользователи могли видеть неподтвержденные фотографии в галереи другого пользователя
***
Полный список изменений: https://github.com/klimashkin/pastvu/compare/0.8.3...0.8.4

Expand Down
2 changes: 1 addition & 1 deletion views/app.jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ html
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42664974-1', 'pastvu.com');
ga('create', 'UA-42731294-1', 'pastvu.com');
include ../public/style/appstart.css
include ../public/js/appstart.js
if appLand === 'dev'
Expand Down

0 comments on commit 9481cef

Please sign in to comment.