This commit is contained in:
emma 2023-07-05 02:33:10 -04:00
parent d25dd1cbd4
commit 3ca4c32b03
10 changed files with 106 additions and 91 deletions

View file

@ -97,7 +97,7 @@ const EmojiPicker = {
filteredEmoji() {
return this.filterByKeyword(this.$store.state.instance.customEmoji || [])
},
emojis () {
emojis() {
const recentEmojis = this.$store.getters.recentEmojis
const standardEmojis = this.$store.state.instance.emoji || []
const customEmojis = this.sortedEmoji
@ -116,7 +116,7 @@ const EmojiPicker = {
text: this.$t('emoji.recent'),
first: {
imageUrl: '',
replacement: '🕒',
replacement: '🕒'
},
emojis: this.filterByKeyword(recentEmojis)
},

View file

@ -241,9 +241,9 @@ const ExtraButtons = {
isEdited() {
return this.status.edited_at !== null
},
editingAvailable () {
editingAvailable() {
return this.$store.state.instance.editingAvailable
},
}
}
}

View file

@ -100,9 +100,12 @@ export default {
convertExpiryFromUnit(unit, amount) {
// Note: we want seconds and not milliseconds
switch (unit) {
case 'minutes': return amount * DateUtils.MINUTE / 1000
case 'hours': return amount * DateUtils.HOUR / 1000
case 'days': return amount * DateUtils.DAY / 1000
case 'minutes':
return (amount * DateUtils.MINUTE) / 1000
case 'hours':
return (amount * DateUtils.HOUR) / 1000
case 'days':
return (amount * DateUtils.DAY) / 1000
}
},
expiryAmountChange() {

View file

@ -112,7 +112,7 @@
svg {
width: 22px;
margin-right: 0.75rem;
color: var(--popoverIcon, $fallback--icon)
color: var(--popoverIcon, $fallback--icon);
}
}

View file

@ -48,11 +48,11 @@ const pxStringToNumber = (str) => {
}
const deleteDraft = (draftKey) => {
const draftData = JSON.parse(localStorage.getItem('drafts') || '{}');
const draftData = JSON.parse(localStorage.getItem('drafts') || '{}')
delete draftData[draftKey];
delete draftData[draftKey]
localStorage.setItem('drafts', JSON.stringify(draftData));
localStorage.setItem('drafts', JSON.stringify(draftData))
}
const PostStatusForm = {
@ -169,14 +169,14 @@ const PostStatusForm = {
}
if (!this.statusId) {
let draftKey = 'status';
let draftKey = 'status'
if (this.replyTo) {
draftKey = 'reply:' + this.replyTo;
draftKey = 'reply:' + this.replyTo
} else if (this.quoteId) {
draftKey = 'quote:' + this.quoteId;
draftKey = 'quote:' + this.quoteId
}
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[draftKey];
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[draftKey]
if (draft) {
statusParams = {
@ -193,7 +193,7 @@ const PostStatusForm = {
}
if (draft.data.poll) {
this.togglePollForm();
this.togglePollForm()
}
}
}
@ -437,66 +437,76 @@ const PostStatusForm = {
}
const newStatus = this.newStatus
this.previewLoading = true
statusPoster.postStatus({
status: newStatus.status,
spoilerText: newStatus.spoilerText || null,
visibility: newStatus.visibility,
sensitive: newStatus.nsfw,
media: [],
store: this.$store,
inReplyToStatusId: this.replyTo,
quoteId: this.quoteId,
contentType: newStatus.contentType,
language: newStatus.language,
poll: {},
preview: true
}).then((data) => {
// Don't apply preview if not loading, because it means
// user has closed the preview manually.
if (!this.previewLoading) return
if (!data.error) {
this.preview = data
} else {
this.preview = { error: data.error }
}
}).catch((error) => {
this.preview = { error }
}).finally(() => {
this.previewLoading = false
})
statusPoster
.postStatus({
status: newStatus.status,
spoilerText: newStatus.spoilerText || null,
visibility: newStatus.visibility,
sensitive: newStatus.nsfw,
media: [],
store: this.$store,
inReplyToStatusId: this.replyTo,
quoteId: this.quoteId,
contentType: newStatus.contentType,
language: newStatus.language,
poll: {},
preview: true
})
.then((data) => {
// Don't apply preview if not loading, because it means
// user has closed the preview manually.
if (!this.previewLoading) return
if (!data.error) {
this.preview = data
} else {
this.preview = { error: data.error }
}
})
.catch((error) => {
this.preview = { error }
})
.finally(() => {
this.previewLoading = false
})
let draftKey = 'status';
let draftKey = 'status'
if (this.replyTo) {
draftKey = 'reply:' + this.replyTo;
draftKey = 'reply:' + this.replyTo
} else if (this.quoteId) {
draftKey = 'quote:' + this.quoteId;
draftKey = 'quote:' + this.quoteId
}
deleteDraft(draftKey)
},
debouncePreviewStatus: debounce(function () { this.previewStatus() }, 500),
debouncePreviewStatus: debounce(function () {
this.previewStatus()
}, 500),
saveDraft() {
const draftData = JSON.parse(localStorage.getItem('drafts') || '{}');
const draftData = JSON.parse(localStorage.getItem('drafts') || '{}')
let draftKey = 'status';
let draftKey = 'status'
if (this.replyTo) {
draftKey = 'reply:' + this.replyTo;
draftKey = 'reply:' + this.replyTo
} else if (this.quoteId) {
draftKey = 'quote:' + this.quoteId;
draftKey = 'quote:' + this.quoteId
}
if (this.newStatus.status || this.newStatus.spoilerText || this.newStatus.files.length > 0 || this.newStatus.poll.length > 0) {
draftData[draftKey] = {
if (
this.newStatus.status ||
this.newStatus.spoilerText ||
this.newStatus.files.length > 0 ||
this.newStatus.poll.length > 0
) {
draftData[draftKey] = {
updatedAt: new Date(),
data: this.newStatus,
};
localStorage.setItem('drafts', JSON.stringify(draftData));
data: this.newStatus
}
localStorage.setItem('drafts', JSON.stringify(draftData))
} else {
deleteDraft(draftKey);
deleteDraft(draftKey)
}
},
autoPreview () {
autoPreview() {
if (!this.preview) return
this.previewLoading = true
this.debouncePreviewStatus()

View file

@ -46,8 +46,13 @@ const ProfileTab = {
emailLanguage: this.$store.state.users.currentUser.language || '',
newPostTTLDays: this.$store.state.users.currentUser.status_ttl_days,
expirePosts: this.$store.state.users.currentUser.status_ttl_days !== null,
userAcceptsDirectMessagesFrom: this.$store.state.users.currentUser.accepts_direct_messages_from,
userAcceptsDirectMessagesFromOptions: ["everybody", "nobody", "people_i_follow"].map(mode => ({
userAcceptsDirectMessagesFrom:
this.$store.state.users.currentUser.accepts_direct_messages_from,
userAcceptsDirectMessagesFromOptions: [
'everybody',
'nobody',
'people_i_follow'
].map((mode) => ({
key: mode,
value: mode,
label: this.$t(`settings.user_accepts_direct_messages_from_${mode}`)

View file

@ -8,19 +8,23 @@ import {
faHome,
faCircle
} from '@fortawesome/free-solid-svg-icons'
import { federatedTimelineVisible, publicTimelineVisible, bubbleTimelineVisible } from '../../lib/timeline_visibility'
import {
federatedTimelineVisible,
publicTimelineVisible,
bubbleTimelineVisible
} from '../../lib/timeline_visibility'
library.add(faUsers, faGlobe, faBookmark, faEnvelope, faHome, faCircle)
const TimelineMenuContent = {
computed: {
...mapState({
currentUser: state => state.users.currentUser,
privateMode: state => state.instance.private,
federating: state => state.instance.federating,
currentUser: (state) => state.users.currentUser,
privateMode: (state) => state.instance.private,
federating: (state) => state.instance.federating,
publicTimelineVisible,
federatedTimelineVisible,
bubbleTimelineVisible,
bubbleTimelineVisible
})
}
}

View file

@ -41,13 +41,14 @@
>
<FAIcon
fixed-width
class="fa-scale-110 fa-old-padding "
class="fa-scale-110 fa-old-padding"
icon="circle"
/>
<span
:title="$t('nav.bubble_timeline_description')"
:aria-label="$t('nav.bubble_timeline_description')"
>{{ $t("nav.bubble_timeline") }}</span>
>{{ $t('nav.bubble_timeline') }}</span
>
</router-link>
</li>
<li v-if="federatedTimelineVisible">
@ -63,8 +64,8 @@
<span
:title="$t('nav.twkn_timeline_description')"
:aria-label="$t('nav.twkn_timeline_description')"
>{{ $t("nav.twkn") }}</span>
>{{ $t('nav.twkn') }}</span
>
</router-link>
</li>
<li v-if="currentUser">

View file

@ -8,25 +8,22 @@ import {
faHome
} from '@fortawesome/free-solid-svg-icons'
import { faCircle } from '@fortawesome/free-regular-svg-icons'
import { federatedTimelineVisible, publicTimelineVisible, bubbleTimelineVisible } from '../../lib/timeline_visibility'
library.add(
faUsers,
faGlobe,
faBookmark,
faEnvelope,
faHome,
faCircle
)
import {
federatedTimelineVisible,
publicTimelineVisible,
bubbleTimelineVisible
} from '../../lib/timeline_visibility'
library.add(faUsers, faGlobe, faBookmark, faEnvelope, faHome, faCircle)
const TimelineMenuContent = {
computed: {
...mapState({
currentUser: state => state.users.currentUser,
privateMode: state => state.instance.private,
federating: state => state.instance.federating,
currentUser: (state) => state.users.currentUser,
privateMode: (state) => state.instance.private,
federating: (state) => state.instance.federating,
publicTimelineVisible,
federatedTimelineVisible,
bubbleTimelineVisible,
bubbleTimelineVisible
})
}
}

View file

@ -45,13 +45,8 @@ const i18n = createI18n({
messages.setLanguage(i18n, currentLocale)
const persistedStateOptions = {
paths: [
'config',
'users.lastLoginName',
'oauth',
'recentEmojis.emojis',
]
};
paths: ['config', 'users.lastLoginName', 'oauth', 'recentEmojis.emojis']
}
;(async () => {
if ('serviceWorker' in navigator) {
@ -104,7 +99,7 @@ const persistedStateOptions = {
editStatus: editStatusModule,
statusHistory: statusHistoryModule,
tags: tagModule,
recentEmojis: recentEmojisModule,
recentEmojis: recentEmojisModule
},
plugins,
strict: false // Socket modifies itself, let's ignore this for now.