@@ -548,11 +548,11 @@ router.post('/api/v1/posts/subscriptions/',function(req,res){
let curator = req.body.curator || undefined;
if((requestOrigin === null) || (pageNumber===1)){ // no other choice
requestOrigin = now;
redisClient.set("postRequestOrigin:"+userId,requestOrigin);
redisClient.set("postRequestOrigin:"+user.userId,requestOrigin);
}
timeOrigin = parseInt(requestOrigin);

redisClient.expire("postRequestOrigin:"+userId,60000); // 10mins
redisClient.expire("postRequestOrigin:"+user.userId,60000); // 10mins
user.followings.push(user.userId);
posts.getPostsByFiltersAndOrders(req, res, user, user.followings, orderBy, isCurated, hashtags, category, curator ,false, true, true, 0,1000000,timeOrigin, timeEdge ,counts, pageNumber);
});
@@ -655,7 +655,6 @@ router.post('/api/v1/posts/:uuid',function(req,res){
// categories controllers

router.get('/api/v1/category/accessibles',function(req,res) {

categories.getDefinedCategories(req,res);

});
@@ -670,8 +669,6 @@ router.get('/api/v1/category/accessibles',function(req,res) {

router.post('/api/v1/getPostComments/',function(req,res){



if(!isNaN(parseInt(req.body.pageNumber)) && parseInt(req.body.pageNumber) > 0 && parseInt(req.body.pageNumber) < 100){
//
}
@@ -692,7 +689,7 @@ router.post('/api/v1/getPostComments/',function(req,res){
router.post('/api/v1/users/addComment/',function(req,res){
validateRequest(req,res,function(callback){
if(callback){
comments.Create(req,res,callback);
comments.create(req,res,callback);
}
else{
res.send({result:false,message:"403 Unauthorized"})
@@ -289,8 +289,8 @@ var posts = {

}
},
getPostInfoById : function(postId,privacy,callback){

getPostInfoById:function(postId,privacy,callback){
let options = {
album: 1, // null if not
postId: 1,
@@ -332,7 +332,7 @@ var posts = {
if (err)
throw err;
else
return callback(post);
callback(post);
});
},
accessPostDatas : function(user,postId,owner,privacy,res,query){
@@ -876,9 +876,9 @@ var posts = {
res.send({result:true,message:"already viewd"});
}
else{
let postOwnerId = posts.getPostOwnerIdByDecrypt(postId);
var postOwnerId = posts.getPostOwnerIdByDecrypt(postId);

if(user.followings.indexOf(postOwnerId) > -1){
if(user.followings.indexOf(postOwnerId) > -1 || postOwnerId === user.userId){
posts.doView(user.userId,postId,true,res); // post and account privacy bypass
}
else{
@@ -934,7 +934,7 @@ var posts = {
}
postSchema.findOneAndUpdate(query,{"$inc":{views:1}},{
"fields":{
"albumId":1,
"album":1,
"isPrivate":1,
},
"new":true
@@ -992,6 +992,9 @@ var posts = {
if(user.followings.indexOf(postOwnerId) > -1){
posts.doRate(user.userId,postId,rateValue,rateObject,true,res); // post and account privacy bypass
}
else if(user.userId === postOwnerId){
res.send({result:true,message:"You cant rate your own post"});
}
else{
blocks.check(postOwnerId,user.userId,function(blocked){
if(blocked){
@@ -586,7 +586,7 @@ <h4>
Filters.order = "latest";
Filters.orderBy = "createdAt";
}
debugger;
// debugger;
if(["following","explore","home","latest","curated","top"].indexOf(window.location.pathname.split("/")[1]) === -1)
order="profile/"+order;
makeUrl(order);
@@ -965,7 +965,9 @@ <h4>
newText = commentsList[selectedComment].fullText;
$(".commentsContainer .cancelComment").addClass("show");
$(".commentsContainer .new.show").removeClass("show");
$(".commentsContainer .new.show").removeClass("show");
$(".commentsContainer .newCommentDiv").addClass("show");
$("#newComment").removeClass("show");
autoResizeTextArea(true);
setTimeout(function(){
$("#newComment").focus()
@@ -1362,7 +1364,7 @@ <h4>
var hashtag = "";
var category = "";
var order = "";
debugger;
// debugger;
if (pageName) {
if(pageName.startsWith("post")){
changePage("post","post/"+postId,true,postId);
@@ -1371,11 +1373,11 @@ <h4>
if((pageName === "explore") || (pageName === "curated") || (pageName === "latest") || (pageName === "top")) {
changePage(window.location.pathname.split("/")[1],window.location.pathname.split("/")[1]+ "/" + pageName,true,"",true,true); // the same
}
else if(pageName === "following"){
changePage("following","following/"+pageName.split("/")[1],true,"",true,true);
else if(pageName.split("following/").length > 1){
changePage("following","following/"+pageName,true,"",true,true);
}
else if(pageName.split("profile/").length > 1){
debugger;
// debugger;
changePage("profile",window.location.pathname.split("/")[1]+"/"+pageName.split("/")[1],true,"",true,true);
}
}
@@ -1962,13 +1964,11 @@ <h4>
$(".postsContainer").html("");
}
else{
for(var post = 0;post < res.docs.length ; post++){
postsList.push(res.docs[post]);
}
postsList.push.apply(postsList,res.docs);
let tempUsersInfo = res.owners;
let keys = Object.keys(tempUsersInfo);
for(let x in keys){
if(!usersInfo[keys[x]]){
for (let x in keys) {
if (!usersInfo[keys[x]]) {
usersInfo[keys[x]] = tempUsersInfo[keys[x]];
}
}
@@ -2400,26 +2400,27 @@ <h4>
else {
if (res.docs.length === 0) {
$(".post .commentsContainer .header").html(" No comments yet ");
$(".post .commentsContainer .commentsList").html("");
}
else if (res.docs === []) {
$(".post .commentsContainer .header").html(" No comments yet ");
$(".post .commentsContainer .commentsList").html("");
}
else if (res === []) {
$(".post .commentsContainer .header").html(" Oops Something Went Wrong ");
$(".post .commentsContainer .commentsList").html("");
}
else {
if (commentsPageNumber === 1) {
commentsList = res.docs;
usersInfo = res.owners;
total = res.total;
commentsLastLength = -1;
$(".post .commentsContainer .header").html(res.total + " Comments");
$(".post .commentsContainer .commentsList").html("");
// add comments loader
$(".post .commentsContainer .header").html(res.total + " Comments");
}
else {
for (var comment = 0; comment < res.docs.length; comment++) {
commentsList.push(res.docs[comment]);
}
commentsList.push.apply(notIncludeThese,res.docs);
let tempUsersInfo = res.owners;
let keys = Object.keys(tempUsersInfo);
for (let x in keys) {
@@ -2491,9 +2492,9 @@ <h4>
</defs>
</svg>
<div class="polygon-each-img-wrap">
<img class="ownerProfilePicture polygon-clip-hexagon" src="../profilePics/${usersInfo[Me.userId].split("/")[1]}"/>
<img class="ownerProfilePicture polygon-clip-hexagon" src="../profilePics/${usersInfo[Me.userId].profilePictureSet}"/>
</div>
<a href="/${usersInfo[Me.userId].split("/")[0]}" class="ownerUsername usernameLink">${usersInfo[Me.userId].split("/")[0]}</a>
<a href="/${usersInfo[Me.userId].username}" class="ownerUsername usernameLink">${usersInfo[Me.userId].username}</a>
<button class="commentMoreButton"></button>
</div>
<p class="text">
@@ -2522,9 +2523,9 @@ <h4>
</defs>
</svg>
<div class="polygon-each-img-wrap">
<img class="ownerProfilePicture polygon-clip-hexagon" src="../profilePics/${usersInfo[commentsList[index].ownerId].split("/")[1]}"/>
<img class="ownerProfilePicture polygon-clip-hexagon" src="../profilePics/${usersInfo[commentsList[index].ownerId].profilePictureSet}"/>
</div>
<a href="/${usersInfo[commentsList[index].ownerId].split("/")[0]}" class="ownerUsername usernameLink">${usersInfo[commentsList[index].ownerId].split("/")[0]}</a>
<a href="/${usersInfo[commentsList[index].ownerId].username}" class="ownerUsername usernameLink">${usersInfo[commentsList[index].ownerId].username}</a>
<button class="commentMoreButton"></button>
</div>
<p class="text">
@@ -1921,7 +1921,7 @@ a,h1,h2,h3,h4,h5,h6,p,span,input,button,textarea{

.post .pictureBox .middlePic{
max-width: 105%;
max-height: 90%;
max-height: 85%;
}

.post .pictureBox .rightPic{