Skip to content

Commit

Permalink
Add and
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Jan 16, 2025
1 parent 6a80d9c commit 6d2b702
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 93 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Unreleased

### 2.6.0

* Add `mark_as_read_and_seen` and `mark_as_unread_and_unseen` class methods to `Noticed::Notification`
* Add support for extra kwargs to `mark_as` class methods on `Noticed::Notification`

### 2.5.1

* Slack delivery methods now verify the `{ok: true/false}` response to catch errors correctly #515
Expand Down
66 changes: 35 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
noticed (2.5.1)
noticed (2.6.0)
rails (>= 6.1.0)

GEM
Expand Down Expand Up @@ -90,17 +90,17 @@ GEM
ast (2.4.2)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
bigdecimal (3.1.9)
builder (3.3.0)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
date (3.4.1)
drb (2.2.1)
erubi (1.13.0)
erubi (1.13.1)
faraday (2.12.2)
faraday-net_http (>= 2.0, < 3.5)
json
Expand All @@ -112,7 +112,7 @@ GEM
google-cloud-env (2.2.1)
faraday (>= 1.0, < 3.a)
google-logging-utils (0.1.0)
googleauth (1.12.0)
googleauth (1.12.2)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
Expand All @@ -126,16 +126,16 @@ GEM
i18n (1.14.6)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
irb (1.14.2)
irb (1.14.3)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.9.0)
jwt (2.9.3)
json (2.9.1)
jwt (2.10.1)
base64
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.3)
loofah (2.23.1)
logger (1.6.5)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand All @@ -145,41 +145,43 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.25.4)
multi_json (1.15.0)
net-http (0.6.0)
uri
net-http2 (0.18.5)
http-2 (~> 0.11)
net-imap (0.5.2)
net-imap (0.5.5)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.4)
nokogiri (1.17.2)
mini_portile2 (~> 2.8.2)
nokogiri (1.18.1-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.1-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.1-x86_64-linux-gnu)
racc (~> 1.4)
os (1.1.4)
parallel (1.26.3)
parser (3.3.6.0)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
pg (1.5.9)
psych (5.2.1)
psych (5.2.2)
date
stringio
public_suffix (6.0.1)
racc (1.8.1)
rack (3.1.8)
rack-session (2.0.0)
rack-session (2.1.0)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack-test (2.2.0)
rack (>= 1.3)
rackup (2.2.1)
rack (>= 3)
Expand Down Expand Up @@ -214,13 +216,13 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rdoc (6.9.1)
rdoc (6.11.0)
psych (>= 4.0.0)
regexp_parser (2.9.3)
regexp_parser (2.10.0)
reline (0.6.0)
io-console (~> 0.5)
rexml (3.4.0)
rubocop (1.69.2)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -232,7 +234,7 @@ GEM
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-performance (1.23.0)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
Expand All @@ -242,12 +244,13 @@ GEM
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
sqlite3 (2.4.1)
mini_portile2 (~> 2.8.0)
standard (1.43.0)
sqlite3 (2.5.0-arm64-darwin)
sqlite3 (2.5.0-x86_64-darwin)
sqlite3 (2.5.0-x86_64-linux-gnu)
standard (1.44.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.69.1)
rubocop (~> 1.70.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.6)
standard-custom (1.0.2)
Expand All @@ -261,7 +264,7 @@ GEM
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.2)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.2)
Expand All @@ -270,7 +273,8 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.6)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.7.1)
Expand All @@ -294,4 +298,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.6.2
2.6.3
24 changes: 16 additions & 8 deletions app/models/concerns/noticed/readable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,28 @@ module Readable
end

class_methods do
def mark_as_read
update_all(read_at: Time.current, updated_at: Time.current)
def mark_as_read_and_seen(**kwargs)
update_all(**kwargs.with_defaults(read_at: Time.current, seen_at: Time.current, updated_at: Time.current))
end

def mark_as_unread
update_all(read_at: nil, updated_at: Time.current)
def mark_as_unread_and_unseen(**kwargs)
update_all(**kwargs.with_defaults(read_at: nil, seen_at: nil, updated_at: Time.current))
end

def mark_as_seen
update_all(seen_at: Time.current, updated_at: Time.current)
def mark_as_read(**kwargs)
update_all(**kwargs.with_defaults(read_at: Time.current, updated_at: Time.current))
end

def mark_as_unseen
update_all(seen_at: nil, updated_at: Time.current)
def mark_as_unread(**kwargs)
update_all(**kwargs.with_defaults(read_at: nil, updated_at: Time.current))
end

def mark_as_seen(**kwargs)
update_all(**kwargs.with_defaults(seen_at: Time.current, updated_at: Time.current))
end

def mark_as_unseen(**kwargs)
update_all(**kwargs.with_defaults(seen_at: nil, updated_at: Time.current))
end
end

Expand Down
16 changes: 8 additions & 8 deletions gemfiles/rails_6_1.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
noticed (2.5.1)
noticed (2.6.0)
rails (>= 6.1.0)

GEM
Expand Down Expand Up @@ -82,7 +82,7 @@ GEM
base64 (0.2.0)
bigdecimal (3.1.9)
builder (3.3.0)
concurrent-ruby (1.3.4)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crack (1.0.0)
bigdecimal
Expand Down Expand Up @@ -120,7 +120,7 @@ GEM
base64
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.4)
logger (1.6.5)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -157,7 +157,7 @@ GEM
racc (~> 1.4)
os (1.1.4)
parallel (1.26.3)
parser (3.3.6.0)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
pg (1.5.9)
Expand Down Expand Up @@ -198,7 +198,7 @@ GEM
rake (13.2.1)
regexp_parser (2.10.0)
rexml (3.4.0)
rubocop (1.69.2)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -228,10 +228,10 @@ GEM
sprockets (>= 3.0.0)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
standard (1.43.0)
standard (1.44.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.69.1)
rubocop (~> 1.70.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.6)
standard-custom (1.0.2)
Expand All @@ -245,7 +245,7 @@ GEM
trilogy (2.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.3)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.2)
Expand Down
16 changes: 8 additions & 8 deletions gemfiles/rails_7.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
noticed (2.5.1)
noticed (2.6.0)
rails (>= 6.1.0)

GEM
Expand Down Expand Up @@ -88,7 +88,7 @@ GEM
base64 (0.2.0)
bigdecimal (3.1.9)
builder (3.3.0)
concurrent-ruby (1.3.4)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
crack (1.0.0)
bigdecimal
Expand Down Expand Up @@ -126,7 +126,7 @@ GEM
base64
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.4)
logger (1.6.5)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -163,7 +163,7 @@ GEM
racc (~> 1.4)
os (1.1.4)
parallel (1.26.3)
parser (3.3.6.0)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
pg (1.5.9)
Expand Down Expand Up @@ -204,7 +204,7 @@ GEM
rake (13.2.1)
regexp_parser (2.10.0)
rexml (3.4.0)
rubocop (1.69.2)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -227,10 +227,10 @@ GEM
multi_json (~> 1.10)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
standard (1.43.0)
standard (1.44.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.69.1)
rubocop (~> 1.70.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.6)
standard-custom (1.0.2)
Expand All @@ -244,7 +244,7 @@ GEM
trilogy (2.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.3)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.2)
Expand Down
Loading

0 comments on commit 6d2b702

Please sign in to comment.