REFACTOR: Remove _.findIndex

This commit is contained in:
Robin Ward 2020-08-31 16:50:21 -04:00
parent e3ec7b72d0
commit 2353794a30
2 changed files with 5 additions and 6 deletions

View File

@ -68,16 +68,15 @@ export default {
if (stale && stale.hasResults && lastNotification) {
const oldNotifications = stale.results.get("content");
const staleIndex = _.findIndex(oldNotifications, {
id: lastNotification.id
});
const staleIndex = oldNotifications.findIndex(
n => n.id === lastNotification.id
);
if (staleIndex === -1) {
// this gets a bit tricky, unread pms are bumped to front
let insertPosition = 0;
if (lastNotification.notification_type !== 6) {
insertPosition = _.findIndex(
oldNotifications,
insertPosition = oldNotifications.findIndex(
n => n.notification_type !== 6 || n.read
);
insertPosition =

View File

@ -46,7 +46,7 @@ export function setTopicId(topicId) {
function currentIndex() {
if (currentTopicId && model && model.topics) {
const idx = _.findIndex(model.topics, t => t.id === currentTopicId);
const idx = model.topics.findIndex(t => t.id === currentTopicId);
if (idx > -1) {
return idx;
}