resolve merge conflicts

This commit is contained in:
Absturztaube 2021-01-08 17:36:47 +01:00
commit a85c1d562c
8 changed files with 36 additions and 7 deletions

View file

@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Follows/Followers tabs on user profiles now display the content properly.
- Handle punycode in screen names
## [2.2.2] - 2020-12-22
### Added

View file

@ -31,6 +31,7 @@
"parse-link-header": "^1.0.1",
"phoenix": "^1.3.0",
"portal-vue": "^2.1.4",
"punycode.js": "^2.1.0",
"v-click-outside": "^2.1.1",
"vue": "^2.6.11",
"vue-chat-scroll": "^1.2.1",

View file

@ -64,7 +64,8 @@ export default {
'ja': 'Japanese (日本語)',
'ja_easy': 'Japanese (やさしいにほんご)',
'en_nyan': 'English (Nyan)',
'zh': 'Chinese (简体中文)'
'zh': 'Simplified Chinese (简体中文)',
'zh_Hant': 'Traditional Chinese (繁體中文)'
}
return specialLanguageNames[code] || ISO6391.getName(code)
}

View file

@ -35,7 +35,8 @@ const loaders = {
ru: () => import('./ru.json'),
te: () => import('./te.json'),
uk: () => import('./uk.json'),
zh: () => import('./zh.json')
zh: () => import('./zh.json'),
zh_Hant: () => import('./zh_Hant.json')
}
const messages = {

View file

@ -127,7 +127,7 @@ const instance = {
imageUrl: false,
replacement: values[key]
}
}).sort((a, b) => a.displayText - b.displayText)
}).sort((a, b) => a.name > b.name ? 1 : -1)
commit('setInstanceOption', { name: 'emoji', value: emoji })
} else {
throw (res)
@ -154,7 +154,7 @@ const instance = {
}
// Technically could use tags but those are kinda useless right now,
// should have been "pack" field, that would be more useful
}).sort((a, b) => a.displayText.toLowerCase() > b.displayText.toLowerCase() ? 1 : 0)
}).sort((a, b) => a.displayText.toLowerCase() > b.displayText.toLowerCase() ? 1 : -1)
commit('setInstanceOption', { name: 'customEmoji', value: emoji })
} else {
throw (res)

View file

@ -1,6 +1,7 @@
import escape from 'escape-html'
import parseLinkHeader from 'parse-link-header'
import { isStatusNotification } from '../notification_utils/notification_utils.js'
import punycode from 'punycode.js'
/** NOTICE! **
* Do not initialize UI-generated data here.
@ -197,6 +198,19 @@ export const parseUser = (data) => {
output.rights = output.rights || {}
output.notification_settings = output.notification_settings || {}
// Convert punycode to unicode
if (output.screen_name.includes('@')) {
const parts = output.screen_name.split('@')
console.log(parts)
let unicodeDomain = punycode.toUnicode(parts[1])
if (unicodeDomain !== parts[1]) {
// 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('@')
}
}
return output
}

View file

@ -311,6 +311,12 @@ describe('API Entities normalizer', () => {
expect(parseUser(user)).to.have.property('hide_followers_count', false)
expect(parseUser(user)).to.have.property('hide_follows_count', true)
})
it('converts IDN to unicode and marks it as internatonal', () => {
const user = makeMockUserMasto({ acct: 'lain@xn--lin-6cd.com' })
expect(parseUser(user)).to.have.property('screen_name').that.equal('lain@🌏lаin.com')
})
})
// We currently use QvitterAPI notifications only, and especially due to MastoAPI lacking is_seen, support for MastoAPI

View file

@ -967,9 +967,9 @@
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
"@types/node@*":
version "14.14.16"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.16.tgz#3cc351f8d48101deadfed4c9e4f116048d437b4b"
integrity sha512-naXYePhweTi+BMv11TgioE2/FXU4fSl29HAH1ffxVciNsH3rYXjNP2yM8wqmSm7jS20gM8TIklKiTen+1iVncw==
version "14.14.19"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.19.tgz#5135176a8330b88ece4e9ab1fdcfc0a545b4bab4"
integrity sha512-4nhBPStMK04rruRVtVc6cDqhu7S9GZai0fpXgPXrFpcPX6Xul8xnrjSdGB4KPBVYG/R5+fXWdCM8qBoiULWGPQ==
"@types/normalize-package-data@^2.4.0":
version "2.4.0"
@ -7129,6 +7129,11 @@ pumpify@^1.3.3:
inherits "^2.0.3"
pump "^2.0.0"
punycode.js@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/punycode.js/-/punycode.js-2.1.0.tgz#f3937f7a914152c2dc17e9c280a2cf86a26b7cda"
integrity sha512-LvGUJ9QHiESLM4yn8JuJWicstRcJKRmP46psQw1HvCZ9puLFwYMKJWvkAkP3OHBVzNzZGx/D53EYJrIaKd9gZQ==
punycode@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"