Skip to content

Commit

Permalink
Merge 7bff1a1 into 73aec2d
Browse files Browse the repository at this point in the history
  • Loading branch information
kungming2 committed Nov 9, 2019
2 parents 73aec2d + 7bff1a1 commit 6e6a600
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions praw/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"select_flair": "r/{subreddit}/api/selectflair/",
"sendreplies": "api/sendreplies",
"sent": "message/sent/",
"set_original_content": "api/set_original_content",
"setpermissions": "r/{subreddit}/api/setpermissions/",
"site_admin": "api/site_admin/",
"spoiler": "api/spoiler/",
Expand Down
55 changes: 55 additions & 0 deletions praw/models/reddit/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,33 @@ def nsfw(self):
API_PATH["marknsfw"], data={"id": self.thing.fullname}
)

def set_original_content(self):
"""Mark as original content.
This method can only be used by moderators of the subreddit
that the submission belongs to, if the subreddit has enabled
the beta feature in settings.
Example usage:
.. code:: python
submission = reddit.subreddit('test').submit('oc test',
selftext='original')
submission.mod.set_original_content()
See also :meth:`~.unset_original_content`
"""
data = {
"id": self.thing.id,
"fullname": self.thing.fullname,
"should_set_oc": True,
"executed": False,
"r": self.thing.subreddit,
}
self.thing._reddit.post(API_PATH["set_original_content"], data=data)

def sfw(self):
"""Mark as safe for work.
Expand Down Expand Up @@ -601,6 +628,34 @@ def suggested_sort(self, sort="blank"):
data={"id": self.thing.fullname, "sort": sort},
)

def unset_original_content(self):
"""Indicate that the submission is not original content.
This method can only be used by moderators of the subreddit
that the submission belongs to, if the subreddit has enabled
the beta feature in settings. This uses the same endpoint as
`set_original_content`, but `should_set_oc` is set to `False`.
Example usage:
.. code:: python
submission = reddit.subreddit('test').submit('oc test',
selftext='original')
submission.mod.unset_original_content()
See also :meth:`~.set_original_content`
"""
data = {
"id": self.thing.id,
"fullname": self.thing.fullname,
"should_set_oc": False,
"executed": False,
"r": self.thing.subreddit,
}
self.thing._reddit.post(API_PATH["set_original_content"], data=data)

def unspoiler(self):
"""Indicate that the submission does not contain spoilers.
Expand Down

0 comments on commit 6e6a600

Please sign in to comment.