mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:50:00 +08:00
FIX: display warning when user is tracking too many topics
FEATURE: allow admins to bump up number of tracked topics if needed using max_tracked_new_unread
This commit is contained in:
parent
4e37bcc3e2
commit
00e59bdc62
|
@ -95,6 +95,10 @@ const controllerOpts = {
|
|||
return this.get('model.filter') === 'new' && this.get('model.topics.length') > 0;
|
||||
}.property('model.filter', 'model.topics.length'),
|
||||
|
||||
tooManyTracked: function(){
|
||||
return Discourse.TopicTrackingState.current().tooManyTracked();
|
||||
}.property(),
|
||||
|
||||
showDismissAtTop: function() {
|
||||
return (this.isFilterPage(this.get('model.filter'), 'new') ||
|
||||
this.isFilterPage(this.get('model.filter'), 'unread')) &&
|
||||
|
|
|
@ -237,6 +237,10 @@ const TopicTrackingState = Discourse.Model.extend({
|
|||
.length;
|
||||
},
|
||||
|
||||
tooManyTracked() {
|
||||
return this.initialStatesLength >= Discourse.SiteSettings.max_tracked_new_unread;
|
||||
},
|
||||
|
||||
resetNew() {
|
||||
const self = this;
|
||||
Object.keys(this.states).forEach(function (id) {
|
||||
|
@ -308,6 +312,7 @@ TopicTrackingState.reopenClass({
|
|||
instance = Discourse.TopicTrackingState.create({ messageBus, currentUser });
|
||||
|
||||
instance.loadStates(data);
|
||||
instance.initialStatesLength = data && data.length;
|
||||
instance.establishChannels();
|
||||
return instance;
|
||||
},
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
{{#if tooManyTracked}}
|
||||
<div class="alert alert-info">{{i18n 'topics.too_many_tracked'}}</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if redirectedReason}}
|
||||
<div class="alert alert-info">{{redirectedReason}}</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -166,7 +166,7 @@ SQL
|
|||
sql << " AND topics.id = :topic_id"
|
||||
end
|
||||
|
||||
sql << " ORDER BY topics.bumped_at DESC ) SELECT * FROM x LIMIT 500"
|
||||
sql << " ORDER BY topics.bumped_at DESC ) SELECT * FROM x LIMIT #{SiteSetting.max_tracked_new_unread.to_i}"
|
||||
|
||||
SqlBuilder.new(sql)
|
||||
.map_exec(TopicTrackingState, user_id: user_id, topic_id: topic_id)
|
||||
|
|
|
@ -936,6 +936,7 @@ en:
|
|||
current_user: 'go to your user page'
|
||||
|
||||
topics:
|
||||
too_many_tracked: "Warning: you have too many tracked new and unread topics, clear some using \"Dismiss New\" or \"Dismiss Posts\""
|
||||
bulk:
|
||||
reset_read: "Reset Read"
|
||||
delete: "Delete Topics"
|
||||
|
|
|
@ -946,6 +946,7 @@ en:
|
|||
|
||||
active_user_rate_limit_secs: "How frequently we update the 'last_seen_at' field, in seconds"
|
||||
verbose_localization: "Show extended localization tips in the UI"
|
||||
max_tracked_new_unread: "Cap the total of new + unread topics per user, this protects database and client from very large payloads for some users tracking thousands of topics"
|
||||
previous_visit_timeout_hours: "How long a visit lasts before we consider it the 'previous' visit, in hours"
|
||||
|
||||
rate_limit_create_topic: "After creating a topic, users must wait (n) seconds before creating another topic."
|
||||
|
|
|
@ -748,6 +748,9 @@ developer:
|
|||
migrate_to_new_scheme:
|
||||
hidden: true
|
||||
default: false
|
||||
max_tracked_new_unread:
|
||||
default: 1000
|
||||
client: true
|
||||
|
||||
embedding:
|
||||
feed_polling_enabled:
|
||||
|
|
Loading…
Reference in New Issue
Block a user