Commit Graph

67 Commits

Author SHA1 Message Date
Guo Xiang Tan
214dac05de Update annotations. 2018-07-16 14:19:07 +08: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
754458e6a2 PERF: Minor but we can just pass a hash to where.
```
Warming up --------------------------------------
          4 x .where     1.040k i/100ms
          1 x .where     1.677k i/100ms
Calculating -------------------------------------
          4 x .where     10.321k (± 5.2%) i/s -     52.000k in
5.053803s
          1 x .where     17.117k (± 3.8%) i/s -     85.527k in
5.004107s

Comparison:
          1 x .where:    17117.1 i/s
          4 x .where:    10321.3 i/s - 1.66x  slower
```
2018-05-28 16:41:38 +08:00
Régis Hanol
5b2e7c8d10 fix the build 2018-05-26 03:11:10 +02:00
Régis Hanol
338d39265a FIX: don't publish notifications_state when user has been deleted 2018-05-26 02:27:54 +02:00
Régis Hanol
d23229df85 Let's use the same method 2018-05-26 02:16:53 +02:00
Régis Hanol
f988fa31aa FIX: ensure 'notifications_state' is up to date after creating a notification 2018-05-26 02:09:48 +02:00
Guo Xiang Tan
23b787e0a6 Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Guo Xiang Tan
e888369f51 UX: Don't send emails for discobot notifications. 2017-06-12 17:00:27 +09:00
Neil Lalonde
7821400141 FEATURE: staff can set a timer to remind them about a topic 2017-05-16 14:49:50 -04:00
Régis Hanol
8fe0bbb238 REFACTOR: improve Notification.ensure_consistency SQL query readability 2017-04-24 23:00:27 +02:00
Guo Xiang Tan
6057e17ae7 Fix weird test failure. 2017-03-20 12:06:37 +08:00
Guo Xiang Tan
a567e6bec9 FIX: Publish notification state in after_commit hook.
`after_save` is still wrapped in a transaction and
we were getting intermittent failures with notifications
state not being published.
2017-03-20 11:38:34 +08:00
Sam
019f1a1d06 UserEmailObserver is now removed
no big surprises here was pretty straightforward

after_commit semantics sure are weird though
2016-12-22 16:46:53 +11:00
Guo Xiang Tan
8c6d8c85db Stop showing first notification prompt once user sees the notification. 2016-11-17 09:44:00 +08:00
Guo Xiang Tan
98c1e0832c FIX: Track first notification read using Redis. 2016-11-16 16:20:38 +08:00
Sam
75f3f7fcbd FEATURE: clean API method for reading a single notification 2016-09-16 16:14:15 +10:00
Robin Ward
2005565c9c Server side code for Watching First Post Only 2016-07-07 11:21:50 -04:00
Sam
332e05b73d omit likes if notify likes is set to never 2016-03-06 09:21:38 +11:00
Sam
3c072cdfc9 Merge branch 'master' of github.com:discourse/discourse 2016-02-24 13:53:43 +11:00
Régis Hanol
8d1da9cedd FEATURE: keep original title when sending email notifications about a PM 2016-02-23 01:34:16 +01:00
Sam
32c681c96b annotate models 2016-02-23 10:33:53 +11:00
Sam
dd6ebde824 FIX: Always ensure notifications are treated as read once clicked
UX: improve messaging so notifications list is far more stable
PERF: improve performance of notifcation lookup queries

- Add feature "SetTransientHeader" that allows shipping info to server
   in the next Ajax request
- remove local storage hack used for notifications
- amend lookupStale to return hydrated objects, move logic into store
- stop magically clearing various notifications (likes, invitee accepted, group_summary, granted badge)
2016-02-15 19:29:47 +11:00
Régis Hanol
12051f79a8 FIX: don't send empty email notifications for small_actions 2016-02-01 19:12:10 +01:00
Sam Saffron
a764cc3a42 FEATURE: by default users track a group (as opposed to watch)
FEATURE: a rollup counting number of messages in the group inbox to tracking users
2016-01-27 21:38:33 +11:00
Sam
1bb485fca5 FIX: when a user got multiple replies to a topic, emails were missing 2016-01-27 12:20:08 +11:00
Arpit Jalan
97e4f7f6d3 Enums that are used in tables need to be stable 2016-01-08 20:43:11 +05:30
Sam Saffron
bfcb0a52bb correct previous commit 2016-01-06 20:36:09 +11:00
Sam Saffron
9f4efed03a PERF: don't publish notification state unless it changed 2016-01-06 20:36:09 +11:00
Régis Hanol
e89d8e796e FIX: group messages notifications
Prevent double notifications when watching a group
Make sure mentions/quotes/replies in a group message shows up
2015-12-18 16:32:53 +01:00
Guo Xiang Tan
cca0896b9e FIX: Update all does not trigger callbacks. 2015-12-17 00:07:04 +08:00
Sam
ad3dd161e7 FEATURE: first class group mentions built in
If you allow a group to be mentioned it can be mentioned with the @ symbol.

Keep in mind as a safety mechanism max_users_notified_per_group_mention is set to 100
2015-11-30 17:08:43 +11:00
Sam
c1ecd6f4ce update annotations 2015-09-18 10:41:10 +10:00
Sam
1f31435a7b correct handling of data hash parsing 2015-09-04 13:34:21 +10:00
Sam
9f88d6e252 fix regression in visible notification detection 2015-06-23 06:14:22 +10:00
Régis Hanol
5a77f62181 PERF: poor SQL performances when counting notifications 2015-06-22 14:40:03 +02:00
Sam
37dfb1b4b5 FEATURE: support for custom notification types
used by solved plugin
2015-06-15 14:18:03 +10:00
Arpit Jalan
8c2d7dcaac FEATURE: invite existing user to a topic 2015-04-03 15:00:04 +05:30
Sam
67f404d281 FIX: remove notifications on deleted topics from the stream 2015-02-19 12:40:00 +11:00
Robin Ward
4f6b9815ae FEATURE: List moderator warnings on admin dashboard 2014-09-08 13:25:02 -04:00
Robin Ward
334e21a03a Revert "Revert "FEATURE: Can create warnings for users via PM""
This reverts commit 1c7559380c.
2014-09-08 11:11:56 -04:00
Robin Ward
1c7559380c Revert "FEATURE: Can create warnings for users via PM"
This reverts commit b0bfc1f93f.
2014-09-08 10:38:59 -04:00
Robin Ward
b0bfc1f93f FEATURE: Can create warnings for users via PM 2014-09-08 10:27:06 -04:00
Sam
414c6d191f FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
Sam
b1d5f4440b Annotate models 2014-05-28 12:30:57 +10:00
Robin Ward
b1d2aba0f3 Clean up notifications if a user can't see a topic 2014-05-26 13:26:46 -04:00
Sam
e06da1821d BUGFIX: notifications were not updated correctly live
- missing notifications when multiple replies in topic (till refresh)
- not cleared properly on click
2014-05-23 11:34:34 +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