This commit is contained in:
Henry Jameson 2026-08-04 19:55:44 +03:00
commit 7b4eb25fc8
18 changed files with 24 additions and 25 deletions

View file

@ -35,7 +35,7 @@ const getAllAccessibleAnnotations = async (projectRoot) => {
}), }),
) )
) )
.filter((k) => k) .filter(Boolean)
.join(',\n') .join(',\n')
return ` return `

View file

@ -18,7 +18,7 @@ export const chats = ({ credentials }) =>
url: PLEROMA_CHATS_URL, url: PLEROMA_CHATS_URL,
credentials, credentials,
}).then(({ data }) => ({ }).then(({ data }) => ({
data: data.map(parseChat).filter((c) => c), data: data.map(parseChat).filter(Boolean),
})) }))
export const getOrCreateChat = ({ accountId, credentials }) => export const getOrCreateChat = ({ accountId, credentials }) =>
@ -40,7 +40,7 @@ export const chatMessages = ({
method: 'GET', method: 'GET',
credentials, credentials,
}).then(({ data }) => ({ }).then(({ data }) => ({
data: data.map(parseChatMessage).filter((c) => c), data: data.map(parseChatMessage).filter(Boolean),
})) }))
} }

View file

@ -62,7 +62,7 @@ const sortAndFilterConversation = (conversation, statusoid) => {
} else { } else {
conversation = filter(conversation, (status) => status.type !== 'retweet') conversation = filter(conversation, (status) => status.type !== 'retweet')
} }
return conversation.filter((_) => _).sort(sortById) return conversation.filter(Boolean).sort(sortById)
} }
const conversation = { const conversation = {

View file

@ -188,8 +188,8 @@ const EmojiInput = {
} }
return { return {
names: names.filter((k) => k), names: names.filter(Boolean),
keywords: keywords.filter((k) => k), keywords: keywords.filter(Boolean),
} }
} }
}, },

View file

@ -57,7 +57,7 @@ const maybeLocalizedKeywords = (emoji, languages, nameLocalizer) => {
languages.forEach((lang) => { languages.forEach((lang) => {
const keywords = emoji.annotations[lang]?.keywords || [] const keywords = emoji.annotations[lang]?.keywords || []
const name = emoji.annotations[lang]?.name const name = emoji.annotations[lang]?.name
res.push(...keywords.concat([name]).filter((k) => k)) res.push(...keywords.concat([name]).filter(Boolean))
}) })
} }
return res return res

View file

@ -35,7 +35,7 @@ export default {
'sans-serif', 'sans-serif',
'monospace', 'monospace',
...(this.options || []), ...(this.options || []),
].filter((_) => _), ].filter(Boolean),
} }
}, },
methods: { methods: {

View file

@ -59,12 +59,12 @@ const ListsNew = {
membersUsers() { membersUsers() {
return [...this.membersUserIds, ...this.addedUserIds] return [...this.membersUserIds, ...this.addedUserIds]
.map((userId) => this.findUser(userId)) .map((userId) => this.findUser(userId))
.filter((user) => user) .filter(Boolean)
}, },
searchUsers() { searchUsers() {
return this.searchUserIds return this.searchUserIds
.map((userId) => this.findUser(userId)) .map((userId) => this.findUser(userId))
.filter((user) => user) .filter(Boolean)
}, },
...mapState({ ...mapState({
currentUser: (state) => state.users.currentUser, currentUser: (state) => state.users.currentUser,

View file

@ -128,7 +128,7 @@ const registration = {
this.user.captcha_answer_data = this.captcha.answer_data this.user.captcha_answer_data = this.captcha.answer_data
if (this.user.language) { if (this.user.language) {
this.user.language = localeService.internalToBackendLocaleMulti( this.user.language = localeService.internalToBackendLocaleMulti(
this.user.language.filter((k) => k), this.user.language.filter(Boolean),
) )
} }

View file

@ -381,13 +381,13 @@ export default {
x ? 'mfm-spinX' : null, x ? 'mfm-spinX' : null,
y ? 'mfm-spinY' : null, y ? 'mfm-spinY' : null,
'mfm-spin', 'mfm-spin',
].filter((a) => a)[0] ].filter(Boolean)[0]
const direction = [ const direction = [
alternate ? 'alternate' : null, alternate ? 'alternate' : null,
left ? 'reverse' : null, left ? 'reverse' : null,
'normal', 'normal',
].filter((a) => a)[0] ].filter(Boolean)[0]
newAttrs.style = [ newAttrs.style = [
`animation-name: ${anim}`, `animation-name: ${anim}`,

View file

@ -33,7 +33,7 @@ export default {
} else if (this.truncate > 1) { } else if (this.truncate > 1) {
return Math.trunc(e.target.value / this.truncate) * this.truncate return Math.trunc(e.target.value / this.truncate) * this.truncate
} }
return parseFloat(e.target.value) return Number.parseFloat(e.target.value)
}, },
}, },
} }

View file

@ -67,7 +67,7 @@ export default {
return this.$t(['settings', 'units', this.unitSet, value].join('.')) return this.$t(['settings', 'units', this.unitSet, value].join('.'))
}, },
updateValue(e) { 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) { updateUnit(e) {
let value = this.stateValue let value = this.stateValue

View file

@ -262,7 +262,7 @@ const Status = {
this.muteFilterHits.length > 0 ? 'filtered' : null, this.muteFilterHits.length > 0 ? 'filtered' : null,
this.muteBotStatuses && this.botStatus ? 'bot' : null, this.muteBotStatuses && this.botStatus ? 'bot' : null,
this.muteSensitiveStatuses && this.sensitiveStatus ? 'nsfw' : null, this.muteSensitiveStatuses && this.sensitiveStatus ? 'nsfw' : null,
].filter((_) => _) ].filter(Boolean)
}, },
muteLocalized() { muteLocalized() {
if (this.muteReasons.length === 0) return null if (this.muteReasons.length === 0) return null

View file

@ -525,7 +525,7 @@ export const mutations = {
}, },
addRepeats(state, { id, rebloggedByUsers, currentUser }) { addRepeats(state, { id, rebloggedByUsers, currentUser }) {
const newStatus = state.allStatusesObject[id] 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 // 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.repeat_num = newStatus.rebloggedBy.length
newStatus.repeated = !!newStatus.rebloggedBy.find( newStatus.repeated = !!newStatus.rebloggedBy.find(
@ -534,7 +534,7 @@ export const mutations = {
}, },
addFavs(state, { id, favoritedByUsers, currentUser }) { addFavs(state, { id, favoritedByUsers, currentUser }) {
const newStatus = state.allStatusesObject[id] 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 // 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.fave_num = newStatus.favoritedBy.length
newStatus.favorited = !!newStatus.favoritedBy.find( newStatus.favorited = !!newStatus.favoritedBy.find(
@ -879,7 +879,7 @@ const statuses = {
store.commit('addNewUsers', data.accounts) store.commit('addNewUsers', data.accounts)
store.commit( store.commit(
'addNewUsers', 'addNewUsers',
data.statuses.map((s) => s.user).filter((u) => u), data.statuses.map((s) => s.user).filter(Boolean),
) )
store.commit('addNewStatuses', { store.commit('addNewStatuses', {
statuses: data.statuses, statuses: data.statuses,

View file

@ -635,7 +635,7 @@ const users = {
}, },
addNewNotifications(store, { notifications }) { addNewNotifications(store, { notifications }) {
const users = map(notifications, 'from_profile') const users = map(notifications, 'from_profile')
const targetUsers = map(notifications, 'target').filter((_) => _) const targetUsers = map(notifications, 'target').filter(Boolean)
const notificationIds = notifications.map((_) => _.id) const notificationIds = notifications.map((_) => _.id)
store.commit('addNewUsers', users) store.commit('addNewUsers', users)
store.commit('addNewUsers', targetUsers) store.commit('addNewUsers', targetUsers)

View file

@ -25,7 +25,7 @@ const visibleTypes = (notificationVisibility) => {
notificationVisibility.emojiReactions && 'pleroma:emoji_reaction', notificationVisibility.emojiReactions && 'pleroma:emoji_reaction',
notificationVisibility.reports && 'pleroma:report', notificationVisibility.reports && 'pleroma:report',
notificationVisibility.polls && 'poll', notificationVisibility.polls && 'poll',
].filter((_) => _) ].filter(Boolean)
} }
const statusNotifications = new Set([ 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 // map is just to clone the array since sort mutates it and it causes some issues
const sortedNotifications = notificationsFromStore(store) const sortedNotifications = notificationsFromStore(store)
.map((_) => _)
.sort(sortById) .sort(sortById)
// TODO implement sorting elsewhere and make it optional // TODO implement sorting elsewhere and make it optional
return sortedNotifications.filter((notification) => return sortedNotifications.filter((notification) =>

View file

@ -88,5 +88,5 @@ export const muteFilterHits = (muteFilters, status) => {
} }
} }
}) })
.filter((_) => _) .filter(Boolean)
} }

View file

@ -61,7 +61,7 @@ export const useChatsStore = defineStore('chats', {
addNewChats(chats) { addNewChats(chats) {
window.vuex.commit( window.vuex.commit(
'addNewUsers', 'addNewUsers',
chats.map((k) => k.account).filter((k) => k), chats.map((k) => k.account).filter(Boolean),
) )
chats.forEach((updatedChat) => { chats.forEach((updatedChat) => {

View file

@ -836,7 +836,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
: [path, finalValue] : [path, finalValue]
}) })
newState.prefsStorage.simple = Object.fromEntries( newState.prefsStorage.simple = Object.fromEntries(
newEntries.filter((_) => _), newEntries.filter(Boolean),
) )
return newState return newState
}, },