mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 13:35:58 +00:00
Completing tryfeed for social subscriptions. Can now follow social feeds you don't already follow from the feed itself.
This commit is contained in:
parent
b4acea734b
commit
d13e606ee1
3 changed files with 19 additions and 12 deletions
|
@ -167,13 +167,17 @@ def load_social_page(request, user_id, username=None):
|
|||
|
||||
@json.json_view
|
||||
def story_comments(request):
|
||||
feed_id = int(request.POST['feed_id'])
|
||||
story_id = request.POST['story_id']
|
||||
feed_id = int(request.REQUEST['feed_id'])
|
||||
story_id = request.REQUEST['story_id']
|
||||
|
||||
shared_stories = MSharedStory.objects.filter(story_feed_id=feed_id, story_guid=story_id)
|
||||
shared_stories = MSharedStory.objects.filter(story_feed_id=feed_id, story_guid=story_id, has_comments=True)
|
||||
comments = [s.comments_with_author() for s in shared_stories]
|
||||
|
||||
profile_user_ids = [c['user_id'] for c in comments]
|
||||
profiles = MSocialProfile.objects.filter(user_id__in=list(profile_user_ids))
|
||||
profiles = [profile.to_json(compact=True) for profile in profiles]
|
||||
|
||||
return {'comments': comments}
|
||||
return {'comments': comments, 'profiles': profiles}
|
||||
|
||||
@ajax_login_required
|
||||
@json.json_view
|
||||
|
|
|
@ -672,7 +672,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
},
|
||||
|
||||
add_social_feed: function(feed) {
|
||||
var social_feed = this.social_feeds.get(feed.get('user_id'));
|
||||
var social_feed = this.social_feeds.get(feed);
|
||||
if (!social_feed) {
|
||||
social_feed = new NEWSBLUR.Models.SocialSubscription(feed.attributes);
|
||||
this.social_feeds.add(social_feed);
|
||||
|
@ -1114,9 +1114,8 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
load_public_story_comments: function(story_id, feed_id, callback) {
|
||||
this.make_request('/social/comments', {
|
||||
'story_id': story_id,
|
||||
'feed_id': feed_id,
|
||||
'compact': true
|
||||
}, callback);
|
||||
'feed_id': feed_id
|
||||
}, callback, callback, {request_type: 'GET'});
|
||||
},
|
||||
|
||||
recalculate_story_scores: function(feed_id) {
|
||||
|
|
|
@ -1125,7 +1125,7 @@
|
|||
}, this));
|
||||
},
|
||||
|
||||
make_social_feeds: function() {
|
||||
make_social_feeds: function(callback) {
|
||||
var $social_feeds = this.$s.$social_feeds;
|
||||
|
||||
$social_feeds.empty();
|
||||
|
@ -1142,7 +1142,8 @@
|
|||
});
|
||||
$social_feeds.html($feeds);
|
||||
$social_feeds.animate({'opacity': 1}, {'duration': 700});
|
||||
|
||||
|
||||
callback && callback();
|
||||
},
|
||||
|
||||
load_router: function() {
|
||||
|
@ -6463,9 +6464,12 @@
|
|||
},
|
||||
|
||||
follow_user_in_tryfeed: function(feed_id) {
|
||||
var self = this;
|
||||
var socialsub = this.model.get_feed(feed_id);
|
||||
this.model.follow_user(socialsub.get('user_id'), function(data) {
|
||||
NEWSBLUR.reader.make_social_feeds();
|
||||
this.model.follow_user(socialsub.user_id, function(data) {
|
||||
NEWSBLUR.reader.make_social_feeds(function() {
|
||||
self.open_social_stories(feed_id);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue