mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX/PERF: Update readers count when a post from another user is read. Don't fetch the post data again just to update the count. (#8078)
This commit is contained in:
@@ -170,6 +170,11 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def readers_count
|
||||
read_count = reads - 1 # Excludes poster
|
||||
read_count < 0 ? 0 : read_count
|
||||
end
|
||||
|
||||
def publish_change_to_clients!(type, opts = {})
|
||||
# special failsafe for posts missing topics consistency checks should fix,
|
||||
# but message is safe to skip
|
||||
|
||||
Reference in New Issue
Block a user