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

Footer displays 'login' or 'logout' when suitable. #654

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aiden-sobey
Copy link

Fixes issue #647

The correct term (login/logout) is now displayed in the footer, respective of if a user is currently logged in or not.

Note: I'm not a big fan of self.FOOTER being capitalised like a constant because.. well, it's not. But changing this broke functionality in the parent class so I decided to keep the diff small. If desired though I can go through and fix this up, the fix will just get a fair bit more complicated.

The correct term (login/logout) is now displayed on startup and
after logging in or out.
@@ -60,6 +62,12 @@ def refresh_content(self, order=None, name=None):
if not self.term.loader.exception:
self.nav = Navigator(self.content.get)

def reload_footer(self):
Copy link
Owner

Choose a reason for hiding this comment

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

I think this would be a great place to use a property, e.g.

@property
def footer(self):
    if self.reddit.user is None:
        return docs.FOOTER_SUBREDDIT
    else:
        return docs.FOOTER_SUBREDDIT_LOGGED_IN

Then all you would need to do is change the other pages to lowercase, e.g. for the subscription page

footer = docs.FOOTER_SUBSCRIPTION

and update the base class to use self.footer instead of self.FOOTER. I agree that uppercase no longer makes sense, and it was probably a questionable decision when it was added in the first place. If you want to change self.HEADER to lowercase at the same time I'm on board with it.

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

2 participants