mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 22:03:08 +02:00
Set empty array instead of null to mediaIds property of posts
This commit is contained in:
parent
4e37ee541a
commit
8c41432907
10 changed files with 11 additions and 10 deletions
|
@ -17,7 +17,7 @@
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<mk-post-html v-if="post.ast" :ast="post.ast" :i="os.i" :class="$style.text"/>
|
<mk-post-html v-if="post.ast" :ast="post.ast" :i="os.i" :class="$style.text"/>
|
||||||
<div class="media" v-if="post.media">
|
<div class="media" v-if="post.media > 0">
|
||||||
<mk-media-list :media-list="post.media"/>
|
<mk-media-list :media-list="post.media"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<mk-post-html :class="$style.text" v-if="p.ast" :ast="p.ast" :i="os.i"/>
|
<mk-post-html :class="$style.text" v-if="p.ast" :ast="p.ast" :i="os.i"/>
|
||||||
<div class="media" v-if="p.media">
|
<div class="media" v-if="p.media.length > 0">
|
||||||
<mk-media-list :media-list="p.media"/>
|
<mk-media-list :media-list="p.media"/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll v-if="p.poll" :post="p"/>
|
<mk-poll v-if="p.poll" :post="p"/>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/>
|
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/>
|
||||||
<a class="rp" v-if="p.repost">RP:</a>
|
<a class="rp" v-if="p.repost">RP:</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="media" v-if="p.media">
|
<div class="media" v-if="p.media.length > 0">
|
||||||
<mk-media-list :media-list="p.media"/>
|
<mk-media-list :media-list="p.media"/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll v-if="p.poll" :post="p" ref="pollViewer"/>
|
<mk-poll v-if="p.poll" :post="p" ref="pollViewer"/>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<mk-post-html :ast="post.ast" :i="os.i"/>
|
<mk-post-html :ast="post.ast" :i="os.i"/>
|
||||||
<a class="rp" v-if="post.repostId" :href="`/post:${post.repostId}`">RP: ...</a>
|
<a class="rp" v-if="post.repostId" :href="`/post:${post.repostId}`">RP: ...</a>
|
||||||
</div>
|
</div>
|
||||||
<details v-if="post.media">
|
<details v-if="post.media.length > 0">
|
||||||
<summary>({{ post.media.length }}つのメディア)</summary>
|
<summary>({{ post.media.length }}つのメディア)</summary>
|
||||||
<mk-media-list :media-list="post.media"/>
|
<mk-media-list :media-list="post.media"/>
|
||||||
</details>
|
</details>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<div class="tags" v-if="p.tags && p.tags.length > 0">
|
<div class="tags" v-if="p.tags && p.tags.length > 0">
|
||||||
<router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
|
<router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="media" v-if="p.media">
|
<div class="media" v-if="p.media.length > 0">
|
||||||
<mk-media-list :media-list="p.media"/>
|
<mk-media-list :media-list="p.media"/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll v-if="p.poll" :post="p"/>
|
<mk-poll v-if="p.poll" :post="p"/>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/>
|
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/>
|
||||||
<a class="rp" v-if="p.repost != null">RP:</a>
|
<a class="rp" v-if="p.repost != null">RP:</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="media" v-if="p.media">
|
<div class="media" v-if="p.media.length > 0">
|
||||||
<mk-media-list :media-list="p.media"/>
|
<mk-media-list :media-list="p.media"/>
|
||||||
</div>
|
</div>
|
||||||
<mk-poll v-if="p.poll" :post="p" ref="pollViewer"/>
|
<mk-poll v-if="p.poll" :post="p" ref="pollViewer"/>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<mk-post-html v-if="post.ast" :ast="post.ast" :i="os.i"/>
|
<mk-post-html v-if="post.ast" :ast="post.ast" :i="os.i"/>
|
||||||
<a class="rp" v-if="post.repostId">RP: ...</a>
|
<a class="rp" v-if="post.repostId">RP: ...</a>
|
||||||
</div>
|
</div>
|
||||||
<details v-if="post.media">
|
<details v-if="post.media.length > 0">
|
||||||
<summary>({{ post.media.length }}個のメディア)</summary>
|
<summary>({{ post.media.length }}個のメディア)</summary>
|
||||||
<mk-media-list :media-list="post.media"/>
|
<mk-media-list :media-list="post.media"/>
|
||||||
</details>
|
</details>
|
||||||
|
|
|
@ -33,8 +33,8 @@ props:
|
||||||
type: "id(DriveFile)[]"
|
type: "id(DriveFile)[]"
|
||||||
optional: true
|
optional: true
|
||||||
desc:
|
desc:
|
||||||
ja: "添付されているメディアのID"
|
ja: "添付されているメディアのID (なければレスポンスでは空配列)"
|
||||||
en: "The IDs of the attached media"
|
en: "The IDs of the attached media (empty array for response if no media is attached)"
|
||||||
- name: "media"
|
- name: "media"
|
||||||
type: "entity(DriveFile)[]"
|
type: "entity(DriveFile)[]"
|
||||||
optional: true
|
optional: true
|
||||||
|
|
|
@ -254,7 +254,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
channelId: channel ? channel._id : undefined,
|
channelId: channel ? channel._id : undefined,
|
||||||
index: channel ? channel.index + 1 : undefined,
|
index: channel ? channel.index + 1 : undefined,
|
||||||
mediaIds: files ? files.map(file => file._id) : undefined,
|
mediaIds: files ? files.map(file => file._id) : [],
|
||||||
replyId: reply ? reply._id : undefined,
|
replyId: reply ? reply._id : undefined,
|
||||||
repostId: repost ? repost._id : undefined,
|
repostId: repost ? repost._id : undefined,
|
||||||
poll: poll,
|
poll: poll,
|
||||||
|
|
1
tools/migration/nighthike/6.js
Normal file
1
tools/migration/nighthike/6.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
db.posts.update({ mediaIds: null }, { $set: { mediaIds: [] } }, false, true);
|
Loading…
Reference in a new issue