Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

招待コードを失効する機能 Feat: Revoke Invitation Codes #57

Open
wants to merge 1 commit into
base: sakura-tel/develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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({
});
});