-
-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for reordering flairs through reddit.flair.reorder #1956
Conversation
Perfectly okay! Thanks for the MR, I'll take a look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start! I left several comments for improvements and a few questions. This will also need some tests written.
praw/models/reddit/subreddit.py
Outdated
@@ -2020,6 +2025,7 @@ def configure( | |||
url = API_PATH["flairconfig"].format(subreddit=self.subreddit) | |||
self.subreddit._reddit.post(url, data=data) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind executing the pre_push.py in the root of the repo?
praw/models/reddit/subreddit.py
Outdated
if flair_type not in ["USER_FLAIR", "LINK_FLAIR"]: | ||
raise TypeError("'flair_type' must be either USER_FLAIR or LINK_FLAIR") | ||
url = API_PATH["flairreorder"].format(subreddit=self.subreddit) | ||
self.subreddit._reddit.patch(url+"?subreddit="+self.subreddit.display_name+"&flair_type="+flair_type, json=newlist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the arguments need to be url parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the arguments need to be url parameters?
Both posts I found on the subject did it this way, and it was the only method that worked for me... Not to say there isn't another way though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the arguments need to be url parameters?
Got confirmation from Reddit, yes, this is how to do it.
Run prepush.py
I got an error with this one:
Running: pre-commit run --all-files
[WinError 2] The system cannot find the file specified
Which file is that>
rebase to master
I did this following instructions on the web, and it doesn't seem to have made any difference? I've pushed my latest changes either way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error with this one:
Running: pre-commit run --all-files
[WinError 2] The system cannot find the file specified
Which file is that>
Did you by chance install dev dependencies? You can do this with pip install .[dev]
in the repo root.
Got confirmation from Reddit, yes, this is how to do it.
If that is the case, then let's add a new params
parameter to the patch
method. See the get
or post
methods for how this is utilized.
@@ -2728,7 +2744,7 @@ def update( | |||
:param submit_text_label: Custom label for submit text post button (``None`` for | |||
default). | |||
:param subreddit_type: One of ``"archived"``, ``"employees_only"``, | |||
``"gold_only"``, ``"gold_restricted"``, ``"private"``, ``"public"``, or | |||
``"gold_only"``, ``gold_restricted``, ``"private"``, ``"public"``, or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rebase on master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry... How do I do this? As you can tell, I don't use git all that often! In fact I think this is only my first or maybe second pr that has been taken seriously :)
This PR is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 30 days. |
Thanks for opening, I'll get this finished up for ya and merged in. |
58091f9
to
c559a3f
Compare
c559a3f
to
32eefbf
Compare
FYI I moved the method to |
I needed the ability to reorder flairs... So I added it.
I added the api path to endpoints.py, and added subreddit.flair.reorder which takes arguments of a list of flair ID's and the flair type as a string.
Hope this is okay