fixed autosubscribe
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from utils import *
|
||||
|
||||
from thread import Thread
|
||||
import models
|
||||
import settings
|
||||
|
||||
@@ -23,6 +24,10 @@ class Comment(models.Model):
|
||||
base_url = "{prefix}/comments".format(prefix=settings.PREFIX)
|
||||
type = 'comment'
|
||||
|
||||
@property
|
||||
def thread(self):
|
||||
return Thread(id=self.thread_id, type='thread')
|
||||
|
||||
@classmethod
|
||||
def url_for_comments(cls, params={}):
|
||||
if params.get('thread_id'):
|
||||
|
||||
@@ -87,7 +87,6 @@ class @ContentView extends Backbone.View
|
||||
@$(".discussion-follow-thread").removeClass("discussion-unfollow-thread").html("Follow")
|
||||
|
||||
ability: (ability) ->
|
||||
console.log "triggered"
|
||||
for action, elemSelector of @model.actions
|
||||
if not ability[action]
|
||||
@$(elemSelector).parent().remove()
|
||||
|
||||
@@ -37,10 +37,8 @@ class @DiscussionView extends Backbone.View
|
||||
@newPost()
|
||||
|
||||
reload: ($elem, url) ->
|
||||
console.log "here"
|
||||
if not url then return
|
||||
DiscussionUtil.get $elem, url, {}, (response, textStatus) =>
|
||||
console.log response
|
||||
$parent = @$el.parent()
|
||||
@$el.replaceWith(response.html)
|
||||
$discussion = $parent.find("section.discussion")
|
||||
@@ -49,7 +47,6 @@ class @DiscussionView extends Backbone.View
|
||||
DiscussionUtil.bulkUpdateContentInfo(window.$$annotated_content_info)
|
||||
|
||||
loadSimilarPost: (event) ->
|
||||
console.log "loading"
|
||||
$title = @$(".new-post-title")
|
||||
$wrapper = @$(".new-post-similar-posts-wrapper")
|
||||
$similarPosts = @$(".new-post-similar-posts")
|
||||
@@ -63,7 +60,6 @@ class @DiscussionView extends Backbone.View
|
||||
url = DiscussionUtil.urlFor 'search_similar_threads', @model.id
|
||||
data = { text: @$(".new-post-title").val() }
|
||||
DiscussionUtil.get $elem, url, data, (response, textStatus) =>
|
||||
console.log response
|
||||
$similarPosts.empty()
|
||||
if $.type(response) == "array" and response.length
|
||||
$wrapper.show()
|
||||
|
||||
@@ -2,7 +2,6 @@ class @DiscussionModuleView extends Backbone.View
|
||||
events:
|
||||
"click .discussion-show": "toggleDiscussion"
|
||||
toggleDiscussion: (event) ->
|
||||
console.log "toggle"
|
||||
if @showed
|
||||
@$("section.discussion").hide()
|
||||
$(event.target).html("Show Discussion")
|
||||
|
||||
Reference in New Issue
Block a user