Commit 10eb9657 authored by Jason Salyers's avatar Jason Salyers

[JES] Add a check for proper badge type. Apparently the new hivefest badge...

[JES] Add a check for proper badge type. Apparently the new hivefest badge returns a type of hivefest which was an unknown badge type for the condenser, causing it to try and add info to a non-existant array
parent b863817c
......@@ -40,42 +40,58 @@ class SubscriptionsList extends React.Component {
if (hivebuzzBadges) {
hivebuzzBadges.forEach(badge => {
const type = badge.get('type');
badgesTypes[type].push(
<a
className="BadgesAchievements__badge_image"
key={badge.get('id')}
href={`https://hivebuzz.me/@${username}`}
target="_blank"
rel="noopener noreferrer"
>
<img
src={badge.get('url')}
alt={badge.get('title')}
title={badge.get('title')}
/>
</a>
);
let valid = true;
if (
badgesTypes[type] === undefined ||
badgesTypes[type] === null
)
valid = false;
if (valid) {
badgesTypes[type].push(
<a
className="BadgesAchievements__badge_image"
key={badge.get('id')}
href={`https://hivebuzz.me/@${username}`}
target="_blank"
rel="noopener noreferrer"
>
<img
src={badge.get('url')}
alt={badge.get('title')}
title={badge.get('title')}
/>
</a>
);
}
});
}
if (peakdBadges) {
peakdBadges.forEach(badge => {
const type = badge.get('type');
badgesTypes[type].push(
<a
className="BadgesAchievements__badge_image"
key={badge.get('id')}
href={`https://peakd.com/b/${badge.get('name')}`}
target="_blank"
rel="noopener noreferrer"
>
<img
src={badge.get('url')}
alt={badge.get('title')}
title={badge.get('title')}
className="UserProfile__badge_image"
/>
</a>
);
let valid = true;
if (
badgesTypes[type] === undefined ||
badgesTypes[type] === null
)
valid = false;
if (valid) {
badgesTypes[type].push(
<a
className="BadgesAchievements__badge_image"
key={badge.get('id')}
href={`https://peakd.com/b/${badge.get('name')}`}
target="_blank"
rel="noopener noreferrer"
>
<img
src={badge.get('url')}
alt={badge.get('title')}
title={badge.get('title')}
className="UserProfile__badge_image"
/>
</a>
);
}
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment