recommendations: open user recommendations to all users.

* Open recommendations to all users (not just gold).
* Show recommendations on all posts (not just posts after 2017).
* Allow users to browse recommendations for other users.
* Increase number of recommended posts returned.
* Change endpoints to /recommended_posts?user_id=1234 and
  /recommended_posts?post_id=1234 and add json/xml support.
This commit is contained in:
evazion
2019-12-01 00:34:30 -06:00
parent c4cdba0874
commit 41b30fc64c
7 changed files with 56 additions and 83 deletions

View File

@@ -9,6 +9,7 @@ let Post = {};
Post.pending_update_count = 0;
Post.SWIPE_THRESHOLD = 60;
Post.SWIPE_VELOCITY = 0.6;
Post.MAX_RECOMMENDATIONS = 27; // 3 rows of 9 posts at 1920x1080.
Post.initialize_all = function() {
@@ -433,9 +434,7 @@ Post.initialize_post_sections = function() {
$("#comments").hide();
$("#edit").hide();
$("#recommended").show();
$.get("/recommended_posts", {context: "post", post_id: Utility.meta("post-id")}, function(data) {
$("#recommended").html(data);
});
$.get("/recommended_posts.js", { post_id: Utility.meta("post-id"), max_recommendations: Post.MAX_RECOMMENDATIONS });
} else {
$("#edit").hide();
$("#comments").hide();