mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FEATURE: start counting repeat topic views (default is one per 8 hours)
configurable with topic_view_duration_hours site setting
This commit is contained in:
parent
3e5420da35
commit
09e470c98a
3 changed files with 5 additions and 2 deletions
|
@ -16,7 +16,7 @@ class TopicViewItem < ActiveRecord::Base
|
|||
end
|
||||
|
||||
if skip_redis || $redis.setnx(redis_key, "1")
|
||||
skip_redis || $redis.expire(redis_key, 1.day.to_i)
|
||||
skip_redis || $redis.expire(redis_key, SiteSetting.topic_view_duration_hours.hours)
|
||||
|
||||
TopicViewItem.transaction do
|
||||
at ||= Date.today
|
||||
|
@ -40,8 +40,9 @@ class TopicViewItem < ActiveRecord::Base
|
|||
|
||||
result = builder.exec(topic_id: topic_id, ip_address: ip, viewed_at: at, user_id: user_id)
|
||||
|
||||
Topic.where(id: topic_id).update_all 'views = views + 1'
|
||||
|
||||
if result.cmd_tuples > 0
|
||||
Topic.where(id: topic_id).update_all 'views = views + 1'
|
||||
UserStat.where(user_id: user_id).update_all 'topics_entered = topics_entered + 1' if user_id
|
||||
end
|
||||
|
||||
|
|
|
@ -1024,6 +1024,7 @@ en:
|
|||
|
||||
white_listed_spam_host_domains: "A list of domains excluded from spam host testing. New users will never be restricted from creating posts with links to these domains."
|
||||
staff_like_weight: "How much extra weighting factor to give staff likes."
|
||||
topic_view_duration_hours: "Count new a topic view once per IP/User every N hours"
|
||||
|
||||
levenshtein_distance_spammer_emails: "When matching spammer emails, number of characters difference that will still allow a fuzzy match."
|
||||
max_new_accounts_per_registration_ip: "If there are already (n) trust level 0 accounts from this IP (and none is a staff member or at TL2 or higher), stop accepting new signups from that IP."
|
||||
|
|
|
@ -750,6 +750,7 @@ uncategorized:
|
|||
new_topic_duration_minutes: 2880
|
||||
previous_visit_timeout_hours: 1
|
||||
staff_like_weight: 3
|
||||
topic_view_duration_hours: 8
|
||||
|
||||
# Summary mode
|
||||
summary_score_threshold: 15
|
||||
|
|
Loading…
Reference in a new issue