Allow deleted stickied posts to be unstickied

This commit is contained in:
MelissaCole
2016-01-25 10:10:27 -08:00
parent 31c4f4f1c3
commit 3f8dbc93b2
2 changed files with 12 additions and 5 deletions

View File

@@ -1648,13 +1648,14 @@ class ApiController(RedditController):
if not isinstance(thing, Link):
return
if thing._deleted or thing._spam:
sr = thing.subreddit_slow
stickied = thing._fullname in sr.get_sticky_fullnames()
if not stickied and (thing._deleted or thing._spam):
abort(400, "Can't sticky a removed or deleted post")
sr = thing.subreddit_slow
if state:
if thing._fullname in sr.get_sticky_fullnames():
if stickied:
abort(409, "Already stickied")
sr.set_sticky(thing, c.user, num=num)
else:

View File

@@ -5293,7 +5293,13 @@ class LinkCommentsSettings(Templated):
(c.user_is_admin or
self.sr.is_moderator_with_perms(c.user, "posts"))
)
self.can_sticky = self.can_edit and not (link._deleted or link._spam)
self.can_sticky = False
if self.can_edit:
if self.stickied:
# always allow un-stickying things
self.can_sticky = True
elif not (link._deleted or link._spam):
self.can_sticky = True
self.sort = sort
self.suggested_sort = suggested_sort