summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-30 12:15:41 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-30 12:15:41 +0900
commit759719d1249f8f8a5644dff3abf26278c77355c7 (patch)
treef81945f27309846628dd5340f39862fa1d34d3e3 /src/models
parent:art: (diff)
downloadsharkey-759719d1249f8f8a5644dff3abf26278c77355c7.tar.gz
sharkey-759719d1249f8f8a5644dff3abf26278c77355c7.tar.bz2
sharkey-759719d1249f8f8a5644dff3abf26278c77355c7.zip
Improve MisskeyPages
Diffstat (limited to 'src/models')
-rw-r--r--src/models/repositories/page.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts
index 4c1b4cc793..cbe385568e 100644
--- a/src/models/repositories/page.ts
+++ b/src/models/repositories/page.ts
@@ -27,6 +27,33 @@ export class PageRepository extends Repository<Page> {
}
};
collectFile(src.content);
+
+ // 後方互換性のため
+ let migrated = false;
+ const migrate = (xs: any[]) => {
+ for (const x of xs) {
+ if (x.type === 'input') {
+ if (x.inputType === 'text') {
+ x.type = 'textInput';
+ }
+ if (x.inputType === 'number') {
+ x.type = 'numberInput';
+ if (x.default) x.default = parseInt(x.default, 10);
+ }
+ migrated = true;
+ }
+ if (x.children) {
+ migrate(x.children);
+ }
+ }
+ };
+ migrate(src.content);
+ if (migrated) {
+ this.update(src.id, {
+ content: src.content
+ });
+ }
+
return await awaitAll({
id: src.id,
createdAt: src.createdAt.toISOString(),