cleanup
This commit is contained in:
parent
f7acfe3f59
commit
7b4eb25fc8
18 changed files with 24 additions and 25 deletions
|
|
@ -35,7 +35,7 @@ const getAllAccessibleAnnotations = async (projectRoot) => {
|
|||
}),
|
||||
)
|
||||
)
|
||||
.filter((k) => k)
|
||||
.filter(Boolean)
|
||||
.join(',\n')
|
||||
|
||||
return `
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const chats = ({ credentials }) =>
|
|||
url: PLEROMA_CHATS_URL,
|
||||
credentials,
|
||||
}).then(({ data }) => ({
|
||||
data: data.map(parseChat).filter((c) => c),
|
||||
data: data.map(parseChat).filter(Boolean),
|
||||
}))
|
||||
|
||||
export const getOrCreateChat = ({ accountId, credentials }) =>
|
||||
|
|
@ -40,7 +40,7 @@ export const chatMessages = ({
|
|||
method: 'GET',
|
||||
credentials,
|
||||
}).then(({ data }) => ({
|
||||
data: data.map(parseChatMessage).filter((c) => c),
|
||||
data: data.map(parseChatMessage).filter(Boolean),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ const sortAndFilterConversation = (conversation, statusoid) => {
|
|||
} else {
|
||||
conversation = filter(conversation, (status) => status.type !== 'retweet')
|
||||
}
|
||||
return conversation.filter((_) => _).sort(sortById)
|
||||
return conversation.filter(Boolean).sort(sortById)
|
||||
}
|
||||
|
||||
const conversation = {
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ const EmojiInput = {
|
|||
}
|
||||
|
||||
return {
|
||||
names: names.filter((k) => k),
|
||||
keywords: keywords.filter((k) => k),
|
||||
names: names.filter(Boolean),
|
||||
keywords: keywords.filter(Boolean),
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ const maybeLocalizedKeywords = (emoji, languages, nameLocalizer) => {
|
|||
languages.forEach((lang) => {
|
||||
const keywords = emoji.annotations[lang]?.keywords || []
|
||||
const name = emoji.annotations[lang]?.name
|
||||
res.push(...keywords.concat([name]).filter((k) => k))
|
||||
res.push(...keywords.concat([name]).filter(Boolean))
|
||||
})
|
||||
}
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default {
|
|||
'sans-serif',
|
||||
'monospace',
|
||||
...(this.options || []),
|
||||
].filter((_) => _),
|
||||
].filter(Boolean),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@ const ListsNew = {
|
|||
membersUsers() {
|
||||
return [...this.membersUserIds, ...this.addedUserIds]
|
||||
.map((userId) => this.findUser(userId))
|
||||
.filter((user) => user)
|
||||
.filter(Boolean)
|
||||
},
|
||||
searchUsers() {
|
||||
return this.searchUserIds
|
||||
.map((userId) => this.findUser(userId))
|
||||
.filter((user) => user)
|
||||
.filter(Boolean)
|
||||
},
|
||||
...mapState({
|
||||
currentUser: (state) => state.users.currentUser,
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ const registration = {
|
|||
this.user.captcha_answer_data = this.captcha.answer_data
|
||||
if (this.user.language) {
|
||||
this.user.language = localeService.internalToBackendLocaleMulti(
|
||||
this.user.language.filter((k) => k),
|
||||
this.user.language.filter(Boolean),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -381,13 +381,13 @@ export default {
|
|||
x ? 'mfm-spinX' : null,
|
||||
y ? 'mfm-spinY' : null,
|
||||
'mfm-spin',
|
||||
].filter((a) => a)[0]
|
||||
].filter(Boolean)[0]
|
||||
|
||||
const direction = [
|
||||
alternate ? 'alternate' : null,
|
||||
left ? 'reverse' : null,
|
||||
'normal',
|
||||
].filter((a) => a)[0]
|
||||
].filter(Boolean)[0]
|
||||
|
||||
newAttrs.style = [
|
||||
`animation-name: ${anim}`,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default {
|
|||
} else if (this.truncate > 1) {
|
||||
return Math.trunc(e.target.value / this.truncate) * this.truncate
|
||||
}
|
||||
return parseFloat(e.target.value)
|
||||
return Number.parseFloat(e.target.value)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default {
|
|||
return this.$t(['settings', 'units', this.unitSet, value].join('.'))
|
||||
},
|
||||
updateValue(e) {
|
||||
this.configSink(this.path, parseFloat(e.target.value) + this.stateUnit)
|
||||
this.configSink(this.path, Number.parseFloat(e.target.value) + this.stateUnit)
|
||||
},
|
||||
updateUnit(e) {
|
||||
let value = this.stateValue
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ const Status = {
|
|||
this.muteFilterHits.length > 0 ? 'filtered' : null,
|
||||
this.muteBotStatuses && this.botStatus ? 'bot' : null,
|
||||
this.muteSensitiveStatuses && this.sensitiveStatus ? 'nsfw' : null,
|
||||
].filter((_) => _)
|
||||
].filter(Boolean)
|
||||
},
|
||||
muteLocalized() {
|
||||
if (this.muteReasons.length === 0) return null
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ export const mutations = {
|
|||
},
|
||||
addRepeats(state, { id, rebloggedByUsers, currentUser }) {
|
||||
const newStatus = state.allStatusesObject[id]
|
||||
newStatus.rebloggedBy = rebloggedByUsers.filter((_) => _)
|
||||
newStatus.rebloggedBy = rebloggedByUsers.filter(Boolean)
|
||||
// repeats stats can be incorrect based on polling condition, let's update them using the most recent data
|
||||
newStatus.repeat_num = newStatus.rebloggedBy.length
|
||||
newStatus.repeated = !!newStatus.rebloggedBy.find(
|
||||
|
|
@ -534,7 +534,7 @@ export const mutations = {
|
|||
},
|
||||
addFavs(state, { id, favoritedByUsers, currentUser }) {
|
||||
const newStatus = state.allStatusesObject[id]
|
||||
newStatus.favoritedBy = favoritedByUsers.filter((_) => _)
|
||||
newStatus.favoritedBy = favoritedByUsers.filter(Boolean)
|
||||
// favorites stats can be incorrect based on polling condition, let's update them using the most recent data
|
||||
newStatus.fave_num = newStatus.favoritedBy.length
|
||||
newStatus.favorited = !!newStatus.favoritedBy.find(
|
||||
|
|
@ -879,7 +879,7 @@ const statuses = {
|
|||
store.commit('addNewUsers', data.accounts)
|
||||
store.commit(
|
||||
'addNewUsers',
|
||||
data.statuses.map((s) => s.user).filter((u) => u),
|
||||
data.statuses.map((s) => s.user).filter(Boolean),
|
||||
)
|
||||
store.commit('addNewStatuses', {
|
||||
statuses: data.statuses,
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ const users = {
|
|||
},
|
||||
addNewNotifications(store, { notifications }) {
|
||||
const users = map(notifications, 'from_profile')
|
||||
const targetUsers = map(notifications, 'target').filter((_) => _)
|
||||
const targetUsers = map(notifications, 'target').filter(Boolean)
|
||||
const notificationIds = notifications.map((_) => _.id)
|
||||
store.commit('addNewUsers', users)
|
||||
store.commit('addNewUsers', targetUsers)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const visibleTypes = (notificationVisibility) => {
|
|||
notificationVisibility.emojiReactions && 'pleroma:emoji_reaction',
|
||||
notificationVisibility.reports && 'pleroma:report',
|
||||
notificationVisibility.polls && 'poll',
|
||||
].filter((_) => _)
|
||||
].filter(Boolean)
|
||||
}
|
||||
|
||||
const statusNotifications = new Set([
|
||||
|
|
@ -96,7 +96,6 @@ export const filteredNotificationsFromStore = (
|
|||
) => {
|
||||
// map is just to clone the array since sort mutates it and it causes some issues
|
||||
const sortedNotifications = notificationsFromStore(store)
|
||||
.map((_) => _)
|
||||
.sort(sortById)
|
||||
// TODO implement sorting elsewhere and make it optional
|
||||
return sortedNotifications.filter((notification) =>
|
||||
|
|
|
|||
|
|
@ -88,5 +88,5 @@ export const muteFilterHits = (muteFilters, status) => {
|
|||
}
|
||||
}
|
||||
})
|
||||
.filter((_) => _)
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export const useChatsStore = defineStore('chats', {
|
|||
addNewChats(chats) {
|
||||
window.vuex.commit(
|
||||
'addNewUsers',
|
||||
chats.map((k) => k.account).filter((k) => k),
|
||||
chats.map((k) => k.account).filter(Boolean),
|
||||
)
|
||||
|
||||
chats.forEach((updatedChat) => {
|
||||
|
|
|
|||
|
|
@ -836,7 +836,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
|||
: [path, finalValue]
|
||||
})
|
||||
newState.prefsStorage.simple = Object.fromEntries(
|
||||
newEntries.filter((_) => _),
|
||||
newEntries.filter(Boolean),
|
||||
)
|
||||
return newState
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue