Project Information
Repository: https://github.com/stoodkev/SteemPlus
Project Name: SteemPlus
Version: 3.5.0.1
Expected behavior
On busy.org platform, clicking on Pending under SteemPlus -> Rewards -> Curation should show only Paid option.
Actual behavior
Clicking on Pending under SteemPlus -> Rewards -> Curation throws undefined error in console and both Pending and Paid links are displayed with none selected.
How to reproduce
- Install and Enable SteemPlus chrome extension version (3.5.0.1).
- Start on a new tab by typing busy.org. It's important that you start from feed page.
- On busy.org, click the avatar on top right to go to profile.
- Click on the caret next to SteemPlus menu item and select Rewards.
- This should take you rewards page, with author selected.
- Click on Curation.
- You will see Paid and Pending. Page should only show Paid link and as selected. Clicking on Pending shows error in console.
Technical Analysis and Solution
When Curation Rewards tab is clicked, following code executes:
$('.subtypeItem').eq(0).parent().hide();
if (isSteemit) {
$('.subtypeItem').removeClass('active');
$('.subtypeItem').eq(1).addClass('active');
} else if (isBusy) {
$('.subtypeItem').removeClass('UserMenu__item--active');
$('.subtypeItem').eq(1).addClass('UserMenu__item--active');
}
This code is supposed to get 2 items (Pending and Paid) and then remove Pending and select Paid. But following the steps above, $('.subtypeItem') gets 4 items. There is another set of Pending and Paid tabs in code somewhere. To solve this issue, you can remove all DOM elements except last 2.
To remove elements:
if ($('.subtypeItem').length > 2) {
_.forEach($('.subtypeItem'), (elem, idx) => {
if (idx <= $('.subtypeItem').length-2)
$(elem).parent().remove();
})
}
Created a pull request and it has been merged by the PO.
- Browser: Google Chrome ( 69.0.3497.100 Version)
- Operating system: OSX 10.14
- Extension Version: 3.5.0.1
GitHub Account: https://github.com/mightypanda-x
Issue: https://github.com/stoodkev/SteemPlus/issues/178