Commit Graph

114 Commits

Author SHA1 Message Date
Arpit Jalan
c6bf70c870
DEV: annotate models (#11047) 2020-10-27 23:42:33 +05:30
Kane York
84dba3c1c7
FIX: UserAction did not have a types enum (#10553)
This is important for Data Explorer to provide proper help text.
2020-08-28 11:49:19 -07:00
David Taylor
fab8b8649e
PERF: Combine avatar_lookup and primary_group_lookup into user_lookup (#10253)
These two classes were running very similar queries, which could be expensive on large topics
2020-07-17 10:48:08 +01:00
Gerhard Schlager
ea11ad4d99 DEV: Drop unused columns 2020-01-27 15:28:56 +01:00
Daniel Waterworth
55a1394342 DEV: pluck_first
Doing .pluck(:column).first is a very common pattern in Discourse and in
most cases, a limit cause isn't being added. Instead of adding a limit
clause to all these callsites, this commit adds two new methods to
ActiveRecord::Relation:

pluck_first, equivalent to limit(1).pluck(*columns).first

and pluck_first! which, like other finder methods, raises an exception
when no record is found
2019-10-21 12:08:20 +01:00
Sam Saffron
4fce6484fe PERF: reduce window of consistency on user actions
Databases can have a lot of user actions, self joining and running an
aggregate on millions of rows can be very costly

This optimisation will reduce the regular window of consistency down to 13
hours, this ensures the job runs much faster
2019-08-29 13:27:04 +10:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Sam Saffron
c617e512ad annotate new indexes 2019-04-26 18:23:27 +10:00
Guo Xiang Tan
a7a5f90e20 Annotate models. 2019-04-05 17:13:12 +08:00
Robin Ward
b58867b6e9 FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API
backwards compatibility.

Co-Authored-By: romanrizzi <romanalejandro@gmail.com>
Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
2019-03-28 12:45:10 -04:00
Guo Xiang Tan
ebe65577ed
FEATURE: Consolidate likes notifications. (#6879) 2019-01-16 10:40:16 +08:00
Robin Ward
95f263995d FIX: Previous annotations were broken 2019-01-11 14:30:19 -05:00
Robin Ward
a3839495e0 Update annotations 2019-01-11 12:19:43 -05:00
Sam
35e0ccfc84 make linter happy 2018-06-20 18:03:27 +10:00
Sam
cb824a6b33 DEV: remove all calls to SqlBuilder use DB.build instead
This is part of the migration to mini_sql, SqlBuilder.new is being
deprecated and replaced with DB.build
2018-06-20 17:53:49 +10:00
Sam
5f64fd0a21 DEV: remove exec_sql and replace with mini_sql
Introduce new patterns for direct sql that are safe and fast.

MiniSql is not prone to memory bloat that can happen with direct PG usage.
It also has an extremely fast materializer and very a convenient API

- DB.exec(sql, *params) => runs sql returns row count
- DB.query(sql, *params) => runs sql returns usable objects (not a hash)
- DB.query_hash(sql, *params) => runs sql returns an array of hashes
- DB.query_single(sql, *params) => runs sql and returns a flat one dimensional array
- DB.build(sql) => returns a sql builder

See more at: https://github.com/discourse/mini_sql
2018-06-19 16:13:36 +10:00
Guo Xiang Tan
416d19af27 FIX: Wrong target user displayed for user actions in activity stream.
https://meta.discourse.org/t/wrong-assigned-username-in-activity-list/73816
2018-05-18 11:28:13 +08:00
Joffrey JAFFEUX
83255d94d9
DateGroupable is not used anymore 2018-05-14 16:26:14 +02:00
Sam
8a783412b7 UX: improvements to new dashboard
- remove inactive user report and replace with posts
- clean up internals so grouping by week happens on client
- when switching periods old report was not destroyed leading to bugs
- calculate trend based on previous interval ... not previous 30 days
- show percentages for mau/dau
- be more careful about utc date usage
- show uniqu and click through rate on search panel
- publish key of report with report so we only load the correct one
- subscribe earlier in channel in case of concurrency issues
2018-05-11 13:30:32 +10:00
Joffrey JAFFEUX
980972182f
dashboard next: caching, mobile support and new charts 2018-05-03 15:41:41 +02:00
Gerhard Schlager
14e700fa50 Adds query for daily engaged users 2018-04-28 01:20:13 +02:00
Guo Xiang Tan
226ace1643 Update annotations. 2018-02-20 14:28:58 +08:00
Robin Ward
4fcf9ece3a Allow plugins to customize the columns returned by user_actions
This is useful if they have a different mechanism for rendering an
avatar and want to include custom columns via the `custom_avatar_column`
plugin function.
2017-12-14 16:52:54 -05:00
Robin Ward
74b9828731 FIX: Remove mentions filters from user and groups
Additionally return no data if disabled
2017-12-07 16:29:02 -05:00
Arpit Jalan
daeb7694bc update annotations 2017-12-05 21:03:20 +05:30
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Robin Ward
14410b71fb Convert server side paths to use /u/ 2017-03-30 10:23:24 -04:00
Sam
53ea8942e8 action to be reserved for assigned plugin 2017-02-08 12:10:16 -05:00
Guo Xiang Tan
e3b6f9b8ae FIX: Do not update user stats like counts for private messages. 2017-01-16 11:07:53 +08:00
Guo Xiang Tan
5d7f3223f0 SECURITY: Users can only bookmark posts which they can see. 2016-12-21 12:01:26 +08:00
Sam
1939104d46 Add mapping for Discourse solved
This basically reserved user action 15 for Discourse solved.
2016-11-29 16:17:32 +11:00
João Fernandes
ffeca8c2d4 Prevent moderators from seeing other users bookmarks 2016-03-20 18:27:28 +00:00
Sam
d0ee32f3ce FIX: correct counts on user summary 2016-01-24 16:39:01 +11:00
Sam
8cf4d52cb6 FEATURE: split up group PMS on user page 2015-12-10 11:39:33 +11:00
Régis Hanol
a37d575d7d FEATURE: new 'My Groups' messages filter in user page 2015-12-07 18:37:03 +01:00
Régis Hanol
4f7140fb32 FIX: properly filter whispers in user stream 2015-09-22 00:50:52 +02:00
Sam
c1ecd6f4ce update annotations 2015-09-18 10:41:10 +10:00
Sam
c845fcb154 PERF: turn 3 queries into 1 2015-09-10 17:07:20 +10:00
Robin Ward
cf91bca0cd FIX: Small actions should show descriptions on the user stream 2015-07-31 14:25:49 -04:00
Arpit Jalan
6b816f445d UX: show lock icon in user stream if topic is closed/archived 2015-05-11 23:09:53 +05:30
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
5bf8c31af4 Users can see their pending posts 2015-04-21 16:44:47 -04:00
Sam
efc717c14a FEATURE: remove star concept from Discourse 2015-01-07 13:43:27 +11:00
Sam
81e91f3fd7 FIX: unlisted topics listed in activity stream 2014-10-03 15:37:51 +10:00
Sam
414c6d191f FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
Akshay
9d11ccc42e removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
Akshay
6301a43d57 Not initializing variable for looping if unused in loop 2014-08-15 03:24:55 +05:30
Arpit Jalan
7e946a718e Make bookmarks menu appear all the time 2014-06-23 10:21:33 +05:30
Robin Ward
d53ac36818 FIX: New action arriving in stream via message bus 2014-06-16 14:49:58 -04:00