Commit Graph

78 Commits

Author SHA1 Message Date
Sam 0aed2533ac Revert unread optimisation, has too many edge cases 2017-05-26 09:04:13 -04:00
Sam 29fac1ac18 PERF: improve performance of unread queries
Figuring out what unread topics a user has is a very expensive
operation over time.

Users can easily accumulate 10s of thousands of tracking state rows
(1 for every topic they ever visit)

When figuring out what a user has that is unread we need to join
the tracking state records to the topic table. This can very quickly
lead to cases where you need to scan through the entire topic table.

This commit optimises it so we always keep track of the "first" date
a user has unread topics. Then we can easily filter out all earlier
topics from the join.

We use pg functions, instead of nested queries here to assist the
planner.
2017-05-25 15:07:30 -04:00
Arpit Jalan 5fa5c18a48 use notification_levels methods for specifying normal notification level 2017-04-19 16:17:24 +05:30
cpradio 2dccaff25d FIX: Correct behavior of auto-notification state updating to exclude when the topic already has a state of normal/muted 2017-04-19 06:29:35 -04:00
cpradio 4dc4c5bebc FIX: Update auto_notification to also update the subscription state when replying if the current state is less than the state being requested 2017-04-14 15:44:42 -04:00
Guo Xiang Tan 7cb389a235 Add `DiscourseEvent` trigger when user's topic notification level changes. 2017-04-12 11:56:50 +08:00
Sam 2f6a4cc6de remove UserActionObserver, replace with after_save and service
interestingly there was some left over dead code from when stars
existed in the topic_users table
2016-12-22 16:46:53 +11:00
Sam c04d4171ff FIX: whisper no longer experimental
- Regular users are not notified of whispers
- Regular users no longer have "stuck" topics in unread
- Additional tracking for staff highest post number
- Remove a bunch of unused columns in topics table
2016-12-02 17:03:31 +11:00
cpradio 6f1c31d777 Add notification level user preference when replying to a topic 2016-09-30 14:58:07 -04:00
Sam 4161ee210a FEATURE: improved tag and category watching and tracking
- present tags watched on the user prefs page
- automatically watch or unwatch old topics based on watch status

New watching and tracking logic takes care of handling old topics
(either with or without read state)

When you watch a topic you now watch historically

Also removes confusing warnings from user.
2016-07-08 12:58:30 +10:00
Robin Ward 2005565c9c Server side code for Watching First Post Only 2016-07-07 11:21:50 -04:00
Sam 1411eedad3 FEATURE: offer to unwatch categories when unwatching category 2016-06-28 18:34:20 +10:00
Neil Lalonde f13470b96b Use db schema for tags instead of plugin store and custom fields 2016-05-26 14:29:48 -04:00
Régis Hanol 6137bb46d3 FIX: a User is *not* a Topic 2016-05-14 10:06:29 +02:00
Sam f82b5dbc82 FIX: rare concurrency error when updating timings 2016-03-24 16:02:23 +11:00
Sam f0e942f647 PERF: move 3 more option columns out of the user table 2016-02-18 16:57:22 +11:00
Arpit Jalan 97e4f7f6d3 Enums that are used in tables need to be stable 2016-01-08 20:43:11 +05:30
Régis Hanol 15c229195f FEATURE: notification_level on a per-group basis 2015-12-14 23:17:09 +01:00
Régis Hanol 31a54377be staged users automatically watches all topics they participates in 2015-11-18 22:24:46 +01:00
Sam 6f43b575a8 FEATURE: no need to cap new and unread together anymore
- leave unread alone
- cap new at 500 per site, with a site setting
2015-10-01 17:17:15 +10:00
Sam 7067d32c33 protect against bad data 2015-09-18 11:27:56 +10:00
Sam 335be272ff FEATURE: implement capping of new/unread
We cap new and unread at 2/5th of SiteSetting.max_tracked_new_unread

This dynamic capping is applied under 2 conditions:

1. New capping is applied once every 15 minutes in the periodical job, this effectively ensures that usually even super active sites are capped at 200 new items

2. Unread capping is applied if a user hits max_tracked_new_unread,
  meaning if new + unread == 500, we defer a job that runs within 15 minutes that will cap user at 200 unread

This logic ensures that at worst case a user gets "bad" numbers for 15 minutes and then the system goes ahead and fixes itself up
2015-09-07 12:03:17 +10:00
Régis Hanol bef80633b1 FEATURE: global admin override of most of the user preferences 2015-08-21 20:39:21 +02:00
Régis Hanol 6669a2d94d FEATURE: per-topic unsubscribe option in emails 2015-08-12 23:00:16 +02:00
Neil Lalonde 782dd13e78 FEATURE: track user visits on mobile and display on admin dashboard in a new Mobile section 2015-07-07 14:06:42 -04:00
Sam 1343d40558 PERF: deleting a post in huge topics was timing out
- add missing index to user actions for fast retrieval by post
- add missing indexes to users for fast retrieval of staff
- only refresh topic_users liked/bookmarked cache for affected users
2015-06-18 09:58:49 +10:00
Sam 803feefd54 MessageBus handles readonly redis now, no need to wrap it 2015-05-04 12:21:00 +10:00
Robin Ward 5b3f99aa50 Don't blow up if Redis switches to READONLY 2015-04-24 14:37:16 -04:00
Robin Ward 17d07a8b9a Adds a new `plugin_changed` notification reason for plugins to use 2015-02-27 11:58:52 -05:00
Sam 21402d9d9e annotations 2015-02-04 16:34:25 +11:00
Sam 7e259375e9 PERF: properly pass topic_id to post action cache to avoid excessive query
in the past auto closing was forcing a consistency check on topic, which in
turn was triggering a full post action cache rebuild
2015-02-03 15:59:26 +11:00
Régis Hanol c681b353f2 FEATURE: bookmark topic button 2015-01-12 12:10:15 +01:00
Sam 3347a48275 FEATURE: add liked and bookmarked classes to topic list item rows 2015-01-08 14:35:56 +11:00
Sam df7def6628 annotate 2015-01-08 11:18:43 +11:00
Sam ea87f5fd8a FEATURE: support for filter=bookmarked and filter=liked in topic list 2015-01-07 18:20:10 +11:00
Sam efc717c14a FEATURE: remove star concept from Discourse 2015-01-07 13:43:27 +11:00
Sam 6bed4e1bf0 add allowed_ips to api_keys
update annotations
2014-11-20 14:53:15 +11:00
Sam 2251877332 FIX: "Dismiss Posts" corrupting read state
REFACTOR: seen_post_count was a bad name, renamed to highest_seen_post_number
2014-10-31 09:40:35 +11:00
Sam 6d5e6b3e33 FIX: max 1 day of view time per topic
we were overflowing ints in some conditions and flooding error logs
2014-09-12 16:59:43 +10:00
Sam eeff092ead PERF/FIX: Dismiss Post coming back
Now that post numbers are monotonically increasing we should not need this job
Stuff should just self correct as users browser along

Corrected the job not to reset the disimissed posts in case we need it
2014-08-11 10:26:46 +10:00
Sam bbca684f6d BUGFIX: not updating tracking state after entering a topic
Occurs in 2 cases:

1. Change "Regular" to "Tracking" other browsers do not update
2. If you are set to track all new topics on enter.
2014-06-25 09:45:12 +10:00
Sam 0979e7b9af BUGFIX: tracking categories was not implemented 2014-06-02 13:55:01 +10:00
Sam b1d5f4440b Annotate models 2014-05-28 12:30:57 +10:00
Louis Rose 1574485443 Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
2014-05-06 14:41:59 +01:00
Sam 862a6696c0 Correct annotations
allow longer usernames (up to 60)
2014-04-15 15:53:48 +10:00
Régis Hanol 6373de550f update annotations 2014-04-08 17:35:44 +02:00
Thomas Cioppettini 38882eb1a7 Remove threequals from ruby files 2014-03-26 12:20:41 -07:00
Robin Ward 9267c162a1 FIX: Showing Unread(1) when you weren't tracking the topic. Also
includes performance fix when having MANY new or unread topics.
2014-02-26 15:39:45 -05:00
Sam be560d4eb6 Update annotations 2014-02-07 11:07:52 +11:00
Sam 227873df78 FEATURE: proper mailing list mode
once enable_mailing_list_mode is enabled any user can elect
to get every post via email unless they opt out of category or topic
2014-02-07 11:07:52 +11:00