Merge remote-tracking branch 'origin/develop' into websocket-fixes
* origin/develop: (119 commits) Apply 1 suggestion(s) to 1 file(s) Make it possible to localize user highlight options remove shoutbox test hacks fix shoutbox header, use custom scroll-to-bottom system, remove vue-chat-scroll, temporarily add chat test hack update changelog with 2.3.0 change icons around Translated using Weblate (Japanese) Update timeline_quick_settings.js add screen_name_ui to tests separate screen_name and screen_name_ui with decoded punycode Update CHANGELOG.md add basic validation for statusless status notifications changelog mention fix chat unread badge update shelljs to get rid of warnings on build save a few characters focus input in emoji picker and react picker fix vue warnings add only to wording basic loggedin check for reply filtering ...
This commit is contained in:
commit
2e7bd99444
89 changed files with 2193 additions and 628 deletions
|
@ -48,6 +48,22 @@ const deleteMessage = (storage, messageId) => {
|
|||
}
|
||||
}
|
||||
|
||||
const cullOlderMessages = (storage) => {
|
||||
const maxIndex = storage.messages.length
|
||||
const minIndex = maxIndex - 50
|
||||
if (maxIndex <= 50) return
|
||||
|
||||
storage.messages = _.sortBy(storage.messages, ['id'])
|
||||
storage.minId = storage.messages[minIndex].id
|
||||
for (const message of storage.messages) {
|
||||
if (message.id < storage.minId) {
|
||||
delete storage.idIndex[message.id]
|
||||
delete storage.idempotencyKeyIndex[message.idempotency_key]
|
||||
}
|
||||
}
|
||||
storage.messages = storage.messages.slice(minIndex, maxIndex)
|
||||
}
|
||||
|
||||
const handleMessageError = (storage, fakeId, isRetry) => {
|
||||
if (!storage) { return }
|
||||
const fakeMessage = storage.idIndex[fakeId]
|
||||
|
@ -201,6 +217,7 @@ const ChatService = {
|
|||
empty,
|
||||
getView,
|
||||
deleteMessage,
|
||||
cullOlderMessages,
|
||||
resetNewMessageCount,
|
||||
clear,
|
||||
handleMessageError
|
||||
|
|
|
@ -188,7 +188,12 @@ export const parseUser = (data) => {
|
|||
output.follow_request_count = data.pleroma.follow_request_count
|
||||
|
||||
output.tags = data.pleroma.tags
|
||||
output.deactivated = data.pleroma.deactivated
|
||||
|
||||
// deactivated was changed to is_active in Pleroma 2.3.0
|
||||
// so check if is_active is present
|
||||
output.deactivated = typeof data.pleroma.is_active !== 'undefined'
|
||||
? !data.pleroma.is_active // new backend
|
||||
: data.pleroma.deactivated // old backend
|
||||
|
||||
output.notification_settings = data.pleroma.notification_settings
|
||||
output.unread_chat_count = data.pleroma.unread_chat_count
|
||||
|
@ -198,7 +203,8 @@ export const parseUser = (data) => {
|
|||
output.rights = output.rights || {}
|
||||
output.notification_settings = output.notification_settings || {}
|
||||
|
||||
// Convert punycode to unicode
|
||||
// Convert punycode to unicode for UI
|
||||
output.screen_name_ui = output.screen_name
|
||||
if (output.screen_name.includes('@')) {
|
||||
const parts = output.screen_name.split('@')
|
||||
let unicodeDomain = punycode.toUnicode(parts[1])
|
||||
|
@ -206,7 +212,7 @@ export const parseUser = (data) => {
|
|||
// Add some identifier so users can potentially spot spoofing attempts:
|
||||
// lain.com and xn--lin-6cd.com would appear identical otherwise.
|
||||
unicodeDomain = '🌏' + unicodeDomain
|
||||
output.screen_name = [parts[0], unicodeDomain].join('@')
|
||||
output.screen_name_ui = [parts[0], unicodeDomain].join('@')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
src/services/locale/locale.service.js
Normal file
12
src/services/locale/locale.service.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const specialLanguageCodes = {
|
||||
'ja_easy': 'ja',
|
||||
'zh_Hant': 'zh-HANT'
|
||||
}
|
||||
|
||||
const internalToBrowserLocale = code => specialLanguageCodes[code] || code
|
||||
|
||||
const localeService = {
|
||||
internalToBrowserLocale
|
||||
}
|
||||
|
||||
export default localeService
|
|
@ -22,6 +22,13 @@ const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reactio
|
|||
|
||||
export const isStatusNotification = (type) => includes(statusNotifications, type)
|
||||
|
||||
export const isValidNotification = (notification) => {
|
||||
if (isStatusNotification(notification.type) && !notification.status) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const sortById = (a, b) => {
|
||||
const seqA = Number(a.id)
|
||||
const seqB = Number(b.id)
|
||||
|
|
|
@ -242,9 +242,18 @@ export const generateShadows = (input, colors) => {
|
|||
panelHeader: 'panel',
|
||||
input: 'input'
|
||||
}
|
||||
const inputShadows = input.shadows && !input.themeEngineVersion
|
||||
? shadows2to3(input.shadows, input.opacity)
|
||||
: input.shadows || {}
|
||||
|
||||
const cleanInputShadows = Object.fromEntries(
|
||||
Object.entries(input.shadows || {})
|
||||
.map(([name, shadowSlot]) => [
|
||||
name,
|
||||
// defaulting color to black to avoid potential problems
|
||||
shadowSlot.map(shadowDef => ({ color: '#000000', ...shadowDef }))
|
||||
])
|
||||
)
|
||||
const inputShadows = cleanInputShadows && !input.themeEngineVersion
|
||||
? shadows2to3(cleanInputShadows, input.opacity)
|
||||
: cleanInputShadows || {}
|
||||
const shadows = Object.entries({
|
||||
...DEFAULT_SHADOWS,
|
||||
...inputShadows
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue