summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-17 02:58:09 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-17 02:58:09 +0900
commit532ef744f45ef56dcdd14f068c3232393f12e7f9 (patch)
treee44cf59e20901f3395f97f1b4d55b4774f731911 /src
parentMerge branch 'develop' (diff)
parent11.1.4 (diff)
downloadmisskey-532ef744f45ef56dcdd14f068c3232393f12e7f9.tar.gz
misskey-532ef744f45ef56dcdd14f068c3232393f12e7f9.tar.bz2
misskey-532ef744f45ef56dcdd14f068c3232393f12e7f9.zip
Merge branch 'develop'
Diffstat (limited to 'src')
-rw-r--r--src/client/app/admin/views/drive.vue2
-rw-r--r--src/client/app/admin/views/instance.vue2
-rw-r--r--src/client/app/common/scripts/note-mixin.ts2
-rw-r--r--src/client/app/common/views/components/messaging-room.form.vue10
-rw-r--r--src/client/app/common/views/components/messaging-room.vue5
-rw-r--r--src/client/app/common/views/components/post-form-attaches.vue2
-rw-r--r--src/client/app/common/views/components/settings/profile.vue2
-rw-r--r--src/client/app/common/views/components/settings/settings.vue4
-rw-r--r--src/client/app/common/views/components/signin.vue5
-rw-r--r--src/client/app/common/views/components/signup.vue5
-rw-r--r--src/client/app/common/views/deck/deck.widgets-column.vue4
-rw-r--r--src/client/app/common/views/widgets/post-form.vue5
-rw-r--r--src/client/app/desktop/views/components/drive.folder.vue5
-rw-r--r--src/client/app/desktop/views/components/drive.vue5
-rw-r--r--src/client/app/desktop/views/components/post-form.vue11
-rw-r--r--src/client/app/desktop/views/home/home.vue5
-rw-r--r--src/client/app/desktop/views/pages/drive.vue2
-rw-r--r--src/client/app/mios.ts4
-rw-r--r--src/client/app/mobile/views/components/drive.file-detail.vue7
-rw-r--r--src/client/app/mobile/views/components/post-form.vue11
-rw-r--r--src/client/app/mobile/views/pages/favorites.vue2
-rw-r--r--src/client/app/mobile/views/pages/games/reversi.vue2
-rw-r--r--src/client/app/mobile/views/pages/search.vue2
-rw-r--r--src/client/app/mobile/views/pages/widgets.vue8
-rw-r--r--src/client/style.styl2
-rw-r--r--src/docs/stream.ja-JP.md10
-rw-r--r--src/misc/fetch-meta.ts27
-rw-r--r--src/models/entities/meta.ts6
-rw-r--r--src/models/entities/note.ts6
-rw-r--r--src/models/repositories/note.ts2
-rw-r--r--src/models/repositories/user.ts12
-rw-r--r--src/server/api/endpoints/admin/update-meta.ts20
-rw-r--r--src/services/chart/core.ts2
-rw-r--r--src/services/drive/delete-file.ts7
34 files changed, 140 insertions, 66 deletions
diff --git a/src/client/app/admin/views/drive.vue b/src/client/app/admin/views/drive.vue
index e4565b78fe..22b3b7eb96 100644
--- a/src/client/app/admin/views/drive.vue
+++ b/src/client/app/admin/views/drive.vue
@@ -242,7 +242,7 @@ export default Vue.extend({
> div:nth-child(1)
> .thumbnail
- display block
+ display flex
width 64px
height 64px
background-size cover
diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue
index bc2a5fba85..cca4e5f669 100644
--- a/src/client/app/admin/views/instance.vue
+++ b/src/client/app/admin/views/instance.vue
@@ -195,7 +195,7 @@ export default Vue.extend({
},
created() {
- this.$root.getMeta().then(meta => {
+ this.$root.getMeta(true).then(meta => {
this.maintainerName = meta.maintainerName;
this.maintainerEmail = meta.maintainerEmail;
this.disableRegistration = meta.disableRegistration;
diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts
index 67bbe8c0ae..4b454f8800 100644
--- a/src/client/app/common/scripts/note-mixin.ts
+++ b/src/client/app/common/scripts/note-mixin.ts
@@ -134,7 +134,7 @@ export default (opts: Opts = {}) => ({
},
reactDirectly(reaction) {
- (this.$root.api('notes/reactions/create', {
+ this.$root.api('notes/reactions/create', {
noteId: this.appearNote.id,
reaction: reaction
});
diff --git a/src/client/app/common/views/components/messaging-room.form.vue b/src/client/app/common/views/components/messaging-room.form.vue
index 6c8b09c244..ee6c312bce 100644
--- a/src/client/app/common/views/components/messaging-room.form.vue
+++ b/src/client/app/common/views/components/messaging-room.form.vue
@@ -85,7 +85,10 @@ export default Vue.extend({
}
} else {
if (items[0].kind == 'file') {
- alert(this.$t('only-one-file-attached'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('only-one-file-attached')
+ });
}
}
},
@@ -107,7 +110,10 @@ export default Vue.extend({
return;
} else if (e.dataTransfer.files.length > 1) {
e.preventDefault();
- alert(this.$t('only-one-file-attached'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('only-one-file-attached')
+ });
return;
}
diff --git a/src/client/app/common/views/components/messaging-room.vue b/src/client/app/common/views/components/messaging-room.vue
index 6f13d50c1e..83a0c463e0 100644
--- a/src/client/app/common/views/components/messaging-room.vue
+++ b/src/client/app/common/views/components/messaging-room.vue
@@ -125,7 +125,10 @@ export default Vue.extend({
this.form.upload(e.dataTransfer.files[0]);
return;
} else if (e.dataTransfer.files.length > 1) {
- alert(this.$t('only-one-file-attached'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('only-one-file-attached')
+ });
return;
}
diff --git a/src/client/app/common/views/components/post-form-attaches.vue b/src/client/app/common/views/components/post-form-attaches.vue
index 467e430ccf..1fe476be77 100644
--- a/src/client/app/common/views/components/post-form-attaches.vue
+++ b/src/client/app/common/views/components/post-form-attaches.vue
@@ -1,6 +1,6 @@
<template>
<div class="skeikyzd" v-show="files.length != 0">
- <x-draggable class="files" :list="files" :options="{ animation: 150 }">
+ <x-draggable class="files" :list="files" animation="150">
<div v-for="file in files" :key="file.id" @click="showFileMenu(file, $event)" @contextmenu.prevent="showFileMenu(file, $event)">
<x-file-thumbnail :data-id="file.id" class="thumbnail" :file="file" fit="cover"/>
<img class="remove" @click.stop="detachMedia(file.id)" src="/assets/desktop/remove.png" :title="$t('attach-cancel')" alt=""/>
diff --git a/src/client/app/common/views/components/settings/profile.vue b/src/client/app/common/views/components/settings/profile.vue
index fd08f85816..c1ecfafe16 100644
--- a/src/client/app/common/views/components/settings/profile.vue
+++ b/src/client/app/common/views/components/settings/profile.vue
@@ -84,7 +84,7 @@
<ui-info v-else warn>{{ $t('email-not-verified') }}</ui-info>
</template>
<ui-input v-model="email" type="email"><span>{{ $t('email-address') }}</span></ui-input>
- <ui-button @click="updateEmail()"><fa :icon="faSave"/> {{ $t('save') }}</ui-button>
+ <ui-button @click="updateEmail()" :disabled="email === $store.state.i.email"><fa :icon="faSave"/> {{ $t('save') }}</ui-button>
</div>
</section>
diff --git a/src/client/app/common/views/components/settings/settings.vue b/src/client/app/common/views/components/settings/settings.vue
index c81a0e0cd5..001b692551 100644
--- a/src/client/app/common/views/components/settings/settings.vue
+++ b/src/client/app/common/views/components/settings/settings.vue
@@ -542,8 +542,8 @@ export default Vue.extend({
this.latestVersion = newer;
if (newer == null) {
this.$root.dialog({
- title: this.$t('no-updates'),
- text: this.$t('no-updates-desc')
+ title: this.$t('@._settings.no-updates'),
+ text: this.$t('@._settings.no-updates-desc')
});
} else {
this.$root.dialog({
diff --git a/src/client/app/common/views/components/signin.vue b/src/client/app/common/views/components/signin.vue
index 477f25680e..e05085cdbf 100644
--- a/src/client/app/common/views/components/signin.vue
+++ b/src/client/app/common/views/components/signin.vue
@@ -79,7 +79,10 @@ export default Vue.extend({
localStorage.setItem('i', res.i);
location.reload();
}).catch(() => {
- alert(this.$t('login-failed'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('login-failed')
+ });
this.signing = false;
});
}
diff --git a/src/client/app/common/views/components/signup.vue b/src/client/app/common/views/components/signup.vue
index 45c2eabd45..9b1df79771 100644
--- a/src/client/app/common/views/components/signup.vue
+++ b/src/client/app/common/views/components/signup.vue
@@ -153,7 +153,10 @@ export default Vue.extend({
location.href = '/';
});
}).catch(() => {
- alert(this.$t('some-error'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('some-error')
+ });
if (this.meta.enableRecaptcha) {
(window as any).grecaptcha.reset();
diff --git a/src/client/app/common/views/deck/deck.widgets-column.vue b/src/client/app/common/views/deck/deck.widgets-column.vue
index fcf3afd3f7..f2385c8a48 100644
--- a/src/client/app/common/views/deck/deck.widgets-column.vue
+++ b/src/client/app/common/views/deck/deck.widgets-column.vue
@@ -21,7 +21,7 @@
<option value="users">{{ $t('@.widgets.users') }}</option>
<option value="polls">{{ $t('@.widgets.polls') }}</option>
<option value="post-form">{{ $t('@.widgets.post-form') }}</option>
- <option value="messaging">{{ $t('@.widgets.messaging') }}</option>
+ <option value="messaging">{{ $t('@.messaging') }}</option>
<option value="memo">{{ $t('@.widgets.memo') }}</option>
<option value="hashtags">{{ $t('@.widgets.hashtags') }}</option>
<option value="posts-monitor">{{ $t('@.widgets.posts-monitor') }}</option>
@@ -33,7 +33,7 @@
</header>
<x-draggable
:list="column.widgets"
- :options="{ animation: 150 }"
+ animation="150"
@sort="onWidgetSort"
>
<div v-for="widget in column.widgets" class="customize-container" :key="widget.id" @contextmenu.stop.prevent="widgetFunc(widget.id)">
diff --git a/src/client/app/common/views/widgets/post-form.vue b/src/client/app/common/views/widgets/post-form.vue
index b30168b879..120de0f17b 100644
--- a/src/client/app/common/views/widgets/post-form.vue
+++ b/src/client/app/common/views/widgets/post-form.vue
@@ -188,7 +188,10 @@ export default define({
}).then(data => {
this.clear();
}).catch(err => {
- alert('Something happened');
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('something-happened')
+ });
}).then(() => {
this.posting = false;
this.$nextTick(() => {
diff --git a/src/client/app/desktop/views/components/drive.folder.vue b/src/client/app/desktop/views/components/drive.folder.vue
index 02f219a98e..fd6de5a05e 100644
--- a/src/client/app/desktop/views/components/drive.folder.vue
+++ b/src/client/app/desktop/views/components/drive.folder.vue
@@ -161,7 +161,10 @@ export default Vue.extend({
});
break;
default:
- alert(this.$t('unhandled-error'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('unhandled-error')
+ });
}
});
}
diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue
index fcabb4b8eb..48443669ac 100644
--- a/src/client/app/desktop/views/components/drive.vue
+++ b/src/client/app/desktop/views/components/drive.vue
@@ -320,7 +320,10 @@ export default Vue.extend({
});
break;
default:
- alert(this.$t('unhandled-error'));
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('unhandled-error')
+ });
}
});
}
diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue
index fe39a17e67..7d3593d9c9 100644
--- a/src/client/app/desktop/views/components/post-form.vue
+++ b/src/client/app/desktop/views/components/post-form.vue
@@ -364,7 +364,10 @@ export default Vue.extend({
setGeo() {
if (navigator.geolocation == null) {
- alert(this.$t('geolocation-alert'));
+ this.$root.dialog({
+ type: 'warning',
+ text: this.$t('geolocation-alert')
+ });
return;
}
@@ -372,7 +375,11 @@ export default Vue.extend({
this.geo = pos.coords;
this.$emit('geo-attached', this.geo);
}, err => {
- alert(`%i18n:@error%: ${err.message}`);
+ this.$root.dialog({
+ type: 'error',
+ title: this.$t('error')
+ text: err.message
+ });
}, {
enableHighAccuracy: true
});
diff --git a/src/client/app/desktop/views/home/home.vue b/src/client/app/desktop/views/home/home.vue
index d0b2fc10bc..d4677df842 100644
--- a/src/client/app/desktop/views/home/home.vue
+++ b/src/client/app/desktop/views/home/home.vue
@@ -34,7 +34,7 @@
<button @click="addWidget">{{ $t('add') }}</button>
</div>
<div class="trash">
- <x-draggable v-model="trash" :options="{ group: 'x' }" @add="onTrash"></x-draggable>
+ <x-draggable v-model="trash" group="x" @add="onTrash"></x-draggable>
<p>{{ $t('@.trash') }}</p>
</div>
</div>
@@ -45,7 +45,8 @@
:list="widgets[place]"
:class="place"
:data-place="place"
- :options="{ group: 'x', animation: 150 }"
+ group="x"
+ animation="150"
@sort="onWidgetSort"
:key="place"
>
diff --git a/src/client/app/desktop/views/pages/drive.vue b/src/client/app/desktop/views/pages/drive.vue
index 2916569a5f..b389392ec8 100644
--- a/src/client/app/desktop/views/pages/drive.vue
+++ b/src/client/app/desktop/views/pages/drive.vue
@@ -34,7 +34,7 @@ export default Vue.extend({
document.title = title;
},
onOpenFolder(folder) {
- const title = folder.name + ' | %i18n:@title%';
+ const title = `${folder.name} | ${this.$t('title')}`;
// Rewrite URL
history.pushState(null, title, `/i/drive/folder/${folder.id}`);
diff --git a/src/client/app/mios.ts b/src/client/app/mios.ts
index a3525ed319..b69c340528 100644
--- a/src/client/app/mios.ts
+++ b/src/client/app/mios.ts
@@ -4,7 +4,7 @@ import { EventEmitter } from 'eventemitter3';
import * as uuid from 'uuid';
import initStore from './store';
-import { apiUrl, version } from './config';
+import { apiUrl, version, locale } from './config';
import Progress from './common/scripts/loading';
import Err from './common/views/components/connect-failed.vue';
@@ -281,7 +281,7 @@ export default class MiOS extends EventEmitter {
// トークンが再生成されたとき
// このままではMisskeyが利用できないので強制的にサインアウトさせる
main.on('myTokenRegenerated', () => {
- alert('%i18n:common.my-token-regenerated%');
+ alert(locale['common']['my-token-regenerated'])
this.signout();
});
}
diff --git a/src/client/app/mobile/views/components/drive.file-detail.vue b/src/client/app/mobile/views/components/drive.file-detail.vue
index 98124354ed..b9960e5433 100644
--- a/src/client/app/mobile/views/components/drive.file-detail.vue
+++ b/src/client/app/mobile/views/components/drive.file-detail.vue
@@ -136,7 +136,10 @@ export default Vue.extend({
},
showCreatedAt() {
- alert(new Date(this.file.createdAt).toLocaleString());
+ this.$root.dialog({
+ type: 'info',
+ text: (new Date(this.file.createdAt)).toLocaleString()
+ });
}
}
});
@@ -150,11 +153,13 @@ export default Vue.extend({
> .preview
width fit-content
+ width -moz-fit-content
max-width 100%
margin 0 auto
box-shadow 1px 1px 4px rgba(#000, 0.2)
overflow hidden
color var(--driveFileIcon)
+ justify-content center
> footer
padding 8px 8px 0 8px
diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue
index 6b26cdf890..82cbdcc547 100644
--- a/src/client/app/mobile/views/components/post-form.vue
+++ b/src/client/app/mobile/views/components/post-form.vue
@@ -283,14 +283,21 @@ export default Vue.extend({
setGeo() {
if (navigator.geolocation == null) {
- alert(this.$t('location-alert'));
+ this.$root.dialog({
+ type: 'warning',
+ text: this.$t('geolocation-alert')
+ });
return;
}
navigator.geolocation.getCurrentPosition(pos => {
this.geo = pos.coords;
}, err => {
- alert(`%i18n:@error%: ${err.message}`);
+ this.$root.dialog({
+ type: 'error',
+ title: this.$t('error')
+ text: err.message
+ });
}, {
enableHighAccuracy: true
});
diff --git a/src/client/app/mobile/views/pages/favorites.vue b/src/client/app/mobile/views/pages/favorites.vue
index 6f175a0053..92823db7cc 100644
--- a/src/client/app/mobile/views/pages/favorites.vue
+++ b/src/client/app/mobile/views/pages/favorites.vue
@@ -32,7 +32,7 @@ export default Vue.extend({
this.fetch();
},
mounted() {
- document.title = `${this.$root.instanceName} | %i18n:@notifications%`;
+ document.title = `${this.$root.instanceName} | ${this.$t('@.favorites')}`;
},
methods: {
fetch() {
diff --git a/src/client/app/mobile/views/pages/games/reversi.vue b/src/client/app/mobile/views/pages/games/reversi.vue
index c67e3fadd1..69b7bdffb4 100644
--- a/src/client/app/mobile/views/pages/games/reversi.vue
+++ b/src/client/app/mobile/views/pages/games/reversi.vue
@@ -15,7 +15,7 @@ export default Vue.extend({
XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue').then(m => m.default)
},
mounted() {
- document.title = `${this.$root.instanceName} %i18n:@reversi%`;
+ document.title = `${this.$root.instanceName} | ${this.$t('reversi')}`;
},
methods: {
nav(game, actualNav) {
diff --git a/src/client/app/mobile/views/pages/search.vue b/src/client/app/mobile/views/pages/search.vue
index f4b2512809..0225dd9e9f 100644
--- a/src/client/app/mobile/views/pages/search.vue
+++ b/src/client/app/mobile/views/pages/search.vue
@@ -50,7 +50,7 @@ export default Vue.extend({
}
},
mounted() {
- document.title = `%i18n:@search%: ${this.q} | ${this.$root.instanceName}`;
+ document.title = `${this.$t('search')}: ${this.q} | ${this.$root.instanceName}`;
},
methods: {
inited() {
diff --git a/src/client/app/mobile/views/pages/widgets.vue b/src/client/app/mobile/views/pages/widgets.vue
index 2647f96de2..33166825cb 100644
--- a/src/client/app/mobile/views/pages/widgets.vue
+++ b/src/client/app/mobile/views/pages/widgets.vue
@@ -29,7 +29,8 @@
</header>
<x-draggable
:list="widgets"
- :options="{ handle: '.handle', animation: 150 }"
+ handle=".handle"
+ animation="150"
@sort="onWidgetSort"
>
<div v-for="widget in widgets" class="customize-container" :key="widget.id">
@@ -106,7 +107,10 @@ export default Vue.extend({
methods: {
hint() {
- alert(this.$t('widgets-hints'));
+ this.$root.dialog({
+ type: 'info',
+ text: this.$t('widgets-hints')
+ });
},
widgetFunc(id) {
diff --git a/src/client/style.styl b/src/client/style.styl
index c6a8e4f19d..968e66e754 100644
--- a/src/client/style.styl
+++ b/src/client/style.styl
@@ -1,4 +1,4 @@
-@charset 'utf-8'
+@charset "utf-8"
/*
::selection
diff --git a/src/docs/stream.ja-JP.md b/src/docs/stream.ja-JP.md
index 0e9afa7332..40fc49916e 100644
--- a/src/docs/stream.ja-JP.md
+++ b/src/docs/stream.ja-JP.md
@@ -130,10 +130,12 @@ Misskeyのストリームに接続しただけでは、まだリアルタイム
```json
{
type: 'api',
- id: 'xxxxxxxxxxxxxxxx',
- endpoint: 'notes/create',
- data: {
- text: 'yee haw!'
+ body: {
+ id: 'xxxxxxxxxxxxxxxx',
+ endpoint: 'notes/create',
+ data: {
+ text: 'yee haw!'
+ }
}
}
```
diff --git a/src/misc/fetch-meta.ts b/src/misc/fetch-meta.ts
index cf1fc474ce..800f0b9e63 100644
--- a/src/misc/fetch-meta.ts
+++ b/src/misc/fetch-meta.ts
@@ -1,14 +1,21 @@
import { Meta } from '../models/entities/meta';
-import { Metas } from '../models';
-import { genId } from './gen-id';
+import { getConnection } from 'typeorm';
export default async function(): Promise<Meta> {
- const meta = await Metas.findOne();
- if (meta) {
- return meta;
- } else {
- return Metas.save({
- id: genId(),
- } as Meta);
- }
+ return await getConnection().transaction(async transactionalEntityManager => {
+ // バグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する
+ const meta = await transactionalEntityManager.findOne(Meta, {
+ order: {
+ id: 'DESC'
+ }
+ });
+
+ if (meta) {
+ return meta;
+ } else {
+ return await transactionalEntityManager.save(Meta, {
+ id: 'x'
+ }) as Meta;
+ }
+ });
}
diff --git a/src/models/entities/meta.ts b/src/models/entities/meta.ts
index f3ac23bac7..be41cf3589 100644
--- a/src/models/entities/meta.ts
+++ b/src/models/entities/meta.ts
@@ -1,9 +1,11 @@
import { Entity, Column, PrimaryColumn } from 'typeorm';
-import { id } from '../id';
@Entity()
export class Meta {
- @PrimaryColumn(id())
+ @PrimaryColumn({
+ type: 'varchar',
+ length: 32
+ })
public id: string;
@Column('varchar', {
diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts
index 969363da3b..b71c022341 100644
--- a/src/models/entities/note.ts
+++ b/src/models/entities/note.ts
@@ -93,12 +93,12 @@ export class Note {
})
public localOnly: boolean;
- @Column('integer', {
+ @Column('smallint', {
default: 0
})
public renoteCount: number;
- @Column('integer', {
+ @Column('smallint', {
default: 0
})
public repliesCount: number;
@@ -129,12 +129,14 @@ export class Note {
})
public score: number;
+ @Index()
@Column({
...id(),
array: true, default: '{}'
})
public fileIds: DriveFile['id'][];
+ @Index()
@Column('varchar', {
length: 256, array: true, default: '{}'
})
diff --git a/src/models/repositories/note.ts b/src/models/repositories/note.ts
index 7a48d24e13..98ed2bddc1 100644
--- a/src/models/repositories/note.ts
+++ b/src/models/repositories/note.ts
@@ -103,7 +103,7 @@ export class NoteRepository extends Repository<Note> {
const host = note.userHost;
async function populatePoll() {
- const poll = await Polls.findOne({ noteId: note.id }).then(ensure);
+ const poll = await Polls.findOne(note.id).then(ensure);
const choices = poll.choices.map(c => ({
text: c,
votes: poll.votes[poll.choices.indexOf(c)],
diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts
index 9e4247545a..30c77e78ca 100644
--- a/src/models/repositories/user.ts
+++ b/src/models/repositories/user.ts
@@ -84,6 +84,8 @@ export class UserRepository extends Repository<User> {
const pins = opts.detail ? await UserNotePinings.find({ userId: user.id }) : [];
const profile = opts.detail ? await UserProfiles.findOne({ userId: user.id }).then(ensure) : null;
+ const falsy = opts.detail ? false : undefined;
+
return await rap({
id: user.id,
name: user.name,
@@ -91,10 +93,10 @@ export class UserRepository extends Repository<User> {
host: user.host,
avatarUrl: user.avatarUrl ? user.avatarUrl : config.url + '/avatar/' + user.id,
avatarColor: user.avatarColor,
- isAdmin: user.isAdmin || undefined,
- isBot: user.isBot || undefined,
- isCat: user.isCat || undefined,
- isVerified: user.isVerified || undefined,
+ isAdmin: user.isAdmin || falsy,
+ isBot: user.isBot || falsy,
+ isCat: user.isCat || falsy,
+ isVerified: user.isVerified || falsy,
// カスタム絵文字添付
emojis: user.emojis.length > 0 ? Emojis.find({
@@ -123,7 +125,7 @@ export class UserRepository extends Repository<User> {
bannerUrl: user.bannerUrl,
bannerColor: user.bannerColor,
isLocked: user.isLocked,
- isModerator: user.isModerator || undefined,
+ isModerator: user.isModerator || falsy,
description: profile!.description,
location: profile!.location,
birthday: profile!.birthday,
diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts
index e242ac71a1..3c6380acb4 100644
--- a/src/server/api/endpoints/admin/update-meta.ts
+++ b/src/server/api/endpoints/admin/update-meta.ts
@@ -1,6 +1,6 @@
import $ from 'cafy';
import define from '../../define';
-import { Metas } from '../../../../models';
+import { getConnection } from 'typeorm';
import { Meta } from '../../../../models/entities/meta';
export const meta = {
@@ -505,11 +505,17 @@ export default define(meta, async (ps) => {
set.swPrivateKey = ps.swPrivateKey;
}
- const meta = await Metas.findOne();
+ await getConnection().transaction(async transactionalEntityManager => {
+ const meta = await transactionalEntityManager.findOne(Meta, {
+ order: {
+ id: 'DESC'
+ }
+ });
- if (meta) {
- await Metas.update(meta.id, set);
- } else {
- await Metas.save(set);
- }
+ if (meta) {
+ await transactionalEntityManager.update(Meta, meta.id, set);
+ } else {
+ await transactionalEntityManager.save(Meta, set);
+ }
+ });
});
diff --git a/src/services/chart/core.ts b/src/services/chart/core.ts
index 0a9ec8dae0..fe762f2b24 100644
--- a/src/services/chart/core.ts
+++ b/src/services/chart/core.ts
@@ -79,7 +79,7 @@ export default abstract class Chart<T extends Record<string, any>> {
flatColumns(v.properties, p);
} else {
columns[this.columnPrefix + p] = {
- type: 'integer',
+ type: 'bigint',
};
}
}
diff --git a/src/services/drive/delete-file.ts b/src/services/drive/delete-file.ts
index bba453b982..f1280822a4 100644
--- a/src/services/drive/delete-file.ts
+++ b/src/services/drive/delete-file.ts
@@ -2,7 +2,7 @@ import * as Minio from 'minio';
import config from '../../config';
import { DriveFile } from '../../models/entities/drive-file';
import { InternalStorage } from './internal-storage';
-import { DriveFiles, Instances } from '../../models';
+import { DriveFiles, Instances, Notes } from '../../models';
import { driveChart, perUserDriveChart, instanceChart } from '../chart';
export default async function(file: DriveFile, isExpired = false) {
@@ -40,6 +40,11 @@ export default async function(file: DriveFile, isExpired = false) {
});
} else {
DriveFiles.delete(file.id);
+
+ // TODO: トランザクション
+ Notes.createQueryBuilder().delete()
+ .where(':id = ANY(fileIds)', { id: file.id })
+ .execute();
}
// 統計を更新