FollowingForumCollection.js

From disqus.com, 2 Months ago, written in JavaScript, viewed 3 times. This paste is a reply to embed.js from disqus.com - view diff
URL https://pastebin.freepbx.org/view/727516c0 Embed
Download Paste or View Raw
  1. define('home/collections/FollowingForumCollection',[
  2.     'underscore',
  3.     'home/utils/backboneUtils',
  4.  
  5.     'home/collections/ForumCollection',
  6.  
  7.     'core/api',
  8. ], function (
  9.     _,
  10.     BackboneUtils,
  11.  
  12.     ForumCollection,
  13.  
  14.     api
  15. ) {
  16.     'use strict';
  17.  
  18.     var FollowingForumCollection = ForumCollection.extend({
  19.         url: api.getURL('users/listFollowingForums'),
  20.  
  21.         initialize: function () {
  22.             this.on('add', this.completeModel);
  23.         },
  24.  
  25.         completeModel: function (model) {
  26.             if (!model.get('name'))
  27.                 model.fetch();
  28.         },
  29.  
  30.         fetch: function (options) {
  31.             options = options || {};
  32.  
  33.             // Load the max possible number of forums at a time
  34.             // to prevent pagination issues for now, as almost
  35.             // no users follow more than 100 forums.
  36.             options.data = _.defaults({
  37.                 limit: 100,
  38.             }, options.data);
  39.  
  40.             return BackboneUtils.memoizedFetch.call(this, options);
  41.         },
  42.  
  43.         parse: function (response) {
  44.             if (Boolean(response) && Boolean(response.response) && _.isArray(response.response)) {
  45.                 response = _.defaults({ response: _.filter(response.response, function (channel) {
  46.                     return channel.id.indexOf('channel-') === -1 || channel.id === 'channel-discussdisqus';
  47.                 }) }, response);
  48.             }
  49.  
  50.             response = ForumCollection.prototype.parse.call(this, response);
  51.  
  52.             return response;
  53.         },
  54.     });
  55.  
  56.     return FollowingForumCollection;
  57. });
  58.  
  59. //  https://c.disquscdn.com/next/c0d8fa9/home/js/collections/FollowingForumCollection.js

Replies to FollowingForumCollection.js rss

Title Name Language When
require-config.js disqus.com javascript 2 Months ago.

Reply to "FollowingForumCollection.js"

Here you can reply to the paste above