Skip to content

Commit

Permalink
Merge pull request #58 from atsu1125/disableinvalidbutton
Browse files Browse the repository at this point in the history
Disableinvalidbutton
  • Loading branch information
atsu1125 authored Jan 16, 2023
2 parents 6285f10 + 8448c72 commit 66c98c7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/client/components/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<MkEllipsis v-if="loadingAccounts" class="item" />
<div class="divider" v-if="accounts.length > 0"></div>
<button class="item _button" @click="addAcount" v-text="$ts.addAcount"/>
<button class="item _button" @click="createAccount" v-text="$ts.createAccount"/>
<button class="item _button" @click="createAccount" v-if="meta && !(meta.disableRegistration && meta.disableInvitation)" v-text="$ts.createAccount"/>
<button class="item danger _button" @click="signout" v-text="$ts.logout"/>
</template>
</div>
Expand Down Expand Up @@ -544,7 +544,7 @@ export default defineComponent({
&:first-child, &:last-child {
position: sticky;
background: var(--bg);
z-index: 1;
z-index: 1;
}
&:first-child {
Expand Down
4 changes: 2 additions & 2 deletions src/client/pages/instance/user-dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<MkSwitch @update:value="toggleVerify" v-model:value="verified">{{ $ts.verify }}</MkSwitch>
<MkSwitch @update:value="togglePremium" v-model:value="premium">{{ $ts.premium }}</MkSwitch>
<MkSwitch @update:value="toggleSilence" v-model:value="silenced">{{ $ts.silence }}</MkSwitch>
<MkSwitch @update:value="toggleSuspend" v-model:value="suspended">{{ $ts.suspend }}</MkSwitch>
<MkSwitch @update:value="toggleSuspend" v-model:value="suspended" :disabled="(user.isModerator || user.isAdmin) && !user.isSuspended">{{ $ts.suspend }}</MkSwitch>
</div>
</div>
<div class="_section">
Expand All @@ -39,7 +39,7 @@
<MkButton full v-if="user.host != null" @click="updateRemoteUser"><Fa :icon="faSync"/> {{ $ts.updateRemoteUser }}</MkButton>
<MkButton full @click="resetPassword"><Fa :icon="faKey"/> {{ $ts.resetPassword }}</MkButton>
<MkButton full @click="deleteAllFiles" danger><Fa :icon="faTrashAlt"/> {{ $ts.deleteAllFiles }}</MkButton>
<MkButton v-if="!user.isModerator && !user.isAdmin" full @click="deleteAccount" danger><Fa :icon="faTrashAlt"/> {{ $ts.deleteAccount }}</MkButton>
<MkButton full @click="deleteAccount" danger :disabled="user.isModerator || user.isAdmin"><Fa :icon="faTrashAlt"/> {{ $ts.deleteAccount }}</MkButton>
</div>
</div>
<div class="_section">
Expand Down
2 changes: 1 addition & 1 deletion src/client/pages/welcome.entrance.a.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
</div>
<div class="action">
<MkButton @click="signup()" inline primary>{{ $ts.signup }}</MkButton>
<MkButton @click="signup()" inline primary v-if="meta && !(meta.disableRegistration && meta.disableInvitation)">{{ $ts.signup }}</MkButton>
<MkButton @click="signin()" inline>{{ $ts.login }}</MkButton>
<MkButton inline style="margin-left: 12px;" onclick="window.location.href='/explore'">{{ $ts.explore }}</MkButton>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/client/scripts/get-user-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ export function getUserMenu(user) {
icon: faMicrophoneSlash,
text: user.isSilenced ? i18n.locale.unsilence : i18n.locale.silence,
action: toggleSilence
}, {
}]);
}

if ($i && ($i.isAdmin || $i.isModerator) && ((!user.isAdmin && !user.isModerator) || ((user.isAdmin || user.isModerator) && user.isSuspended))) {
menu = menu.concat([{
icon: faSnowflake,
text: user.isSuspended ? i18n.locale.unsuspend : i18n.locale.suspend,
action: toggleSuspend
Expand Down
4 changes: 0 additions & 4 deletions src/server/api/endpoints/users/report-abuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ export default define(meta, async (ps, me) => {
throw new ApiError(meta.errors.cannotReportYourself);
}

if (user.isAdmin) {
throw new ApiError(meta.errors.cannotReportAdmin);
}

const report = await AbuseUserReports.save({
id: genId(),
createdAt: new Date(),
Expand Down

0 comments on commit 66c98c7

Please sign in to comment.