aboutsummaryrefslogtreecommitdiff
path: root/src/modules/instance.js
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2023-10-29 16:26:05 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2023-10-29 16:26:05 +0000
commitb6accf9e7f7ef5f23cbf8bac57e54cefa0db4620 (patch)
tree91d6db4e663dfa8f94991032220fd415a5612d17 /src/modules/instance.js
parent321a131c20d83b0a7061c2b4600c4d77dec5b7fe (diff)
parentf685f9021bfaff71616efd8e83d114441e69701b (diff)
Merge branch 'develop' into 'master'
Update master branch See merge request pleroma/pleroma-fe!1861
Diffstat (limited to 'src/modules/instance.js')
-rw-r--r--src/modules/instance.js59
1 files changed, 52 insertions, 7 deletions
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 3b15e62e..1ee64552 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -71,6 +71,15 @@ const defaultState = {
hideSitename: false,
hideUserStats: false,
muteBotStatuses: false,
+ modalOnRepeat: false,
+ modalOnUnfollow: false,
+ modalOnBlock: true,
+ modalOnMute: false,
+ modalOnDelete: true,
+ modalOnLogout: true,
+ modalOnApproveFollow: false,
+ modalOnDenyFollow: false,
+ modalOnRemoveUserFromFollowers: false,
loginMethod: 'password',
logo: '/static/logo.svg',
logoMargin: '.2em',
@@ -95,6 +104,7 @@ const defaultState = {
conversationOtherRepliesButton: 'below',
conversationTreeFadeAncestors: false,
maxDepthInThread: 6,
+ autocompleteSelect: false,
// Nasty stuff
customEmoji: [],
@@ -107,14 +117,18 @@ const defaultState = {
restrictedNicknames: [],
safeDM: true,
knownDomains: [],
+ birthdayRequired: false,
+ birthdayMinAge: 0,
// Feature-set, apparently, not everything here is reported...
shoutAvailable: false,
pleromaChatMessagesAvailable: false,
+ pleromaCustomEmojiReactionsAvailable: false,
gopherAvailable: false,
mediaProxyAvailable: false,
suggestionsEnabled: false,
suggestionsWeb: '',
+ quotingAvailable: false,
// Html stuff
instanceSpecificPanelContent: '',
@@ -181,15 +195,28 @@ const instance = {
},
groupedCustomEmojis (state) {
const packsOf = emoji => {
- return emoji.tags
+ const packs = emoji.tags
.filter(k => k.startsWith('pack:'))
- .map(k => k.slice(5)) // remove 'pack:' prefix
+ .map(k => {
+ const packName = k.slice(5) // remove 'pack:' prefix
+ return {
+ id: `custom-${packName}`,
+ text: packName
+ }
+ })
+
+ if (!packs.length) {
+ return [{
+ id: 'unpacked'
+ }]
+ } else {
+ return packs
+ }
}
return state.customEmoji
.reduce((res, emoji) => {
- packsOf(emoji).forEach(packName => {
- const packId = `custom-${packName}`
+ packsOf(emoji).forEach(({ id: packId, text: packName }) => {
if (!res[packId]) {
res[packId] = ({
id: packId,
@@ -273,8 +300,13 @@ const instance = {
langList
.map(async lang => {
if (!state.unicodeEmojiAnnotations[lang]) {
- const annotations = await loadAnnotations(lang)
- commit('setUnicodeEmojiAnnotations', { lang, annotations })
+ try {
+ const annotations = await loadAnnotations(lang)
+ commit('setUnicodeEmojiAnnotations', { lang, annotations })
+ } catch (e) {
+ console.warn(`Error loading unicode emoji annotations for ${lang}: `, e)
+ // ignore
+ }
}
}))
},
@@ -290,9 +322,22 @@ const instance = {
const lb = b.toLowerCase()
return la > lb ? 1 : (la < lb ? -1 : 0)
}
+ const noPackLast = (a, b) => {
+ const aNull = a === ''
+ const bNull = b === ''
+ if (aNull === bNull) {
+ return 0
+ } else if (aNull && !bNull) {
+ return 1
+ } else {
+ return -1
+ }
+ }
const byPackThenByName = (a, b) => {
const packOf = emoji => (emoji.tags.filter(k => k.startsWith('pack:'))[0] || '').slice(5)
- return caseInsensitiveStrCmp(packOf(a), packOf(b)) || caseInsensitiveStrCmp(a.displayText, b.displayText)
+ const packOfA = packOf(a)
+ const packOfB = packOf(b)
+ return noPackLast(packOfA, packOfB) || caseInsensitiveStrCmp(packOfA, packOfB) || caseInsensitiveStrCmp(a.displayText, b.displayText)
}
const emoji = Object.entries(values).map(([key, value]) => {