Merge branch 'develop' into sw-notification-action

This commit is contained in:
tamaina
2021-02-17 22:03:30 +09:00
committed by GitHub
14 changed files with 88 additions and 39 deletions

View File

@@ -99,7 +99,8 @@ import { faHeart, faFlag, faLaugh } from '@fortawesome/free-regular-svg-icons';
import MkModal from '@/components/ui/modal.vue';
import Particle from '@/components/particle.vue';
import * as os from '@/os';
import { isDeviceTouch } from '../scripts/is-device-touch';
import { isDeviceTouch } from '@/scripts/is-device-touch';
import { isMobile } from '@/scripts/is-mobile';
import { emojiCategories } from '@/instance';
export default defineComponent({
@@ -322,7 +323,7 @@ export default defineComponent({
},
mounted() {
if (!os.isMobile) {
if (!isMobile && !isDeviceTouch) {
this.$refs.search.focus({
preventScroll: true
});

View File

@@ -69,6 +69,7 @@ import { noteVisibilities } from '../../types';
import * as os from '@/os';
import { selectFile } from '@/scripts/select-file';
import { notePostInterruptors, postFormActions } from '@/store';
import { isMobile } from '@/scripts/is-mobile';
export default defineComponent({
components: {
@@ -580,7 +581,7 @@ export default defineComponent({
localOnly: this.localOnly,
visibility: this.visibility,
visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
viaMobile: os.isMobile
viaMobile: isMobile
};
// plugin

View File

@@ -138,13 +138,19 @@ export default defineComponent({
},
async openAccountMenu(ev) {
const storedAccounts = await getAccounts();
const accounts = (await os.api('users/show', { userIds: storedAccounts.map(x => x.id) })).filter(x => x.id !== this.$i.id);
const storedAccounts = (await getAccounts()).filter(x => x.id !== this.$i.id);
const accountsPromise = os.api('users/show', { userIds: storedAccounts.map(x => x.id) });
const accountItems = accounts.map(account => ({
type: 'user',
user: account,
action: () => { this.switchAccount(account); }
const accountItemPromises = storedAccounts.map(a => new Promise(res => {
accountsPromise.then(accounts => {
const account = accounts.find(x => x.id === a.id);
if (account == null) return res(null);
res({
type: 'user',
user: account,
action: () => { this.switchAccount(account); }
});
});
}));
os.modalMenu([...[{
@@ -152,7 +158,7 @@ export default defineComponent({
text: this.$ts.profile,
to: `/@${ this.$i.username }`,
avatar: this.$i,
}, null, ...accountItems, {
}, null, ...accountItemPromises, {
icon: faPlus,
text: this.$ts.addAcount,
action: () => {