FIX: better error message when forum is in read-only mode

This commit is contained in:
Arpit Jalan 2019-12-24 15:49:27 +05:30
parent 86fb08d04a
commit 2c0574010a
3 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,6 @@
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
function exportEntityByType(type, entity, args) {
return ajax("/export_csv/export_entity.json", {
method: "POST",
@ -11,9 +13,7 @@ export function exportUserArchive() {
.then(function() {
bootbox.alert(I18n.t("user.download_archive.success"));
})
.catch(function() {
bootbox.alert(I18n.t("user.download_archive.rate_limit_error"));
});
.catch(popupAjaxError);
}
export function exportEntity(entity, args) {

View File

@ -9,6 +9,8 @@ class ExportCsvController < ApplicationController
Jobs.enqueue(:export_csv_file, entity: export_params[:entity], user_id: current_user.id, args: export_params[:args])
StaffActionLogger.new(current_user).log_entity_export(export_params[:entity])
render json: success_json
rescue Discourse::InvalidAccess
return render_json_error I18n.t("csv_export.rate_limit_error")
end
private

View File

@ -575,7 +575,6 @@ en:
attributes:
word:
too_many: "Too many words for that action"
uncategorized_category_name: "Uncategorized"
@ -3760,6 +3759,7 @@ en:
csv_export:
boolean_yes: "Yes"
boolean_no: "No"
rate_limit_error: "Posts can be downloaded once per day, please try again tomorrow."
static_topic_first_reply: |
Edit the first post in this topic to change the contents of the %{page_name} page.