mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
REFACTOR: Remove _.findIndex
This commit is contained in:
parent
e3ec7b72d0
commit
2353794a30
@ -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 =
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user