Skip to content

Commit

Permalink
Feat: Revoke Invitation Codes
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Jan 3, 2023
1 parent 6285f10 commit 2da90e7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ showVoteConfirm: "Show confirmation dialog before voting"
voteConfirm: "Are you sure that you want to vote?"
deleteAccount: "Delete Account"
deleteAccountConfirm: "Are you sure that you want to delete this account?"
inviteRevoke: "Revoke All Invitation Codes"
inviteRevokeConfirm: "Are you sure that you want to revoke all invitation codes?"

_template:
edit: "Edit Template..."
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,8 @@ showVoteConfirm: "投票する前に確認ダイアログを表示する"
voteConfirm: "投票しますか?"
deleteAccount: "アカウント削除"
deleteAccountConfirm: "本当にこのアカウントを削除しますか?"
inviteRevoke: "全ての招待コードを失効する"
inviteRevokeConfirm: "本当に全ての招待コードを失効させますか?"

_template:
edit: "定型文を編集…"
Expand Down
18 changes: 17 additions & 1 deletion src/client/pages/instance/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
<MkInput v-model:value="disableInvitationReason">{{ $ts.disableInvitationReason }}</MkInput>
<MkButton primary @click="save(true)"><fa :icon="faSave"/> {{ $ts.save }}</MkButton>
</template>
<MkButton v-else @click="invite">{{ $ts.invite }}</MkButton>
<MkButton v-if="!enableRegistration && enableInvitation" @click="invite">{{ $ts.invite }}</MkButton>
<MkButton v-if="!enableRegistration && enableInvitation" @click="inviteRevoke" danger>{{ $ts.inviteRevoke }}</MkButton>
</template>
</div>
</section>
Expand Down Expand Up @@ -504,6 +505,21 @@ export default defineComponent({
});
},
inviteRevoke() {
os.api('admin/invite-revoke').then(x => {
os.dialog({
type: 'warning',
showCancelButton: true,
text: this.$ts.inviteRevokeConfirm,
});
}).then(({ canceled }) => {
os.dialog({
type: 'error',
text: e
});
});
},
addPinUser() {
os.selectUser().then(user => {
this.pinnedUsers = this.pinnedUsers.trim();
Expand Down
20 changes: 20 additions & 0 deletions src/server/api/endpoints/admin/invite-revoke.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import define from '../../define';
import { RegistrationTickets } from '../../../../models';

export const meta = {
desc: {
'ja-JP': '招待コードを失効します。'
},

tags: ['admin'],

requireCredential: true as const,
requireModerator: true,

params: {}
};

export default define(meta, async () => {
await RegistrationTickets.delete({
});
});

0 comments on commit 2da90e7

Please sign in to comment.