Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
0de82dd3
Commit
0de82dd3
authored
7 years ago
by
Akihiko Odaki
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Do not filter statuses with unknown languages (#5045)
parent
dcfc9b22
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/status.rb
+1
-1
1 addition, 1 deletion
app/models/status.rb
spec/models/status_spec.rb
+16
-0
16 additions, 0 deletions
spec/models/status_spec.rb
with
17 additions
and
1 deletion
app/models/status.rb
+
1
−
1
View file @
0de82dd3
...
...
@@ -146,7 +146,7 @@ class Status < ApplicationRecord
class
<<
self
def
not_in_filtered_languages
(
account
)
where
.
not
(
language:
account
.
filtered_languages
)
where
(
language:
nil
).
or
where
.
not
(
language:
account
.
filtered_languages
)
end
def
as_home_timeline
(
account
)
...
...
This diff is collapsed.
Click to expand it.
spec/models/status_spec.rb
+
16
−
0
View file @
0de82dd3
...
...
@@ -173,6 +173,22 @@ RSpec.describe Status, type: :model do
end
end
describe
'.not_in_filtered_languages'
do
context
'for accounts with language filters'
do
let
(
:user
)
{
Fabricate
(
:user
,
filtered_languages:
[
'en'
])
}
it
'does not include statuses in filtered languages'
do
status
=
Fabricate
(
:status
,
language:
'en'
)
expect
(
Status
.
not_in_filtered_languages
(
user
.
account
)).
not_to
include
status
end
it
'includes status with unknown language'
do
status
=
Fabricate
(
:status
,
language:
nil
)
expect
(
Status
.
not_in_filtered_languages
(
user
.
account
)).
to
include
status
end
end
end
describe
'.as_home_timeline'
do
let
(
:account
)
{
Fabricate
(
:account
)
}
let
(
:followed
)
{
Fabricate
(
:account
)
}
...
...
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