Skip to content
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

Display gold status in userbar( Closes #1915 ) #3485

Merged
merged 2 commits into from
Oct 24, 2016
Merged

Display gold status in userbar( Closes #1915 ) #3485

merged 2 commits into from
Oct 24, 2016

Conversation

dhaynespls
Copy link
Contributor

@dhaynespls dhaynespls commented Sep 26, 2016

  • new module option: showGold (Display gilded icon if current user has
    gold status)
  • new module function updateUserSpan (If the user has gold and would
    like to, display the gilded-icon in the user span.)
  • basically borrow a bunch of JS from various functions to make
    everything work smoothly.
  • new import needed for nice date on hover
  • also comments for things :)

Screenshot of freshly built plugin:

final-gold-pos

Passes lint & unit tests.

edit:
closes #1915

- new module option: showGold (Display gilded icon if current user has
  gold status)
- new module function updateUserSpan (If the user has gold and would
  like to, display the gilded-icon in the user span.)
- basically borrow a bunch of JS from various functions to make
  everything work smoothly.
- new import needed for nice date on hover
- also comments for things :)
@erikdesjardins erikdesjardins added this to the v5.1.0 milestone Sep 26, 2016
@dhaynespls
Copy link
Contributor Author

Relates to #1915

Copy link
Collaborator

@erikdesjardins erikdesjardins left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM; tested

if (data.gold_expiration) {
const today = new Date();
const expDate = new Date(data.gold_expiration * 1000); // s -> ms
$gilded.attr('title', `Until ${expDate.toDateString()} (${formatDateDiff(today, expDate)})`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: import and use formatDate(expDate) instead of expDate.toDateString() here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing, I pulled that line from accountSwitcher (L231):

https://github.com/honestbleeps/Reddit-Enhancement-Suite/blob/master/lib/modules/accountSwitcher.js#L231

That may need to be modified as well to use formatDate(expDate) instead of toDateString().

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, looks like that needs to be changed. You could open a new PR for that if you want, or I can take care of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take care of it in a separate PR, one sec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--> #3486

@erikdesjardins
Copy link
Collaborator

erikdesjardins commented Sep 26, 2016

FYI if you edit closes #1915 (or similar) into the PR description it'll automatically be closed when this is merged.

- also add appropriate import
@jewel-andraia
Copy link
Collaborator

jewel-andraia commented Oct 2, 2016

Looks good to me! We'll get this merged soon, thanks for the contribution.

@erikdesjardins erikdesjardins merged commit d71943d into honestbleeps:master Oct 24, 2016
@erikdesjardins
Copy link
Collaborator

Thanks!

@dhaynespls dhaynespls deleted the issue1915-showgold branch October 24, 2016 16:38
benmcgarry pushed a commit to benmcgarry/Reddit-Enhancement-Suite that referenced this pull request Nov 4, 2016
…eps#3485)

* Display gold status in userbar( Closes honestbleeps#1915 )

- new module option: showGold (Display gilded icon if current user has
  gold status)
- new module function updateUserSpan (If the user has gold and would
  like to, display the gilded-icon in the user span.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show current user's gold status in user bar
3 participants