Adjusts from review
This commit is contained in:
parent
acc70cc3de
commit
2a5a0bebb3
|
@ -134,9 +134,10 @@ const Topic = RestModel.extend({
|
|||
return this.get('url') + (user ? '?u=' + user.get('username_lower') : '');
|
||||
}.property('url'),
|
||||
|
||||
printUrl: function(){
|
||||
return this.get('url') + '/print';
|
||||
}.property('url'),
|
||||
@computed('url')
|
||||
printUrl(url) {
|
||||
return url + '/print';
|
||||
},
|
||||
|
||||
url: function() {
|
||||
let slug = this.get('slug') || '';
|
||||
|
|
|
@ -7,7 +7,6 @@ export default ContainerView.extend({
|
|||
@on('init')
|
||||
createButtons() {
|
||||
const mobileView = this.site.mobileView;
|
||||
const { siteSettings } = this;
|
||||
|
||||
const topic = this.get('topic');
|
||||
|
||||
|
@ -33,7 +32,7 @@ export default ContainerView.extend({
|
|||
this.attachViewClass('invite-reply-button');
|
||||
}
|
||||
|
||||
if (!mobileView && siteSettings.allow_print_page) {
|
||||
if (!mobileView && this.siteSettings.max_prints_per_hour_per_user > 0) {
|
||||
this.attachViewClass('print-button');
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ class TopicsController < ApplicationController
|
|||
end
|
||||
|
||||
if opts[:print]
|
||||
raise Discourse::InvalidAccess unless SiteSetting.allow_print_page
|
||||
raise Discourse::InvalidAccess unless SiteSetting.max_prints_per_hour_per_user > 0
|
||||
begin
|
||||
RateLimiter.new(current_user, "print-topic-per-hour", 10, 1.hour).performed! unless current_user.admin?
|
||||
RateLimiter.new(current_user, "print-topic-per-hour", 10, 1.hour).performed! unless @guardian.is_admin?
|
||||
rescue RateLimiter::LimitExceeded
|
||||
render_json_error(I18n.t("rate_limiter.slow_down"))
|
||||
end
|
||||
|
|
|
@ -1312,7 +1312,7 @@ en:
|
|||
|
||||
topic_page_title_includes_category: "Topic page title includes the category name."
|
||||
|
||||
allow_print_page: "Enable a special topic page for printing"
|
||||
max_prints_per_hour_per_user: "Maximum number of /print page impressions (set to 0 to disable)"
|
||||
|
||||
full_name_required: "Full name is a required field of a user's profile."
|
||||
enable_names: "Show the user's full name on their profile, user card, and emails. Disable to hide full name everywhere."
|
||||
|
|
|
@ -909,6 +909,9 @@ rate_limits:
|
|||
client: true
|
||||
shadowed_by_global: true
|
||||
default: 0
|
||||
max_prints_per_hour_per_user:
|
||||
default: 0
|
||||
client: true
|
||||
|
||||
developer:
|
||||
force_hostname:
|
||||
|
@ -1220,9 +1223,6 @@ uncategorized:
|
|||
|
||||
topic_page_title_includes_category: true
|
||||
|
||||
allow_print_page:
|
||||
default: true
|
||||
client: true
|
||||
|
||||
user_preferences:
|
||||
default_email_digest_frequency:
|
||||
|
|
|
@ -51,7 +51,7 @@ class TopicView
|
|||
@page = 1 if (!@page || @page.zero?)
|
||||
@chunk_size = case
|
||||
when options[:slow_platform] then TopicView.slow_chunk_size
|
||||
when @print then 1000
|
||||
when @print then TopicView.print_chunk_size
|
||||
else TopicView.chunk_size
|
||||
end
|
||||
@limit ||= @chunk_size
|
||||
|
|
Loading…
Reference in New Issue