Commit Graph

45 Commits

Author SHA1 Message Date
Martin Brennan
37be2958f7
DEV: Allow specifying if a notification is high_priority on create (#9660)
This allows for special cases where we may not want a certain notification type to ALWAYS be high priority (e.g. a topic timer).
2020-05-07 14:35:32 +10:00
Martin Brennan
b79ea986ac
FEATURE: High priority bookmark reminder notifications (#9290)
Introduce the concept of "high priority notifications" which include PM and bookmark reminder notifications. Now bookmark reminder notifications act in the same way as PM notifications (float to top of recent list, show in the green bubble) and most instances of unread_private_messages in the UI have been replaced with unread_high_priority_notifications.

The user email digest is changed to just have a section about unread high priority notifications, the unread PM section has been removed.

A high_priority boolean column has been added to the Notification table and relevant indices added to account for it.

unread_private_messages has been kept on the User model purely for backwards compat, but now just returns unread_high_priority_notifications count so this may cause some inconsistencies in the UI.
2020-04-01 09:09:20 +10:00
Sam Saffron
372f6f4f22
FEATURE: limit number of notifications per user to 10,000
Introduces a new site setting `max_notifications_per_user`.

Out-of-the-box this is set to 10,000. If a user exceeds this number of
notifications, we will delete the oldest notifications keeping only 10,000.

To disable this safeguard set the setting to 0.

Enforcement happens weekly.

This is in place to protect the system from pathological states where a
single user has enormous amounts of notifications causing various queries
to time out. In practice nobody looks back more than a few hundred notifications.
2020-02-24 11:42:50 +11:00
Dan Ungureanu
9aeb9f0ca1
DEV: Add test (#8960)
Follow-up to 3ad07aacfa.
2020-02-14 10:19:40 +02:00
Vinoth Kannan
e6dfcda0bc DEV: handle all notification consolidations in new 'NotificationConsolidator' class.
481c8314f0
2019-12-05 14:36:06 +05:30
Vinoth Kannan
481c8314f0 FEATURE: consolidate group membership request notifications. 2019-11-28 04:02:35 +05:30
Dan Ungureanu
ceb74bef8f
DEV: Add test.
Follow-up to 2f54dd5e3d.
2019-10-21 21:33:58 +03:00
Daniel Waterworth
bf7594b327 More prefabrication 2019-05-10 08:34:04 -04:00
Sam Saffron
4ea21fa2d0 DEV: use #frozen_string_literal: true on all spec
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10: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
aa2cc4ab31 FIX: Liked notification consolidation has to account for user like frequency setting. 2019-01-17 14:33:23 +08:00
Guo Xiang Tan
f06b773d25 FIX: Don't show liked consolidated notification when frequency is never. 2019-01-16 17:08:59 +08:00
Guo Xiang Tan
ebe65577ed
FEATURE: Consolidate likes notifications. (#6879) 2019-01-16 10:40:16 +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
Guo Xiang Tan
6057e17ae7 Fix weird test failure. 2017-03-20 12:06:37 +08:00
Sam
c531f4ded5 remove rails-observers
Rails yanked out observers many many years ago, instead the functionality
was yanked out to a gem that is very lightly maintained.

For example: if we want to upgrade to rails 5 there is no published gem

Internally the usage of observers had quite a few problem.

The series of refactors renamed a bunch of classes to give us more clarity
and removed some magic.
2016-12-22 16:46:53 +11: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
Sam
d09a20210b correct bad spec 2016-03-22 14:50:12 +11:00
Régis Hanol
12051f79a8 FIX: don't send empty email notifications for small_actions 2016-02-01 19:12:10 +01:00
Arpit Jalan
97e4f7f6d3 Enums that are used in tables need to be stable 2016-01-08 20:43:11 +05:30
Guo Xiang Tan
cca0896b9e FIX: Update all does not trigger callbacks. 2015-12-17 00:07:04 +08:00
Andy Waite
3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Sam
9f88d6e252 fix regression in visible notification detection 2015-06-23 06:14:22 +10:00
Sam
709ab731c7 don't put missing notifications in the stream for tests. 2015-02-19 13:20:25 +11:00
Luciano Sousa
b52f12948a models with rspec3 syntax 2015-01-05 13:04:23 -03:00
David McClure
efc4109902 update specs to remove deprecation warnings 2014-11-07 06:05:44 -08:00
cpradio
8f390c979b FEATURE: Mark All as Read button for Notifications page
Added a Mark All as Read button to the top/bottom of the notifications user page
https://meta.discourse.org/t/possibility-to-selectively-or-completely-mark-notifications-as-read/20227

Remove notifications property (no longer used)
2014-10-13 06:31:27 -04:00
Sam
5c26b3dad1 FIX: broken specs after new link alerting code 2014-03-18 15:22:53 +11:00
Sam
e8aa85d783 FEATURE: unread pms go in front of notification report
also refactor fat controller
2014-02-13 17:27:50 +11:00
Sam
6c3c9345df use consistent style 2014-02-04 12:57:52 +11:00
Sam
5267e5bea6 BUGFIX: emails sent from "2 replies" as opposed to correct user 2014-02-04 12:56:28 +11:00
Sam
b85e5dc191 FEATURE: collapse PM notifications 2014-01-20 16:18:43 +11:00
Ricardo Mendes
37f4022f73 Refactors UserEmailObserver to improve Code Climate score
- Extracts certain logic to private methods and remove unnecessary
comments
- Extracts email enqueueing methods into a separate class
- Fix specs involving UserEmailObserver to call #after_commit instead
of the specific methods
2013-08-24 12:21:39 +01:00
Robin Ward
b7327942af Add deleted_by to Trashable tables 2013-07-09 15:46:36 -04:00
Sam
04b8cd5c95 consistency check, need to also ensure delete cleans stuff up, maybe make notifications trashable 2013-05-16 17:50:14 +10:00
Sam
eb71e9de24 opening move, don't get rid of green notification till the pm is read
TODO a way to list all unread PMs
2013-05-16 16:37:47 +10:00
Sam
e9ebadb414 Nuke message_bus_observer move to service class and classes
Secure all messages triggered by post creation and all user actions so they don't leak
(meaning, if you have a browser open and secure topics are created you will only get them if you are allowed to see them)
2013-05-16 15:03:16 +10:00
Sam
ef98b60184 disable observers in tests, enable as needed, tests are 20% faster 2013-05-14 11:59:55 +10:00
Karan Misra
5dfb04e4b3 Convert a lot of :a => b to a: b and bring peace to the world 2013-03-25 05:07:36 +05:30
Gosha Arinich
0c99dea153 introduce Enum 2013-03-01 21:16:36 +03:00
Gosha Arinich
cafc75b238 remove trailing whitespaces ❤️ 2013-02-26 07:31:35 +03:00
Sam Saffron
77a2d8ccc4 fixed a pile of notification craziness
addes some tests around post timings
2013-02-25 18:42:42 +11:00
Robin Ward
21b5628528 Initial release of Discourse 2013-02-05 14:16:51 -05:00