DEV: Convert activation-controls to gjs (#25344)

This commit is contained in:
Jarek Radosz 2024-01-22 12:11:22 +01:00 committed by GitHub
parent 749b490188
commit 3fc06e4345
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 27 deletions

View File

@ -0,0 +1,35 @@
import Component from "@glimmer/component";
import { inject as service } from "@ember/service";
import DButton from "discourse/components/d-button";
export default class ActivationControls extends Component {
@service siteSettings;
get canEditEmail() {
return (
this.siteSettings.enable_local_logins || this.siteSettings.email_editable
);
}
<template>
<div class="activation-controls">
{{#unless this.siteSettings.must_approve_users}}
<DButton
@action={{@sendActivationEmail}}
@label="login.resend_title"
@icon="envelope"
class="btn-primary resend"
/>
{{/unless}}
{{#if this.canEditEmail}}
<DButton
@action={{@editActivationEmail}}
@label="login.change_email"
@icon="pencil-alt"
class="edit-email"
/>
{{/if}}
</div>
</template>
}

View File

@ -1,17 +0,0 @@
{{#unless this.siteSettings.must_approve_users}}
<DButton
@action={{this.sendActivationEmail}}
@label="login.resend_title"
@icon="envelope"
class="btn-primary resend"
/>
{{/unless}}
{{#if this.canEditEmail}}
<DButton
@action={{this.editActivationEmail}}
@label="login.change_email"
@icon="pencil-alt"
class="edit-email"
/>
{{/if}}

View File

@ -1,10 +0,0 @@
import Component from "@ember/component";
import { or } from "@ember/object/computed";
export default Component.extend({
classNames: "activation-controls",
canEditEmail: or(
"siteSettings.enable_local_logins",
"siteSettings.email_editable"
),
});