サイレンス, ブロック, ミュートの確認表示 for v10 (#4744)
* confirm on user menu * confirm silence * Resolve #4554
This commit is contained in:
		
							parent
							
								
									e62bb7cdaf
								
							
						
					
					
						commit
						45b94086ed
					
				
					 4 changed files with 42 additions and 8 deletions
				
			
		|  | @ -513,8 +513,12 @@ common/views/components/user-menu.vue: | |||
|   mention: "メンション" | ||||
|   mute: "ミュート" | ||||
|   unmute: "ミュート解除" | ||||
|   mute-confirm: "このユーザーをミュートしますか?" | ||||
|   unmute-confirm: "このユーザーをミュート解除しますか?" | ||||
|   block: "ブロック" | ||||
|   unblock: "ブロック解除" | ||||
|   block-confirm: "このユーザーをブロックしますか?" | ||||
|   unblock-confirm: "このユーザーをブロック解除しますか?" | ||||
|   push-to-list: "リストに追加" | ||||
|   select-list: "リストを選択してください" | ||||
|   report-abuse: "スパムを報告" | ||||
|  | @ -522,8 +526,12 @@ common/views/components/user-menu.vue: | |||
|   report-abuse-reported: "管理者に報告されました。ご協力ありがとうございました。" | ||||
|   silence: "サイレンス" | ||||
|   unsilence: "サイレンス解除" | ||||
|   silence-confirm: "このユーザーをサイレンスしますか?" | ||||
|   unsilence-confirm: "このユーザーをサイレンス解除しますか?" | ||||
|   suspend: "凍結" | ||||
|   unsuspend: "凍結解除" | ||||
|   suspend-confirm: "このユーザーを凍結しますか?" | ||||
|   unsuspend-confirm: "このユーザーを凍結解除しますか?" | ||||
| 
 | ||||
| common/views/components/poll.vue: | ||||
|   vote-to: "「{}」に投票する" | ||||
|  | @ -1330,7 +1338,9 @@ admin/views/users.vue: | |||
|   unsuspend-confirm: "凍結を解除しますか?" | ||||
|   unsuspended: "凍結を解除しました" | ||||
|   make-silence: "サイレンス" | ||||
|   silence-confirm: "サイレンスしますか?" | ||||
|   unmake-silence: "サイレンスの解除" | ||||
|   unsilence-confirm: "サイレンスを解除しますか?" | ||||
|   verify: "公式アカウントにする" | ||||
|   verify-confirm: "公式アカウントにしますか?" | ||||
|   verified: "公式アカウントにしました" | ||||
|  |  | |||
|  | @ -232,6 +232,8 @@ export default Vue.extend({ | |||
| 		}, | ||||
| 
 | ||||
| 		async silenceUser() { | ||||
| 			if (!await this.getConfirmed(this.$t('silence-confirm'))) return; | ||||
| 
 | ||||
| 			const process = async () => { | ||||
| 				await this.$root.api('admin/silence-user', { userId: this.user._id }); | ||||
| 				this.$root.dialog({ | ||||
|  | @ -251,6 +253,8 @@ export default Vue.extend({ | |||
| 		}, | ||||
| 
 | ||||
| 		async unsilenceUser() { | ||||
| 			if (!await this.getConfirmed(this.$t('unsilence-confirm'))) return; | ||||
| 
 | ||||
| 			const process = async () => { | ||||
| 				await this.$root.api('admin/unsilence-user', { userId: this.user._id }); | ||||
| 				this.$root.dialog({ | ||||
|  |  | |||
|  | @ -183,9 +183,6 @@ export default Vue.extend({ | |||
| 	height 100% | ||||
| 
 | ||||
| 	&.splash | ||||
| 		&, * | ||||
| 			pointer-events none !important | ||||
| 
 | ||||
| 		> .main | ||||
| 			min-width 0 | ||||
| 			width initial | ||||
|  |  | |||
|  | @ -89,8 +89,10 @@ export default Vue.extend({ | |||
| 			}); | ||||
| 		}, | ||||
| 
 | ||||
| 		toggleMute() { | ||||
| 		async toggleMute() { | ||||
| 			if (this.user.isMuted) { | ||||
| 				if (!await this.getConfirmed(this.$t('unmute-confirm'))) return; | ||||
| 
 | ||||
| 				this.$root.api('mute/delete', { | ||||
| 					userId: this.user.id | ||||
| 				}).then(() => { | ||||
|  | @ -102,6 +104,8 @@ export default Vue.extend({ | |||
| 					}); | ||||
| 				}); | ||||
| 			} else { | ||||
| 				if (!await this.getConfirmed(this.$t('mute-confirm'))) return; | ||||
| 
 | ||||
| 				this.$root.api('mute/create', { | ||||
| 					userId: this.user.id | ||||
| 				}).then(() => { | ||||
|  | @ -115,8 +119,10 @@ export default Vue.extend({ | |||
| 			} | ||||
| 		}, | ||||
| 
 | ||||
| 		toggleBlock() { | ||||
| 		async toggleBlock() { | ||||
| 			if (this.user.isBlocking) { | ||||
| 				if (!await this.getConfirmed(this.$t('unblock-confirm'))) return; | ||||
| 
 | ||||
| 				this.$root.api('blocking/delete', { | ||||
| 					userId: this.user.id | ||||
| 				}).then(() => { | ||||
|  | @ -128,6 +134,8 @@ export default Vue.extend({ | |||
| 					}); | ||||
| 				}); | ||||
| 			} else { | ||||
| 				if (!await this.getConfirmed(this.$t('block-confirm'))) return; | ||||
| 
 | ||||
| 				this.$root.api('blocking/create', { | ||||
| 					userId: this.user.id | ||||
| 				}).then(() => { | ||||
|  | @ -164,7 +172,9 @@ export default Vue.extend({ | |||
| 			}); | ||||
| 		}, | ||||
| 
 | ||||
| 		toggleSilence() { | ||||
| 		async toggleSilence() { | ||||
| 			if (!await this.getConfirmed(this.$t(this.user.isSilenced ? 'unsilence-confirm' : 'silence-confirm'))) return; | ||||
| 
 | ||||
| 			this.$root.api(this.user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', { | ||||
| 				userId: this.user.id | ||||
| 			}).then(() => { | ||||
|  | @ -181,7 +191,9 @@ export default Vue.extend({ | |||
| 			}); | ||||
| 		}, | ||||
| 
 | ||||
| 		toggleSuspend() { | ||||
| 		async toggleSuspend() { | ||||
| 			if (!await this.getConfirmed(this.$t(this.user.isSuspended ? 'unsuspend-confirm' : 'suspend-confirm'))) return; | ||||
| 
 | ||||
| 			this.$root.api(this.user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', { | ||||
| 				userId: this.user.id | ||||
| 			}).then(() => { | ||||
|  | @ -196,7 +208,18 @@ export default Vue.extend({ | |||
| 					text: e | ||||
| 				}); | ||||
| 			}); | ||||
| 		} | ||||
| 		}, | ||||
| 
 | ||||
| 		async getConfirmed(text: string): Promise<Boolean> { | ||||
| 			const confirm = await this.$root.dialog({ | ||||
| 				type: 'warning', | ||||
| 				showCancelButton: true, | ||||
| 				title: 'confirm', | ||||
| 				text, | ||||
| 			}); | ||||
| 
 | ||||
| 			return !confirm.canceled; | ||||
| 		}, | ||||
| 	} | ||||
| }); | ||||
| </script> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue