Fix UI, beta versioning

This commit is contained in:
ThatOneCalculator 2022-12-11 18:32:19 -08:00
parent 43a7891e4f
commit cfb5832e24
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
3 changed files with 15 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "13.0.0-rc5", "version": "13.0.0-beta1",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,14 +1,14 @@
import { In } from 'typeorm'; import { In } from 'typeorm';
import { User } from '@/models/entities/user.js'; import type { User } from '@/models/entities/user.js';
import { Users, DriveFiles, Notes, Channels, Blockings } from '@/models/index.js'; import { Users, DriveFiles, Notes, Channels, Blockings } from '@/models/index.js';
import { resolveUser } from '@/remote/resolve-user.js'; import { resolveUser } from '@/remote/resolve-user.js';
import { ApiError } from '../../error.js';
import acceptAllFollowRequests from '@/services/following/requests/accept-all.js'; import acceptAllFollowRequests from '@/services/following/requests/accept-all.js';
import { publishToFollowers } from '@/services/i/update.js'; import { publishToFollowers } from '@/services/i/update.js';
import { apiLogger } from '../../logger.js';
import { publishMainStream, publishUserEvent } from '@/services/stream.js'; import { publishMainStream, publishUserEvent } from '@/services/stream.js';
import define from '../../define.js';
import { DAY } from '@/const.js'; import { DAY } from '@/const.js';
import { apiLogger } from '../../logger.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
export const meta = { export const meta = {
tags: ['users'], tags: ['users'],
@ -32,7 +32,7 @@ export const meta = {
code: 'NOT_REMOTE', code: 'NOT_REMOTE',
id: '4362f8dc-731f-4ad8-a694-be2a88922a24', id: '4362f8dc-731f-4ad8-a694-be2a88922a24',
}, },
} },
} as const; } as const;
export const paramDef = { export const paramDef = {
@ -45,15 +45,14 @@ export const paramDef = {
// eslint-disable-next-line import/no-default-export // eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
if (!ps.alsoKnownAs) throw new ApiError(meta.errors.noSuchUser);
if(!ps.alsoKnownAs) throw new ApiError(meta.errors.noSuchUser);
let unfiltered: string = ps.alsoKnownAs; let unfiltered: string = ps.alsoKnownAs;
if(unfiltered.startsWith('@')) unfiltered = unfiltered.substring(1); if (unfiltered.startsWith('@')) unfiltered = unfiltered.substring(1);
if(!unfiltered.includes('@')) throw new ApiError(meta.errors.notRemote); if (!unfiltered.includes('@')) throw new ApiError(meta.errors.notRemote);
let userAddress: string[] = unfiltered.split("@"); const userAddress: string[] = unfiltered.split('@');
const knownAs: User = await resolveUser(userAddress[0], userAddress[1]).catch(e => { const knownAs: User = await resolveUser(userAddress[0], userAddress[1]).catch(e => {
apiLogger.warn(`failed to resolve remote user: ${e}`); apiLogger.warn(`failed to resolve remote user: ${e}`);
@ -62,7 +61,7 @@ export default define(meta, paramDef, async (ps, user) => {
const updates = {} as Partial<User>; const updates = {} as Partial<User>;
if(!knownAs.uri) knownAs.uri = ""; if (!knownAs.uri) knownAs.uri = '';
updates.alsoKnownAs = [knownAs.uri]; updates.alsoKnownAs = [knownAs.uri];
await Users.update(user.id, updates); await Users.update(user.id, updates);

View File

@ -18,7 +18,7 @@
<template #prefix><i class="ph-airplane-landing-bold ph-lg"></i></template> <template #prefix><i class="ph-airplane-landing-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.moveFromLabel }}</template> <template #label>{{ i18n.ts.moveFromLabel }}</template>
</FormInput> </FormInput>
<FormButton class="button" inline primary @click="save(accountAlias)"> <FormButton class="button" inline primary @click="save(accountAlias.toString())">
<i class="ph-floppy-disk-back-bold ph-lg"></i> {{ i18n.ts.save }} <i class="ph-floppy-disk-back-bold ph-lg"></i> {{ i18n.ts.save }}
</FormButton> </FormButton>
<div class="description">{{ i18n.ts.moveFromDescription }}</div> <div class="description">{{ i18n.ts.moveFromDescription }}</div>
@ -38,6 +38,9 @@ let moveToAccount = $ref('');
let accountAlias = $ref(''); let accountAlias = $ref('');
async function save(account): Promise<void> { async function save(account): Promise<void> {
console.log(accountAlias);
console.log(accountAlias.toString());
console.log(account);
os.apiWithDialog('i/known-as', { os.apiWithDialog('i/known-as', {
alsoKnownAs: account, alsoKnownAs: account,
}); });