Add hook for triggering actions upon distinguish.

This commit is contained in:
Max Goodman
2013-10-25 02:19:20 -07:00
parent 2af8fe6703
commit c0a5264023

View File

@@ -39,6 +39,7 @@ from r2.models import *
from r2.lib import amqp
from r2.lib import recommender
from r2.lib import hooks
from r2.lib.utils import get_title, sanitize_url, timeuntil, set_last_modified
from r2.lib.utils import query_string, timefromnow, randstr
@@ -2237,6 +2238,8 @@ class ApiController(RedditController, OAuth2ResourceController):
thing.distinguished = how
thing._commit()
hooks.get_hook("thing.distinguish").call(thing=thing)
wrapper = default_thing_wrapper(expand_children = True)
w = wrap_links(thing, wrapper)
jquery(".content").replace_things(w, True, True)