Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Manage subscriptions #392

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

woorst
Copy link
Contributor

@woorst woorst commented Jul 13, 2017

No description provided.

@michael-lazar
Copy link
Owner

Is this ready to be reviewed or are you still working on it?

@woorst
Copy link
Contributor Author

woorst commented Jul 27, 2017

Yes, this is ready to review. It is just lacking some tests.


When viewing a list of your multireddits you may initialize a new one:

``programming/python+ruby+haskell``
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation looks great!

def from_multireddit(cls, reddit, loader, multi):
items = iter(multi.subreddits)
content = cls('My Multireddit: {}'.format(multi.path), items, loader)
content._multireddit = multi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather not make this a private variable if you intend on accessing it from outside of the instance. Would you be opposed to adding this to the SubscriptionContent class initializer?

    def __init__(self, name, subscriptions, loader, multireddit=None):

        self.name = name
        self.multireddit = multireddit
        self.order = None
        self.query = None
        self._loader = loader
        self._subscriptions = subscriptions
        self._subscription_data = []

@@ -358,7 +358,7 @@ def _req_error(*_, **__):
self.http.proxies['http'] = self.config.http_proxy
if self.config.https_proxy:
self.http.proxies['https'] = self.config.https_proxy
self.modhash = None
self.modhash = ''
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any changes to praw should be made in a separate pull request here https://github.com/praw-dev/praw. That way, the praw test suite will be run against the changes and we can document everything that has diverged from the official release. Whenever changes are made to the praw branch, I run scripts/update_package.py which copies the changes over and updates the commit hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I'll send those changes upstream. I wasn't sure if the older version would be accepting changes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't, my bad. I meant to link here https://github.com/michael-lazar/praw3

@@ -1688,7 +1688,7 @@ def __init__(self, reddit_session, author=None, name=None,
json_dict=None, fetch=False, **kwargs):
"""Construct an instance of the Multireddit object."""
author = six.text_type(author) if author \
else json_dict['path'].split('/')[-3]
else json_dict['path'].split('/')[-4]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this change, is it fixing a bug in praw?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's a bugfix:
author = "/user/multi-mod/m/android".split('/')[-4] = "multi-mod"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> "/user/multi-mod/m/android".split('/')[-4]
'user'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant this (note the trailing slash):

>>> "/user/multi-mod/m/android/".split('/')[-4]
'multi-mod'

name = self.term.prompt_input('Subscribe to: /')
if name is not None:
with self.term.loader('Adding /r/{}'.format(name, context)):
for n in name.split('+'):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is supporting the + format really necessary here? I understand using it for initializing multireddits, but I can't imagine that somebody is going to want to subscribe to more than a single subreddit at once. The reason I bring it up is that the error handling could be a lot clearer (show a terminal notification if the subscription fails) if there is only one subreddit. I worry that silently ignoring invalid subreddits could be seen as an error from the end user's perspective.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really necessary. I just wanted to keep the format consistent with the multireddit initialization syntax. I'm fine with removing it.

name = self.term.prompt_input('Add subreddits(s): /')
if name is not None:
with self.term.loader('Adding /r/{}'.format(name)):
for n in name.split('+'):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as above

self.reddit.delete_multireddit(listing.name)
self.refresh_content()
else:
with self.term.loader('Deleting {} from {}'.format(name, context)):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The language could be more specific here to avoid confusion - "Unsubscribing {} from {}"

listing.unsubscribe()
self.refresh_content()

@SubscriptionController.register(Command('SUBMISSION_TOGGLE_COMMENT'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I think we should add a new binding since SUBMISSION_* is reserved for the submission page. It can still be bound to the space bar (0x20) but it should have a separate definition like SUBSCRIPTION_VIEW_MULTIREDDIT.

@KaKi87
Copy link

KaKi87 commented Dec 26, 2019

Hey there,
Any news on this ?
Thanks.

@KaKi87
Copy link

KaKi87 commented Mar 10, 2020

Any news on this ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants