Skip to content

Commit

Permalink
リモート情報更新ボタンをメニューに追加
Browse files Browse the repository at this point in the history
  • Loading branch information
EbiseLutica authored and atsu1125 committed Nov 30, 2022
1 parent 3645a38 commit 4594b7b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ common/views/components/user-menu.vue:
suspend-confirm: "Are you sure that you want to suspend this user?"
unsuspend-confirm: "Are you sure that you want to unsuspend this user?"
confirm: "Confirm"
update-remote-user: "Update information about remote user"
remote-user-updated: "The information regarding the remote user has been updated."
common/views/components/poll.vue:
vote-to: "Vote for '{}'"
vote-count: "{} votes"
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,8 @@ common/views/components/user-menu.vue:
suspend-confirm: "このユーザーを凍結しますか?"
unsuspend-confirm: "このユーザーを凍結解除しますか?"
confirm: "確認"
update-remote-user: "リモートユーザー情報の更新"
remote-user-updated: "リモートユーザー情報を更新しました"

common/views/components/poll.vue:
vote-to: "「{}」に投票する"
Expand Down
22 changes: 20 additions & 2 deletions src/client/app/common/views/components/user-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import { faExclamationCircle, faMicrophoneSlash } from '@fortawesome/free-solid-svg-icons';
import { faExclamationCircle, faMicrophoneSlash, faSync } from '@fortawesome/free-solid-svg-icons';
import { faSnowflake } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({
Expand Down Expand Up @@ -59,7 +59,16 @@ export default Vue.extend({
}
if (this.$store.getters.isSignedIn && (this.$store.state.i.isAdmin || this.$store.state.i.isModerator)) {
menu = menu.concat([null, {
menu = menu.concat(null);
if (this.user.host != null) {
menu = menu.concat({
icon: faSync,
text: this.$t("update-remote-user"),
action: this.updateRemoteUser,
});
}
menu = menu.concat([{
icon: faMicrophoneSlash,
text: this.user.isSilenced ? this.$t('unsilence') : this.$t('silence'),
action: this.toggleSilence
Expand Down Expand Up @@ -254,6 +263,15 @@ export default Vue.extend({
return !confirm.canceled;
},
async updateRemoteUser() {
const updated = this.$t('remote-user-updated'); // なぜか後で参照すると null になるので最初にメモリに確保しておく
await this.$root.api('admin/update-remote-user', { userId: this.user.id });
this.$root.dialog({
type: 'success',
text: updated
});
}
}
});
</script>

0 comments on commit 4594b7b

Please sign in to comment.