confirm modal + lint
This commit is contained in:
parent
1ee18a7fa3
commit
0eb652f95f
41 changed files with 182 additions and 131 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { maxBy, minBy } from 'lodash'
|
||||
import { maxBy, minBy, orderBy, sortBy, uniqueId } from 'lodash'
|
||||
|
||||
const empty = (chatId) => {
|
||||
return {
|
||||
|
|
@ -57,7 +57,7 @@ const cullOlderMessages = (storage) => {
|
|||
const minIndex = maxIndex - 50
|
||||
if (maxIndex <= 50) return
|
||||
|
||||
storage.messages = _.sortBy(storage.messages, ['id'])
|
||||
storage.messages = sortBy(storage.messages, ['id'])
|
||||
storage.minId = storage.messages[minIndex].id
|
||||
for (const message of storage.messages) {
|
||||
if (message.id < storage.minId) {
|
||||
|
|
@ -78,7 +78,7 @@ const handleMessageError = (storage, fakeId, isRetry) => {
|
|||
fakeMessage.pending = false
|
||||
if (!isRetry) {
|
||||
// Ensure the failed message doesn't stay at the bottom of the list.
|
||||
const lastPersistedMessage = _.orderBy(
|
||||
const lastPersistedMessage = orderBy(
|
||||
storage.messages,
|
||||
['pending', 'id'],
|
||||
['asc', 'desc'],
|
||||
|
|
@ -166,11 +166,7 @@ const getView = (storage) => {
|
|||
}
|
||||
|
||||
const result = []
|
||||
const messages = _.orderBy(
|
||||
storage.messages,
|
||||
['pending', 'id'],
|
||||
['asc', 'asc'],
|
||||
)
|
||||
const messages = orderBy(storage.messages, ['pending', 'id'], ['asc', 'asc'])
|
||||
const firstMessage = messages[0]
|
||||
let previousMessage = messages[messages.length - 1]
|
||||
let currentMessageChainId
|
||||
|
|
@ -228,7 +224,7 @@ const getView = (storage) => {
|
|||
previousMessage.data.account_id) !== message.account_id ||
|
||||
afterDate
|
||||
) {
|
||||
currentMessageChainId = _.uniqueId()
|
||||
currentMessageChainId = uniqueId()
|
||||
object.isHead = true
|
||||
object.messageChainId = currentMessageChainId
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,10 +87,7 @@ export const maybeShowNotification = (
|
|||
)
|
||||
return
|
||||
|
||||
const notificationObject = prepareNotificationObject(
|
||||
notification,
|
||||
i18n,
|
||||
)
|
||||
const notificationObject = prepareNotificationObject(notification, i18n)
|
||||
showDesktopNotification(rootState, notificationObject)
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +190,11 @@ export const prepareNotificationObject = (notification, i18n) => {
|
|||
return notifObj
|
||||
}
|
||||
|
||||
export const countExtraNotifications = (store, mergedConfig, unreadAnnouncementCount) => {
|
||||
export const countExtraNotifications = (
|
||||
store,
|
||||
mergedConfig,
|
||||
unreadAnnouncementCount,
|
||||
) => {
|
||||
const rootGetters = store.rootGetters || store.getters
|
||||
|
||||
if (!mergedConfig.showExtraNotifications) {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ function isPushSupported() {
|
|||
function getOrCreateServiceWorker() {
|
||||
if (!isSWSupported()) return
|
||||
const swType = process.env.HAS_MODULE_SERVICE_WORKER ? 'module' : 'classic'
|
||||
return navigator
|
||||
.serviceWorker
|
||||
return navigator.serviceWorker
|
||||
.register('/sw-pleroma.js', { type: swType })
|
||||
.catch((err) =>
|
||||
console.error('Unable to get or create a service worker.', err),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue