mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
FIX: force refresh staff action logs when transitioning from site settings (#12096)
This commit is contained in:
parent
fa3eb1f7fc
commit
94036a6f49
@ -7,6 +7,14 @@ export default DiscourseRoute.extend({
|
||||
filters: { refreshModel: true },
|
||||
},
|
||||
|
||||
beforeModel(transition) {
|
||||
const params = transition.to.queryParams;
|
||||
const controller = this.controllerFor("admin-logs-staff-action-logs");
|
||||
if (controller.filters === null || params.force_refresh) {
|
||||
controller.resetFilters();
|
||||
}
|
||||
},
|
||||
|
||||
deserializeQueryParam(value, urlKey, defaultValueType) {
|
||||
if (urlKey === "filters") {
|
||||
return EmberObject.create(JSON.parse(decodeURIComponent(value)));
|
||||
@ -27,13 +35,6 @@ export default DiscourseRoute.extend({
|
||||
return this._super(value, urlKey, defaultValueType);
|
||||
},
|
||||
|
||||
activate() {
|
||||
const controller = this.controllerFor("admin-logs-staff-action-logs");
|
||||
if (controller.filters === null) {
|
||||
controller.resetFilters();
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: make this automatic using an `{{outlet}}`
|
||||
renderTemplate() {
|
||||
this.render("admin/templates/logs/staff-action-logs", {
|
||||
|
@ -2,7 +2,7 @@
|
||||
<h3>
|
||||
{{#if staffLogFilter}}
|
||||
{{settingName}}
|
||||
{{#link-to "adminLogs.staffActionLogs" (query-params filters=staffLogFilter) title=(i18n "admin.settings.history")}}
|
||||
{{#link-to "adminLogs.staffActionLogs" (query-params filters=staffLogFilter force_refresh=true) title=(i18n "admin.settings.history")}}
|
||||
<span class="history-icon">
|
||||
{{d-icon "history"}}
|
||||
</span>
|
||||
|
@ -56,7 +56,7 @@ acceptance("Admin - Site Settings", function (needs) {
|
||||
|
||||
assert.equal(
|
||||
queryAll(".row.setting .setting-label h3 a").attr("href"),
|
||||
"/admin/logs/staff_action_logs?filters=%7B%22subject%22%3A%22title%22%2C%22action_name%22%3A%22change_site_setting%22%7D",
|
||||
"/admin/logs/staff_action_logs?filters=%7B%22subject%22%3A%22title%22%2C%22action_name%22%3A%22change_site_setting%22%7D&force_refresh=true",
|
||||
"it links to the staff action log"
|
||||
);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user