-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Add text to other post types [image, gallery, video] #1987
Conversation
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.
Good start! This needs pre_push.py
ran and then all the commits squashed into one. We will also need integration tests as well.
self, | ||
title: str, | ||
images: list[dict[str, str]], | ||
text: str = '', |
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.
This needs to be named selftext
and sorted into the keyword arguments alphabetically.
@@ -1415,6 +1411,7 @@ def submit_image( | |||
title: str, | |||
image_path: str, | |||
*, | |||
text: str = None, # New optional parameter for text |
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.
Same with this.
@@ -1631,6 +1631,7 @@ def submit_video( | |||
title: str, | |||
video_path: str, | |||
*, | |||
text: str = None, # New optional parameter for text |
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.
Same with this.
:param images: The images to post in dict with the following structure: | ||
``{"image_path": "path", "caption": "caption", "outbound_url": "url"}``, | ||
only ``image_path`` is required. | ||
:param text: The Markdown formatted content for a ``text`` submission. Use an empty string, ``""``, to make a title-only submission. |
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.
This also needs to be sorted in here.
:param title: The title of the submission. | ||
:param images: The images to post in dict with the following structure: | ||
``{"image_path": "path", "caption": "caption", "outbound_url": "url"}``, | ||
only ``image_path`` is required. | ||
:param text: The Markdown formatted content for a ``text`` submission. Use an empty string, ``""``, to make a title-only submission. | ||
:param collection_id: The UUID of a :class:`.Collection` to add the | ||
newly-submitted post to. | ||
:param discussion_type: Set to ``"CHAT"`` to enable live discussion instead of | ||
traditional comments (default: ``None``). | ||
:param flair_id: The flair template to select (default: ``None``). | ||
:param flair_text: If the template's ``flair_text_editable`` value is ``True``, | ||
this value will set a custom text (default: ``None``). ``flair_id`` is | ||
required when ``flair_text`` is provided. | ||
:param nsfw: Whether the submission should be marked NSFW (default: ``False``). | ||
:param send_replies: When ``True``, messages will be sent to the submission | ||
author when comments are made to the submission (default: ``True``). | ||
:param spoiler: Whether the submission should be marked asa spoiler (default: | ||
``False``). | ||
:returns: A :class:`.Submission` object for the newly created submission. | ||
:raises: :class:`.ClientException` if ``image_path`` in ``images`` refers to a | ||
file that is not an image. | ||
For example, to submit an image gallery to r/test do: | ||
.. code-block:: python | ||
title = "My favorite pictures" | ||
image = "/path/to/image.png" | ||
image2 = "/path/to/image2.png" | ||
image3 = "/path/to/image3.png" | ||
images = [ | ||
{"image_path": image}, | ||
{ | ||
"image_path": image2, | ||
"caption": "Image caption 2", | ||
}, | ||
{ | ||
"image_path": image3, | ||
"caption": "Image caption 3", | ||
"outbound_url": "https://example.com/link3", | ||
}, | ||
] | ||
reddit.subreddit("test").submit_gallery(title, images) | ||
.. seealso:: | ||
- :meth:`~.Subreddit.submit` to submit url posts and selftexts | ||
- :meth:`~.Subreddit.submit_image` to submit single images | ||
- :meth:`~.Subreddit.submit_poll` to submit polls | ||
- :meth:`~.Subreddit.submit_video` to submit videos and videogifs | ||
""" |
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.
This needs reverted with just the new selftext
parameter added.
@@ -1367,13 +1361,14 @@ def submit_gallery( | |||
"spoiler": bool(spoiler), | |||
"sr": str(self), | |||
"title": title, | |||
"text": text, |
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.
This should be a conditional inclusion. It needs added to the for-loop on 1367.
@@ -1496,11 +1493,15 @@ def submit_image( | |||
"spoiler": bool(spoiler), | |||
"validate_on_submit": self._reddit.validate_on_submit, | |||
} | |||
# Check if text is provided and add to data dictionary | |||
if text: | |||
data["text"] = text |
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.
Add to for-loop below.
@@ -1715,6 +1716,7 @@ def submit_video( | |||
"resubmit": bool(resubmit), | |||
"sendreplies": bool(send_replies), | |||
"title": title, | |||
"text": text, # Add the new 'text' parameter to the data dict |
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.
Like I mentioned above, this needs added to the for-loop.
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. |
This PR was closed because it has been stale for 30 days with no activity. |
This PR was closed because it has been stale for 30 days with no activity. |
Fixes #1965
Feature Summary and Justification
This adds the ability to include text for the following post types:
image
video
gallery