Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share func #68

Merged
merged 6 commits into from
Sep 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
248 changes: 0 additions & 248 deletions DevTools/output.txt

This file was deleted.

Binary file modified db.sqlite3
Binary file not shown.
Binary file removed hatsoff/__init__.pyc
Binary file not shown.
Binary file removed hatsoff/settings.pyc
Binary file not shown.
Binary file removed hatsoff/urls.pyc
Binary file not shown.
Binary file removed hatsoff/wsgi.pyc
Binary file not shown.
82 changes: 39 additions & 43 deletions nodejs/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,6 @@ io.on('connection', function(socket){
portfoliodocs = docs;
//socket.emit('update portfolio comment history', docs);
});



});

socket.on('at home', function(data){
Expand Down Expand Up @@ -1018,7 +1015,6 @@ io.on('connection', function(socket){
});
},
function(post){
console.log("second");
docs.set('content', post.toJSON(), {strict: false});
newdocs.push(docs);
//console.log("****newdocs****:"+newdocs);
Expand Down Expand Up @@ -1577,7 +1573,6 @@ io.on('connection', function(socket){
if (friends[i] in users){
users[friends[i]].emit('new private post', {msg:data.msg, image:data.data, uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname, community_id:post.id, tag:data.tag, skillls:data.skillls});
}

}
}
});
Expand Down Expand Up @@ -2066,42 +2061,33 @@ io.on('connection', function(socket){
}
});

var newNotification = new NotificationPost({action_id:5, content_type:2, content_id:data.c_id, to_uid:data.to_uid, action_user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}});

newNotification.save(function(err){
if (err) {
console.log(err);
} else{
console.log('saved notification:');
}
});
});

socket.on('share portfolio', function(data, callback){
var d = new Date();
//var newPost = new SharePost({to_uid:data.to_uid, user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}, content_type:3, content_id:data.c_id});

var newPost = new SharePost({to_uid:data.to_uid, user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}, content_type:3, content_id:data.c_id});
newPost.save();

db.serialize(function() {
//db.each("SELECT user_id, title, image, describe FROM week1_showcase WHERE user_id=? AND number=?", (data.to_uid, data.c_id), function(err, row){
db.each("SELECT a.first_name, a.last_name, s.title, s.image, s.describe FROM week1_showcase s, auth_user a WHERE s.user_id='"+data.to_uid+"' AND s.number='"+data.content_id+"' AND s.user_id=a.id GROUP BY s.user_id", function(err, row){
db.each("SELECT a.first_name, a.last_name, s.title, s.image, s.describe FROM week1_upcomingwork s, auth_user a WHERE s.user_id='"+data.to_uid+"' AND s.user_id=a.id GROUP BY s.user_id", function(err, row){
if (err) console.log("error", err);
if(row){
newPost = new CommunityPost({ portfolio:{image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
newPost.save(function(err, post){
if (err) {
console.log(err);
} else{
}
newPost = new CommunityPost({ upcoming:{image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
newPost.save(function(err, post){
if (err) console.log(err);

CommunityMember.findOne({uid:socket.uid}).exec(function(err, result){
if(result){
var friends = result.friends;

for (var i = 0; i < friends.length; i++){
if (friends[i] in users){
users[friends[i]].emit('new share', { type: 'upcoming', content :{community_id:post.id, image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
socket.emit('new share', { type: 'upcoming', content :{community_id:post.id, image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
}
}
}
});
});
}

});
});

var newNotification = new NotificationPost({action_id:5, content_type:3, content_id:data.c_id, to_uid:data.to_uid, action_user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}});
var newNotification = new NotificationPost({action_id:5, content_type:2, content_id:data.c_id, to_uid:data.to_uid, action_user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}});

newNotification.save(function(err){
if (err) {
Expand All @@ -2110,28 +2096,38 @@ io.on('connection', function(socket){
console.log('saved notification:');
}
});

});

socket.on('share upcoming', function(data, callback){
socket.on('share portfolio', function(data, callback){
var d = new Date();

//var newPost = new SharePost({to_uid:data.to_uid, user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}, content_type:3, content_id:data.c_id});

var newPost = new SharePost({to_uid:data.to_uid, user:{uid:socket.uid, first_name:socket.firstname, last_name:socket.lastname}, content_type:3, content_id:data.c_id});
newPost.save();

db.serialize(function() {
//db.each("SELECT user_id, title, image, describe FROM week1_showcase WHERE user_id=? AND number=?", (data.to_uid, data.c_id), function(err, row){
db.each("SELECT a.first_name, a.last_name, w.title, w.image, w.describe FROM week1_upcomingwork w, auth_user a WHERE w.user_id='"+data.to_uid+"' AND w.number='"+data.content_id+"' AND w.user_id=a.id GROUP BY w.user_id", function(err, row){
db.each("SELECT a.first_name, a.last_name, s.title, s.image, s.describe FROM week1_showcase s, auth_user a WHERE s.user_id='"+data.to_uid+"' AND s.number='"+data.content_id+"' AND s.user_id=a.id GROUP BY s.user_id", function(err, row){
if (err) console.log("error", err);
if(row){
newPost = new CommunityPost({ upcoming:{image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
newPost.save(function(err, post){
if (err) {
console.log(err);
} else{
}
newPost = new CommunityPost({ portfolio:{image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
newPost.save(function(err, post){
if (err) console.log(err);

CommunityMember.findOne({uid:socket.uid}).exec(function(err, result){
if(result){
var friends = result.friends;

for (var i = 0; i < friends.length; i++){
if (friends[i] in users){
users[friends[i]].emit('new share', { type: 'portfolio', content: {community_id:post.id, image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
socket.emit('new share', { type: 'portfolio', content: {community_id:post.id, image:row.image, title:row.title, description:row.describe}, sharedBy:socket.uid, user:{uid:data.to_uid, first_name:row.first_name, last_name:row.last_name} });
}
}
}
});
});
}

});
});

Expand Down
Loading