Skip to content

Commit

Permalink
가입 승인제 관련 수정
Browse files Browse the repository at this point in the history
- yaml config 에서 approvalRequiredForSignup 제거
  - config을 사용하고 있던 부분을 제거하고, DB의 설정값을 대신 사용
- MkVisitorDashboard 에서 approvalRequiredForSignup 에 따라 컨트롤이
	가입 버튼이 다르게 보이도록
- 제어판에서 approvalRequiredForSignup 을 켜면 켜지도록
  • Loading branch information
seojangho committed Nov 29, 2024
1 parent 2ffcee3 commit a9a6495
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 0 additions & 5 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ type Source = {
perUserNotificationsMaxCount?: number;
deactivateAntennaThreshold?: number;
pidFile: string;

approvalRequiredForSignup: boolean;
};

export type Config = {
Expand Down Expand Up @@ -192,8 +190,6 @@ export type Config = {
perUserNotificationsMaxCount: number;
deactivateAntennaThreshold: number;
pidFile: string;

approvalRequiredForSignup: boolean;
};

const _filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -306,7 +302,6 @@ export function loadConfig(): Config {
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
pidFile: config.pidFile,
skebStatus: undefined,
approvalRequiredForSignup: config.approvalRequiredForSignup,
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/core/entities/MetaEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class MetaEntityService {
noteSearchableScope: (this.config.meilisearch == null || this.config.meilisearch.scope !== 'local') ? 'global' : 'local',
maxFileSize: this.config.maxFileSize,

approvalRequiredForSignup: this.config.approvalRequiredForSignup,
approvalRequiredForSignup: instance.approvalRequiredForSignup,
};

return packed;
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkVisitorDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkInfo warn>{{ i18n.ts.approvalRequiredToRegister }}</MkInfo>
</div>
<div class="_gaps_s" :class="$style.mainActions">
<MkButton :class="$style.mainAction" full rounded data-cy-signup style="margin-right: 12px; display: none;" @click="signup()">{{ i18n.ts.joinThisServer }}</MkButton>
<div v-if="instance.approvalRequiredForSignup">
<MkButton :class="$style.mainAction" full rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.joinThisServer }}</MkButton>
</div>
<MkButton :class="$style.mainAction" full rounded link to="https://misskey-hub.net/servers/">{{ i18n.ts.exploreOtherServers }}</MkButton>
<MkButton :class="$style.mainAction" full rounded gradate data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton>
</div>
Expand Down
10 changes: 9 additions & 1 deletion packages/frontend/src/pages/admin/moderation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
</MkSwitch>

<MkSwitch v-model="approvalRequiredForSignup">
<MkSwitch v-model="approvalRequiredForSignup" @change="onChange_approvalRequiredForSignup">
<template #label>{{ i18n.ts.approvalRequiredForSignup }}</template>
<template #caption>{{ i18n.ts.registerApprovalEmailRecommended }}</template>
</MkSwitch>
Expand Down Expand Up @@ -200,6 +200,14 @@ function onChange_emailRequiredForSignup(value: boolean) {
});
}

function onChange_approvalRequiredForSignup(value: boolean) {
os.apiWithDialog('admin/update-meta', {
approvalRequiredForSignup: value,
}).then(() => {
fetchInstance(true);
});
}

function save_preservedUsernames() {
os.apiWithDialog('admin/update-meta', {
disableRegistration: !enableRegistration.value,
Expand Down

0 comments on commit a9a6495

Please sign in to comment.