Skip to content

Commit f75e87d

Browse files
authored
Merge pull request #318 from praw-dev/pm-chat-merge
Remove mute, unmute, unblock_subreddit methods
2 parents 1e55578 + e4d442b commit f75e87d

34 files changed

+44806
-2696
lines changed

CHANGES.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Unreleased
8585
- Remove ability to use :class:`.CommentForest` as an asynchronous iterator.
8686
- Remove ability to use :class:`.Reddit` as an synchronous context manager.
8787
- Remove key ``reset_timestamp`` from :meth:`.limits`.
88+
- Remove ``SubredditMessage.mute`` and ``SubredditMessage.unmute`` methods.
89+
- Remove ``InboxableMixin.unblock_subreddit`` method.
8890

8991
7.8.1 (2024/12/21)
9092
------------------
@@ -266,7 +268,7 @@ Unreleased
266268
WikiPage.
267269
- :meth:`.revert` to revert a WikiPage to a specified revision.
268270
- :meth:`.Inbox.mark_all_read` to mark all messages as read with one API call.
269-
- :meth:`~.InboxableMixin.unblock_subreddit` to unblock a subreddit.
271+
- ``InboxableMixin.unblock_subreddit`` to unblock a subreddit.
270272
- :meth:`.update_crowd_control_level` to update the crowd control level of a post.
271273
- :meth:`.moderator_subreddits`, which returns information about the subreddits that the
272274
authenticated user moderates, has been restored.

asyncpraw/config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from __future__ import annotations
44

55
import configparser
6-
import importlib
7-
import importlib.resources
6+
from importlib.resources import files
87
import os
98
from pathlib import Path
109
from threading import Lock
@@ -50,7 +49,7 @@ def _load_config(cls, *, config_interpolation: str | None = None) -> None:
5049
interpolator_class = None
5150

5251
config = configparser.ConfigParser(interpolation=interpolator_class)
53-
with importlib.resources.open_text(__package__, "praw.ini") as hdl:
52+
with files(__package__).joinpath("praw.ini").open("r") as hdl:
5453
config.read_file(hdl)
5554

5655
if "APPDATA" in os.environ: # Windows

asyncpraw/models/reddit/message.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -161,39 +161,3 @@ class SubredditMessage(Message):
161161
.. _unix time: https://en.wikipedia.org/wiki/Unix_time
162162
163163
"""
164-
165-
async def mute(self) -> None:
166-
"""Mute the sender of this :class:`.SubredditMessage`.
167-
168-
For example, to mute the sender of the first :class:`.SubredditMessage` in the
169-
authenticated users' inbox:
170-
171-
.. code-block:: python
172-
173-
from asyncpraw.models import SubredditMessage
174-
175-
async for message in reddit.inbox.all():
176-
if isinstance(message, SubredditMessage):
177-
await msg.mute()
178-
break
179-
180-
"""
181-
await self._reddit.post(API_PATH["mute_sender"], data={"id": self.fullname})
182-
183-
async def unmute(self) -> None:
184-
"""Unmute the sender of this :class:`.SubredditMessage`.
185-
186-
For example, to unmute the sender of the first :class:`.SubredditMessage` in the
187-
authenticated users' inbox:
188-
189-
.. code-block:: python
190-
191-
from asyncpraw.models import SubredditMessage
192-
193-
async for message in reddit.inbox.all():
194-
if isinstance(message, SubredditMessage):
195-
await msg.unmute()
196-
break
197-
198-
"""
199-
await self._reddit.post(API_PATH["unmute_sender"], data={"id": self.fullname})

asyncpraw/models/reddit/mixins/inboxable.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,33 +103,6 @@ async def mark_unread(self) -> None:
103103
"""
104104
await self._reddit.inbox.mark_unread([self])
105105

106-
async def unblock_subreddit(self) -> None:
107-
"""Unblock a subreddit.
108-
109-
.. note::
110-
111-
This method pertains only to objects which were retrieved via the inbox.
112-
113-
For example, to unblock all blocked subreddits that you can find by going
114-
through your inbox:
115-
116-
.. code-block:: python
117-
118-
from asyncpraw.models import SubredditMessage
119-
120-
subs = set()
121-
async for item in reddit.inbox.messages(limit=None):
122-
if isinstance(item, SubredditMessage):
123-
if (
124-
item.subject == "[message from blocked subreddit]"
125-
and str(item.subreddit) not in subs
126-
):
127-
item.unblock_subreddit()
128-
subs.add(str(item.subreddit))
129-
130-
"""
131-
await self._reddit.post(API_PATH["unblock_subreddit"], data={"id": self.fullname})
132-
133106
async def uncollapse(self) -> None:
134107
"""Mark the item as uncollapsed.
135108

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies = [
2929
"aiofiles",
3030
"aiohttp <4",
3131
"asyncprawcore >=3.0.1, <4",
32+
"coverage>=7.10.7",
3233
"defusedxml ==0.7.1",
3334
"update_checker >=0.18"
3435
]

tests/integration/cassettes/TestInbox.test_all.json

Lines changed: 125 additions & 47 deletions
Large diffs are not rendered by default.

tests/integration/cassettes/TestInbox.test_all__with_limit.json

Lines changed: 195 additions & 75 deletions
Large diffs are not rendered by default.

tests/integration/cassettes/TestInbox.test_comment_replies.json

Lines changed: 125 additions & 47 deletions
Large diffs are not rendered by default.

tests/integration/cassettes/TestInbox.test_comment_reply__refresh.json

Lines changed: 195 additions & 75 deletions
Large diffs are not rendered by default.

tests/integration/cassettes/TestInbox.test_mark_all_read.json

Lines changed: 321 additions & 108 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)