mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00: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
@ -16,7 +16,7 @@ class TopicViewItem < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
if skip_redis || $redis.setnx(redis_key, "1")
|
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
|
TopicViewItem.transaction do
|
||||||
at ||= Date.today
|
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)
|
result = builder.exec(topic_id: topic_id, ip_address: ip, viewed_at: at, user_id: user_id)
|
||||||
|
|
||||||
if result.cmd_tuples > 0
|
|
||||||
Topic.where(id: topic_id).update_all 'views = views + 1'
|
Topic.where(id: topic_id).update_all 'views = views + 1'
|
||||||
|
|
||||||
|
if result.cmd_tuples > 0
|
||||||
UserStat.where(user_id: user_id).update_all 'topics_entered = topics_entered + 1' if user_id
|
UserStat.where(user_id: user_id).update_all 'topics_entered = topics_entered + 1' if user_id
|
||||||
end
|
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."
|
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."
|
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."
|
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."
|
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
|
new_topic_duration_minutes: 2880
|
||||||
previous_visit_timeout_hours: 1
|
previous_visit_timeout_hours: 1
|
||||||
staff_like_weight: 3
|
staff_like_weight: 3
|
||||||
|
topic_view_duration_hours: 8
|
||||||
|
|
||||||
# Summary mode
|
# Summary mode
|
||||||
summary_score_threshold: 15
|
summary_score_threshold: 15
|
||||||
|
Loading…
x
Reference in New Issue
Block a user