A platform for community discussion. Free, open, simple.
FIX: better error message when forum is in read-only mode
Arpit Jalan2c0574010aaf
diff --git a/app/assets/javascripts/discourse/lib/export-csv.js.es6 b/app/assets/javascripts/discourse/lib/export-csv.js.es6index 9f604f6e45f..39b19771f36 100644--- a/app/assets/javascripts/discourse/lib/export-csv.js.es6+++ b/app/assets/javascripts/discourse/lib/export-csv.js.es6@@ -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) {diff --git a/app/controllers/export_csv_controller.rb b/app/controllers/export_csv_controller.rbindex 8c724947250..4b461fcc566 100644--- a/app/controllers/export_csv_controller.rb+++ b/app/controllers/export_csv_controller.rb@@ -9,6 +9,8 @@ class ExportCsvController < ApplicationControllerJobs.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")endprivatediff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 9cc4d0ace8a..a3122c73d97 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -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.