2024-09-17 14:43:34 +08:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { action } from "@ember/object";
|
2024-10-07 13:14:01 +08:00
|
|
|
import { service } from "@ember/service";
|
2024-09-17 14:43:34 +08:00
|
|
|
import { htmlSafe } from "@ember/template";
|
|
|
|
import DButton from "discourse/components/d-button";
|
|
|
|
import icon from "discourse-common/helpers/d-icon";
|
|
|
|
|
|
|
|
export default class AdminNotice extends Component {
|
2024-10-07 13:14:01 +08:00
|
|
|
@service currentUser;
|
|
|
|
|
2024-09-17 14:43:34 +08:00
|
|
|
@action
|
|
|
|
dismiss() {
|
|
|
|
this.args.dismissCallback(this.args.problem);
|
|
|
|
}
|
|
|
|
|
2024-10-07 13:14:01 +08:00
|
|
|
get canDismiss() {
|
|
|
|
return this.currentUser.admin;
|
|
|
|
}
|
|
|
|
|
2024-09-17 14:43:34 +08:00
|
|
|
<template>
|
|
|
|
<div class="notice">
|
|
|
|
<div class="message">
|
|
|
|
{{if @icon (icon @icon)}}
|
|
|
|
{{htmlSafe @problem.message}}
|
|
|
|
</div>
|
2024-10-07 13:14:01 +08:00
|
|
|
{{#if this.canDismiss}}
|
|
|
|
<DButton
|
|
|
|
@action={{this.dismiss}}
|
|
|
|
@label="admin.dashboard.dismiss_notice"
|
|
|
|
/>
|
|
|
|
{{/if}}
|
2024-09-17 14:43:34 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
}
|