core&ui: move domain_delete to domain_dashboard page

This commit is contained in:
undefined committed 2023-03-02 15:15:36 +08:00
1 parent ebc3d83ea0
commit 09240c6166
3 files changed
+24 -22

No files matched your search

+8 -8
View File
@@ -99,14 +99,6 @@ class DomainEditHandler extends ManageHandler {
await domain.edit(args.domainId, $set);
this.response.redirect = this.url('domain_dashboard');
}
@requireSudo
async postDelete({ domainId }) {
if (domainId === 'system') throw new CannotDeleteSystemDomainError();
if (this.domain.owner !== this.user._id) throw new OnlyOwnerCanDeleteDomainError();
await domain.del(domainId);
this.response.redirect = this.url('home_domain', { domainId: 'system' });
}
}
class DomainDashboardHandler extends ManageHandler {
@@ -129,6 +121,14 @@ class DomainDashboardHandler extends ManageHandler {
}
this.back();
}
@requireSudo
async postDelete({ domainId }) {
if (domainId === 'system') throw new CannotDeleteSystemDomainError();
if (this.domain.owner !== this.user._id) throw new OnlyOwnerCanDeleteDomainError();
await domain.del(domainId);
this.response.redirect = this.url('home_domain', { domainId: 'system' });
}
}
class DomainUserHandler extends ManageHandler {
@@ -26,4 +26,20 @@
</dl>
</div>
</div>
{% if handler.user._id == owner._id %}
<div class="section">
<div class="section__header">
<h1 class="section__title" data-heading>{{ _('Delete Domain') }}</h1>
<div class="section__tools">
<form method="POST">
<div>
<input type="hidden" name="operation" value="delete">
<input type="submit" value="{{ _('Delete Domain') }}" class="rounded primary button">
</div>
</form>
</div>
</div>
<div class="section__body"></div>
</div>
{% endif %}
{% endblock %}
@@ -3,18 +3,4 @@
<div class="section">
{% include "partials/setting.html" %}
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title" data-heading>{{ _('Delete Domain') }}</h1>
<div class="section__tools">
<form method="POST">
<div>
<input type="hidden" name="operation" value="delete">
<input type="submit" value="{{ _('Delete Domain') }}" class="rounded primary button">
</div>
</form>
</div>
</div>
<div class="section__body"></div>
</div>
{% endblock %}