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

Manage subscriptions#392

Open
woorst wants to merge 4 commits into
michael-lazar:masterfrom
woorst:manage_subscriptions2
Open

Manage subscriptions#392
woorst wants to merge 4 commits into
michael-lazar:masterfrom
woorst:manage_subscriptions2

Conversation

@woorst

@woorst woorst commented Jul 13, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@michael-lazar

Copy link
Copy Markdown
Owner

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

@woorst

woorst commented Jul 27, 2017

Copy link
Copy Markdown
Contributor Author

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

Comment thread CONTROLS.rst

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

``programming/python+ruby+haskell``

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Documentation looks great!

Comment thread rtv/content.py
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
Copy Markdown
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 = []

if self.config.https_proxy:
self.http.proxies['https'] = self.config.https_proxy
self.modhash = None
self.modhash = ''

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

"""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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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'

Comment thread rtv/subscription_page.py
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
Copy Markdown
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
Copy Markdown
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.

Comment thread rtv/subscription_page.py
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
Copy Markdown
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

Comment thread rtv/subscription_page.py
self.reddit.delete_multireddit(listing.name)
self.refresh_content()
else:
with self.term.loader('Deleting {} from {}'.format(name, context)):

Copy link
Copy Markdown
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 {}"

Comment thread rtv/subscription_page.py
listing.unsubscribe()
self.refresh_content()

@SubscriptionController.register(Command('SUBMISSION_TOGGLE_COMMENT'))

Copy link
Copy Markdown
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

KaKi87 commented Dec 26, 2019

Copy link
Copy Markdown

Hey there,
Any news on this ?
Thanks.

@KaKi87

KaKi87 commented Mar 10, 2020

Copy link
Copy Markdown

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.

3 participants