Skip to content

Commit

Permalink
Add deprecation warning for legacy modmail
Browse files Browse the repository at this point in the history
(cherry picked from commit 97b933935377fbb304c0275312a3e382a3fd540b)
  • Loading branch information
LilSpazJoekp committed Jun 16, 2021
1 parent 101a730 commit ac9504a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -25,6 +25,12 @@ Unreleased
greater than 500 KiB, even when the parameters did not exceed their respective
permitted maximum lengths.

**Deprecated**

- Legacy modmail is slated for deprecation by Reddit in June 2021. See
https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/ for
more info.

7.2.0 (2021/02/25)
------------------

Expand Down
27 changes: 27 additions & 0 deletions asyncpraw/models/reddit/subreddit.py
Expand Up @@ -19,6 +19,7 @@
Union,
)
from urllib.parse import urljoin
from warnings import warn
from xml.etree.ElementTree import XML

from aiohttp import ClientResponse
Expand Down Expand Up @@ -2268,6 +2269,12 @@ def inbox(
) -> Iterator["asyncpraw.models.SubredditMessage"]:
"""Return a :class:`.ListingGenerator` for moderator messages.
.. warning::
Legacy modmail is being deprecated in June 2021. Please see
https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/
for more info.
Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.
Expand All @@ -2286,6 +2293,13 @@ def inbox(
print("From: {}, Body: {}".format(reply.author, reply.body))
"""
warn(
"Legacy modmail is being deprecated in June 2021. Please see"
" https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/"
" for more info.",
category=DeprecationWarning,
stacklevel=3,
)
return ListingGenerator(
self.subreddit._reddit,
API_PATH["moderator_messages"].format(subreddit=self.subreddit),
Expand Down Expand Up @@ -2485,6 +2499,12 @@ def unread(
) -> Iterator["asyncpraw.models.SubredditMessage"]:
"""Return a :class:`.ListingGenerator` for unread moderator messages.
.. warning::
Legacy modmail is being deprecated in June 2021. Please see
https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/
for more info.
Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.
Expand All @@ -2501,6 +2521,13 @@ def unread(
print("From: {}, To: {}".format(message.author, message.dest))
"""
warn(
"Legacy modmail is being deprecated in June 2021. Please see"
" https://www.reddit.com/r/modnews/comments/mar9ha/even_more_modmail_improvements/"
" for more info.",
category=DeprecationWarning,
stacklevel=3,
)
return ListingGenerator(
self.subreddit._reddit,
API_PATH["moderator_unread"].format(subreddit=self.subreddit),
Expand Down

0 comments on commit ac9504a

Please sign in to comment.