投稿の削除イベントを受け取るように
This commit is contained in:
		
							parent
							
								
									1c65cb3e36
								
							
						
					
					
						commit
						b6a330928d
					
				
					 4 changed files with 19 additions and 4 deletions
				
			
		| 
						 | 
					@ -97,6 +97,17 @@ export default prop => ({
 | 
				
			||||||
					this.$_ns_target.poll.choices.find(c => c.id === choice).votes++;
 | 
										this.$_ns_target.poll.choices.find(c => c.id === choice).votes++;
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									case 'deleted': {
 | 
				
			||||||
 | 
										Vue.set(this.$_ns_target, 'deletedAt', body.deletedAt);
 | 
				
			||||||
 | 
										this.$_ns_target.text = null;
 | 
				
			||||||
 | 
										this.$_ns_target.tags = [];
 | 
				
			||||||
 | 
										this.$_ns_target.fileIds = [];
 | 
				
			||||||
 | 
										this.$_ns_target.poll = null;
 | 
				
			||||||
 | 
										this.$_ns_target.geo = null;
 | 
				
			||||||
 | 
										this.$_ns_target.cw = null;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			this.$emit(`update:${prop}`, this.$_ns_note_);
 | 
								this.$emit(`update:${prop}`, this.$_ns_note_);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@
 | 
				
			||||||
					<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
 | 
										<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<footer>
 | 
								<footer v-if="p.deletedAt == null">
 | 
				
			||||||
				<mk-reactions-viewer :note="p" ref="reactionsViewer"/>
 | 
									<mk-reactions-viewer :note="p" ref="reactionsViewer"/>
 | 
				
			||||||
				<button class="replyButton" @click="reply()" title="%i18n:@reply%">
 | 
									<button class="replyButton" @click="reply()" title="%i18n:@reply%">
 | 
				
			||||||
					<template v-if="p.reply">%fa:reply-all%</template>
 | 
										<template v-if="p.reply">%fa:reply-all%</template>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
				<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
 | 
									<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<footer>
 | 
								<footer v-if="p.deletedAt == null">
 | 
				
			||||||
				<mk-reactions-viewer :note="p" ref="reactionsViewer"/>
 | 
									<mk-reactions-viewer :note="p" ref="reactionsViewer"/>
 | 
				
			||||||
				<button @click="reply">
 | 
									<button @click="reply">
 | 
				
			||||||
					<template v-if="p.reply">%fa:reply-all%</template>
 | 
										<template v-if="p.reply">%fa:reply-all%</template>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,12 +15,14 @@ import config from '../../config';
 | 
				
			||||||
 * @param note 投稿
 | 
					 * @param note 投稿
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export default async function(user: IUser, note: INote) {
 | 
					export default async function(user: IUser, note: INote) {
 | 
				
			||||||
 | 
						const deletedAt = new Date();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	await Note.update({
 | 
						await Note.update({
 | 
				
			||||||
		_id: note._id,
 | 
							_id: note._id,
 | 
				
			||||||
		userId: user._id
 | 
							userId: user._id
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		$set: {
 | 
							$set: {
 | 
				
			||||||
			deletedAt: new Date(),
 | 
								deletedAt: deletedAt,
 | 
				
			||||||
			text: null,
 | 
								text: null,
 | 
				
			||||||
			tags: [],
 | 
								tags: [],
 | 
				
			||||||
			fileIds: [],
 | 
								fileIds: [],
 | 
				
			||||||
| 
						 | 
					@ -30,7 +32,9 @@ export default async function(user: IUser, note: INote) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	publishNoteStream(note._id, 'deleted', {});
 | 
						publishNoteStream(note._id, 'deleted', {
 | 
				
			||||||
 | 
							deletedAt: deletedAt
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//#region ローカルの投稿なら削除アクティビティを配送
 | 
						//#region ローカルの投稿なら削除アクティビティを配送
 | 
				
			||||||
	if (isLocalUser(user)) {
 | 
						if (isLocalUser(user)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue