lint
This commit is contained in:
parent
5ea3d462b9
commit
95bbe73832
19 changed files with 38 additions and 58 deletions
|
|
@ -29,8 +29,8 @@ const Announcement = {
|
||||||
currentUser: (state) => state.users.currentUser,
|
currentUser: (state) => state.users.currentUser,
|
||||||
}),
|
}),
|
||||||
canEditAnnouncement() {
|
canEditAnnouncement() {
|
||||||
return (
|
return this.currentUser?.privileges.has(
|
||||||
this.currentUser?.privileges.has('announcements_manage_announcements')
|
'announcements_manage_announcements',
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
content() {
|
content() {
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ const AnnouncementsPage = {
|
||||||
return useAnnouncementsStore().announcements
|
return useAnnouncementsStore().announcements
|
||||||
},
|
},
|
||||||
canPostAnnouncement() {
|
canPostAnnouncement() {
|
||||||
return (
|
return this.currentUser?.privileges.has(
|
||||||
this.currentUser?.privileges.has('announcements_manage_announcements')
|
'announcements_manage_announcements',
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,7 @@ const EditStatusModal = {
|
||||||
},
|
},
|
||||||
isFormVisible(val) {
|
isFormVisible(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.$nextTick(
|
this.$nextTick(() => this.$el?.querySelector('textarea').focus())
|
||||||
() => this.$el?.querySelector('textarea').focus(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,7 @@ const MentionLink = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
user() {
|
user() {
|
||||||
return (
|
return this.url && this.$store?.getters.findUserByUrl(this.url)
|
||||||
this.url && this.$store?.getters.findUserByUrl(this.url)
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
isYou() {
|
isYou() {
|
||||||
// FIXME why user !== currentUser???
|
// FIXME why user !== currentUser???
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ export const filterNavigation = (
|
||||||
if (!isFederating && set.has('federating')) return false
|
if (!isFederating && set.has('federating')) return false
|
||||||
if (!currentUser && isPrivate && set.has('!private')) return false
|
if (!currentUser && isPrivate && set.has('!private')) return false
|
||||||
if (!currentUser && !(anon || anonRoute)) return false
|
if (!currentUser && !(anon || anonRoute)) return false
|
||||||
if ((!currentUser?.locked) && set.has('lockedUser'))
|
if (!currentUser?.locked && set.has('lockedUser')) return false
|
||||||
return false
|
|
||||||
if (!hasChats && set.has('chats')) return false
|
if (!hasChats && set.has('chats')) return false
|
||||||
if (!hasAnnouncements && set.has('announcements')) return false
|
if (!hasAnnouncements && set.has('announcements')) return false
|
||||||
if (!supportsBubbleTimeline && set.has('supportsBubbleTimeline'))
|
if (!supportsBubbleTimeline && set.has('supportsBubbleTimeline'))
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,13 @@ export default {
|
||||||
return storePoll || {}
|
return storePoll || {}
|
||||||
},
|
},
|
||||||
options() {
|
options() {
|
||||||
return (this.poll?.options) || []
|
return this.poll?.options || []
|
||||||
},
|
},
|
||||||
expiresAt() {
|
expiresAt() {
|
||||||
return (this.poll?.expires_at) || null
|
return this.poll?.expires_at || null
|
||||||
},
|
},
|
||||||
expired() {
|
expired() {
|
||||||
return (this.poll?.expired) || false
|
return this.poll?.expired || false
|
||||||
},
|
},
|
||||||
expirationLabel() {
|
expirationLabel() {
|
||||||
if (useMergedConfigStore().mergedConfig.useAbsoluteTimeFormat) {
|
if (useMergedConfigStore().mergedConfig.useAbsoluteTimeFormat) {
|
||||||
|
|
|
||||||
|
|
@ -129,9 +129,7 @@ const Popover = {
|
||||||
// Popover will be anchored around this element, trigger ref is the container, so
|
// Popover will be anchored around this element, trigger ref is the container, so
|
||||||
// its children are what are inside the slot. Expect only one v-slot:trigger.
|
// its children are what are inside the slot. Expect only one v-slot:trigger.
|
||||||
const anchorEl =
|
const anchorEl =
|
||||||
this.anchorEl ||
|
this.anchorEl || this.$refs.trigger?.children[0] || this.$el
|
||||||
(this.$refs.trigger?.children[0]) ||
|
|
||||||
this.$el
|
|
||||||
// SVGs don't have offsetWidth/Height, use fallback
|
// SVGs don't have offsetWidth/Height, use fallback
|
||||||
const anchorHeight = anchorEl.offsetHeight || anchorEl.clientHeight
|
const anchorHeight = anchorEl.offsetHeight || anchorEl.clientHeight
|
||||||
const anchorWidth = anchorEl.offsetWidth || anchorEl.clientWidth
|
const anchorWidth = anchorEl.offsetWidth || anchorEl.clientWidth
|
||||||
|
|
@ -246,12 +244,12 @@ const Popover = {
|
||||||
if (bottomBoundary + content.offsetHeight > yBounds.max) usingTop = true
|
if (bottomBoundary + content.offsetHeight > yBounds.max) usingTop = true
|
||||||
if (topBoundary - content.offsetHeight < yBounds.min) usingTop = false
|
if (topBoundary - content.offsetHeight < yBounds.min) usingTop = false
|
||||||
|
|
||||||
const yOffset = (this.offset?.y) || 0
|
const yOffset = this.offset?.y || 0
|
||||||
translateY = usingTop
|
translateY = usingTop
|
||||||
? topBoundary - yOffset - content.offsetHeight
|
? topBoundary - yOffset - content.offsetHeight
|
||||||
: bottomBoundary + yOffset
|
: bottomBoundary + yOffset
|
||||||
|
|
||||||
const xOffset = (this.offset?.x) || 0
|
const xOffset = this.offset?.x || 0
|
||||||
translateX = origin.x + horizOffset + xOffset
|
translateX = origin.x + horizOffset + xOffset
|
||||||
} else {
|
} else {
|
||||||
// Default to whatever user wished with placement prop
|
// Default to whatever user wished with placement prop
|
||||||
|
|
@ -267,12 +265,12 @@ const Popover = {
|
||||||
if (rightBoundary + content.offsetWidth > xBounds.max) usingLeft = true
|
if (rightBoundary + content.offsetWidth > xBounds.max) usingLeft = true
|
||||||
if (leftBoundary - content.offsetWidth < xBounds.min) usingLeft = false
|
if (leftBoundary - content.offsetWidth < xBounds.min) usingLeft = false
|
||||||
|
|
||||||
const xOffset = (this.offset?.x) || 0
|
const xOffset = this.offset?.x || 0
|
||||||
translateX = usingLeft
|
translateX = usingLeft
|
||||||
? leftBoundary - xOffset - content.offsetWidth
|
? leftBoundary - xOffset - content.offsetWidth
|
||||||
: rightBoundary + xOffset
|
: rightBoundary + xOffset
|
||||||
|
|
||||||
const yOffset = (this.offset?.y) || 0
|
const yOffset = this.offset?.y || 0
|
||||||
translateY = origin.y + vertOffset + yOffset
|
translateY = origin.y + vertOffset + yOffset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,7 @@ const PostStatusModal = {
|
||||||
},
|
},
|
||||||
isFormVisible(val) {
|
isFormVisible(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.$nextTick(
|
this.$nextTick(() => this.$el?.querySelector('textarea').focus())
|
||||||
() => this.$el?.querySelector('textarea').focus(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -258,10 +258,7 @@ export default {
|
||||||
currentMentions = null
|
currentMentions = null
|
||||||
}
|
}
|
||||||
} else if (Tag === 'span') {
|
} else if (Tag === 'span') {
|
||||||
if (
|
if (this.handleLinks && fullAttrs.class?.includes('h-card')) {
|
||||||
this.handleLinks &&
|
|
||||||
fullAttrs.class?.includes('h-card')
|
|
||||||
) {
|
|
||||||
return ['', children.map(processItem), '']
|
return ['', children.map(processItem), '']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +296,7 @@ export default {
|
||||||
const attrs = getAttrs(opener, () => true)
|
const attrs = getAttrs(opener, () => true)
|
||||||
// should only be this
|
// should only be this
|
||||||
if (
|
if (
|
||||||
(fullAttrs.class?.includes('hashtag')) || // Pleroma style
|
fullAttrs.class?.includes('hashtag') || // Pleroma style
|
||||||
fullAttrs.rel === 'tag' // Mastodon style
|
fullAttrs.rel === 'tag' // Mastodon style
|
||||||
) {
|
) {
|
||||||
return renderHashtag(attrs, children, encounteredTextReverse)
|
return renderHashtag(attrs, children, encounteredTextReverse)
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,7 @@ const Status = {
|
||||||
computed: {
|
computed: {
|
||||||
showReasonMutedThread() {
|
showReasonMutedThread() {
|
||||||
return (
|
return (
|
||||||
(this.status.thread_muted ||
|
(this.status.thread_muted || this.status.reblog?.thread_muted) &&
|
||||||
(this.status.reblog?.thread_muted)) &&
|
|
||||||
!this.inConversation
|
!this.inConversation
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,11 @@ export default {
|
||||||
type="button"
|
type="button"
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<img src={props.image} alt={props['image-tooltip']} title={props['image-tooltip']} />
|
<img
|
||||||
|
src={props.image}
|
||||||
|
alt={props['image-tooltip']}
|
||||||
|
title={props['image-tooltip']}
|
||||||
|
/>
|
||||||
{props.label ? '' : props.label}
|
{props.label ? '' : props.label}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,7 @@ export const maybeShowChatNotification = (chat) => {
|
||||||
body: chat.lastMessage.content,
|
body: chat.lastMessage.content,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (chat.lastMessage.attachment?.type === 'image') {
|
||||||
chat.lastMessage.attachment?.type === 'image'
|
|
||||||
) {
|
|
||||||
opts.image = chat.lastMessage.attachment.preview_url
|
opts.image = chat.lastMessage.attachment.preview_url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,7 @@ export const prepareNotificationObject = (notification, i18n) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...
|
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...
|
||||||
if (
|
if (!status.nsfw && status?.attachments?.[0]?.mimetype.startsWith('image/')) {
|
||||||
!status.nsfw &&
|
|
||||||
status?.attachments?.[0]?.mimetype.startsWith('image/')
|
|
||||||
) {
|
|
||||||
notifObj.image = status.attachments[0].url
|
notifObj.image = status.attachments[0].url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
/* global process */
|
/* global process */
|
||||||
function urlBase64ToUint8Array(base64String) {
|
function urlBase64ToUint8Array(base64String) {
|
||||||
const padding = '='.repeat((4 - (base64String.length % 4)) % 4)
|
const padding = '='.repeat((4 - (base64String.length % 4)) % 4)
|
||||||
const base64 = (base64String + padding).replaceAll('-', '+').replace(/_/g, '/')
|
const base64 = (base64String + padding)
|
||||||
|
.replaceAll('-', '+')
|
||||||
|
.replace(/_/g, '/')
|
||||||
|
|
||||||
const rawData = window.atob(base64)
|
const rawData = window.atob(base64)
|
||||||
return Uint8Array.from([...rawData].map((char) => char.codePointAt(0)))
|
return Uint8Array.from([...rawData].map((char) => char.codePointAt(0)))
|
||||||
|
|
|
||||||
|
|
@ -244,10 +244,7 @@ export const OPACITIES = Object.entries(SLOT_INHERITANCE).reduce((acc, [k]) => {
|
||||||
...acc,
|
...acc,
|
||||||
[opacity]: {
|
[opacity]: {
|
||||||
defaultValue: DEFAULT_OPACITY[opacity] || 1,
|
defaultValue: DEFAULT_OPACITY[opacity] || 1,
|
||||||
affectedSlots: [
|
affectedSlots: [...(acc[opacity]?.affectedSlots || []), k],
|
||||||
...((acc[opacity]?.affectedSlots) || []),
|
|
||||||
k,
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,7 @@ export const useChatsStore = defineStore('chats', {
|
||||||
|
|
||||||
if (chat) {
|
if (chat) {
|
||||||
const isNewMessage =
|
const isNewMessage =
|
||||||
(chat.lastMessage?.id) !==
|
chat.lastMessage?.id !== updatedChat.lastMessage?.id
|
||||||
(updatedChat.lastMessage?.id)
|
|
||||||
chat.lastMessage = updatedChat.lastMessage
|
chat.lastMessage = updatedChat.lastMessage
|
||||||
chat.unread = updatedChat.unread
|
chat.unread = updatedChat.unread
|
||||||
chat.updated_at = updatedChat.updated_at
|
chat.updated_at = updatedChat.updated_at
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,8 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
return { name: x.variant, ...cleanDirectives }
|
return { name: x.variant, ...cleanDirectives }
|
||||||
})
|
})
|
||||||
.forEach((palette) => {
|
.forEach((palette) => {
|
||||||
const key = 'style.' + palette.name.toLowerCase().replaceAll(' ', '_')
|
const key =
|
||||||
|
'style.' + palette.name.toLowerCase().replaceAll(' ', '_')
|
||||||
if (!firstStylePaletteName) firstStylePaletteName = key
|
if (!firstStylePaletteName) firstStylePaletteName = key
|
||||||
palettesIndex[key] = () => Promise.resolve(palette)
|
palettesIndex[key] = () => Promise.resolve(palette)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -195,9 +195,10 @@ export const _getRecentData = (cache, live, isTest) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const _getAllFlags = (recent, stale) => {
|
export const _getAllFlags = (recent, stale) => {
|
||||||
|
const recentStorage = toRaw(recent?.flagStorage)
|
||||||
|
const staleStorage = toRaw(stale?.flagStorage)
|
||||||
|
|
||||||
return Array.from(
|
return Array.from(
|
||||||
recentStorage = toRaw(recent?.flagStorage)
|
|
||||||
staleStorage = toRaw(stale?.flagStorage)
|
|
||||||
new Set([
|
new Set([
|
||||||
...Object.keys(recentStorage || {}),
|
...Object.keys(recentStorage || {}),
|
||||||
...Object.keys(staleStorage || {}),
|
...Object.keys(staleStorage || {}),
|
||||||
|
|
|
||||||
|
|
@ -363,10 +363,7 @@ describe('RichContent', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper.html().replaceAll('\n', '').replaceAll('<!--.*?-->', ''),
|
||||||
.html()
|
|
||||||
.replaceAll('\n', '')
|
|
||||||
.replaceAll('<!--.*?-->', ''),
|
|
||||||
).to.eql(compwrap(expected))
|
).to.eql(compwrap(expected))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -436,10 +433,7 @@ describe('RichContent', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
wrapper
|
wrapper.html().replaceAll('\n', '').replaceAll('<!--.*?-->', ''),
|
||||||
.html()
|
|
||||||
.replaceAll('\n', '')
|
|
||||||
.replaceAll('<!--.*?-->', ''),
|
|
||||||
).to.eql(compwrap(expected))
|
).to.eql(compwrap(expected))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue