| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,7 +164,7 @@ class CommentsController(val discussionApi: DiscussionApiLike, csrfCheck: CSRFCh | |||
| 164 | 164 | // caches "closed" comment threads for an hour. | |
| 165 | 165 | // if the thread is switched on again the url changes and it cache busts itself. | |
| 166 | 166 | private def cacheTime(request: RequestHeader) = { | |
| 167 | - val commentsClosed = request.getParameter("commentable").contains("false") | ||
| 167 | + val commentsClosed = request.getParameter("commentsClosed").contains("true") | ||
| 168 | 168 | if (commentsClosed && LongCacheCommentsSwitch.isSwitchedOn) CacheTime(3800) else CacheTime(60) | |
| 169 | 169 | } | |
| 170 | 170 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -163,7 +163,7 @@ Comments.prototype.fetchComments = function(options) { | |||
| 163 | 163 | orderBy: orderBy, | |
| 164 | 164 | pageSize: options.pagesize || this.options.pagesize, | |
| 165 | 165 | displayThreaded: this.options.threading !== 'unthreaded', | |
| 166 | - commentable: config.page.commentable | ||
| 166 | + commentsClosed: options.commentsClosed | ||
| 167 | 167 | }; | |
| 168 | 168 | ||
| 169 | 169 | if (options.page) { | |
@@ -182,7 +182,8 @@ Comments.prototype.fetchComments = function(options) { | |||
| 182 | 182 | discussionId: this.options.discussionId, | |
| 183 | 183 | orderBy: queryParams.orderBy, | |
| 184 | 184 | displayThreaded: queryParams.displayThreaded, | |
| 185 | - maxResponses: queryParams.maxResponses | ||
| 185 | + maxResponses: queryParams.maxResponses, | ||
| 186 | + commentsClosed: queryParams.commentsClosed | ||
| 186 | 187 | }) | |
| 187 | 188 | .loadAllComments() | |
| 188 | 189 | .catch(function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,7 +69,7 @@ Loader.prototype.initTopComments = function() { | |||
| 69 | 69 | this.gotoComment(commentId); | |
| 70 | 70 | }); | |
| 71 | 71 | ||
| 72 | - return fetchJson('/discussion/top-comments/' + this.getDiscussionId() + '.json?commentable=' + config.page.commentable, { | ||
| 72 | + return fetchJson('/discussion/top-comments/' + this.getDiscussionId() + '.json?commentsClosed=' + this.getDiscussionClosed(), { | ||
| 73 | 73 | mode: 'cors' | |
| 74 | 74 | }).then( | |
| 75 | 75 | function render(resp) { | |
@@ -446,6 +446,9 @@ Loader.prototype.loadComments = function(options) { | |||
| 446 | 446 | if (options && options.shouldTruncate && this.comments.isAllPageSizeActive()) { | |
| 447 | 447 | options.pageSize = 10; | |
| 448 | 448 | } | |
| 449 | + | ||
| 450 | + // Closed state of comments is passed so we bust cache of comment thread when it is reopened | ||
| 451 | + options.commentsClosed = this.getDiscussionClosed(); | ||
| 449 | 452 | ||
| 450 | 453 | return this.comments.fetchComments(options) | |
| 451 | 454 | .then(function(){ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,7 +62,8 @@ define([ | |||
| 62 | 62 | this.params = { | |
| 63 | 63 | orderBy: options.orderBy, | |
| 64 | 64 | displayThreaded: options.displayThreaded, | |
| 65 | - maxResponses: options.maxResponses | ||
| 65 | + maxResponses: options.maxResponses, | ||
| 66 | + commentsClosed: options.commentsClosed | ||
| 66 | 67 | }; | |
| 67 | 68 | } | |
| 68 | 69 | ||
@@ -105,7 +106,8 @@ define([ | |||
| 105 | 106 | orderBy: 'oldest', | |
| 106 | 107 | page: pageNumber, | |
| 107 | 108 | pageSize: commentsPerPage, | |
| 108 | - displayThreaded: this.params.displayThreaded | ||
| 109 | + displayThreaded: this.params.displayThreaded, | ||
| 110 | + commentsClosed: this.params.commentsClosed | ||
| 109 | 111 | }; | |
| 110 | 112 | ||
| 111 | 113 | if (this.params.maxResponses) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments