Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mastofe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Pleroma
mastofe
Commits
83746b63
Unverified
Commit
83746b63
authored
6 years ago
by
Eugen Rochko
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove annoying Notification#cache_ids scope warning (#8333)
parent
6a0d4d36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/notification.rb
+4
-2
4 additions, 2 deletions
app/models/notification.rb
with
4 additions
and
2 deletions
app/models/notification.rb
+
4
−
2
View file @
83746b63
...
...
@@ -39,8 +39,6 @@ class Notification < ApplicationRecord
validates
:account_id
,
uniqueness:
{
scope:
[
:activity_type
,
:activity_id
]
}
validates
:activity_type
,
inclusion:
{
in:
TYPE_CLASS_MAP
.
values
}
scope
:cache_ids
,
->
{
select
(
:id
,
:updated_at
,
:activity_type
,
:activity_id
)
}
scope
:browserable
,
->
(
exclude_types
=
[])
{
types
=
TYPE_CLASS_MAP
.
values
-
activity_types_from_types
(
exclude_types
+
[
:follow_request
])
where
(
activity_type:
types
)
...
...
@@ -68,6 +66,10 @@ class Notification < ApplicationRecord
end
class
<<
self
def
cache_ids
select
(
:id
,
:updated_at
,
:activity_type
,
:activity_id
)
end
def
reload_stale_associations!
(
cached_items
)
account_ids
=
(
cached_items
.
map
(
&
:from_account_id
)
+
cached_items
.
map
{
|
item
|
item
.
target_status
&
.
account_id
}.
compact
).
uniq
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment