Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
3c27687a
Commit
3c27687a
authored
5 years ago
by
ThibG
Committed by
Eugen Rochko
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Prevent from publicly boosting one's own private toots (#10775)
parent
ee17d81b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/services/reblog_service.rb
+3
-1
app/services/reblog_service.rb
spec/services/reblog_service_spec.rb
+10
-2
spec/services/reblog_service_spec.rb
with
13 additions
and
3 deletions
+13
-3
app/services/reblog_service.rb
+
3
-
1
View file @
3c27687a
...
...
@@ -18,7 +18,9 @@ class ReblogService < BaseService
return
reblog
unless
reblog
.
nil?
reblog
=
account
.
statuses
.
create!
(
reblog:
reblogged_status
,
text:
''
,
visibility:
options
[
:visibility
]
||
account
.
user
&
.
setting_default_privacy
)
visibility
=
options
[
:visibility
]
||
account
.
user
&
.
setting_default_privacy
visibility
=
reblogged_status
.
visibility
if
reblogged_status
.
hidden?
reblog
=
account
.
statuses
.
create!
(
reblog:
reblogged_status
,
text:
''
,
visibility:
visibility
)
DistributionWorker
.
perform_async
(
reblog
.
id
)
Pubsubhubbub
::
DistributionWorker
.
perform_async
(
reblog
.
stream_entry
.
id
)
...
...
This diff is collapsed.
Click to expand it.
spec/services/reblog_service_spec.rb
+
10
-
2
View file @
3c27687a
...
...
@@ -4,10 +4,9 @@ RSpec.describe ReblogService, type: :service do
let
(
:alice
)
{
Fabricate
(
:account
,
username:
'alice'
)
}
context
'creates a reblog with appropriate visibility'
do
let
(
:bob
)
{
Fabricate
(
:account
,
username:
'bob'
)
}
let
(
:visibility
)
{
:public
}
let
(
:reblog_visibility
)
{
:public
}
let
(
:status
)
{
Fabricate
(
:status
,
account:
bob
,
visibility:
visibility
)
}
let
(
:status
)
{
Fabricate
(
:status
,
account:
alice
,
visibility:
visibility
)
}
subject
{
ReblogService
.
new
}
...
...
@@ -22,6 +21,15 @@ RSpec.describe ReblogService, type: :service do
expect
(
status
.
reblogs
.
first
.
visibility
).
to
eq
'private'
end
end
describe
'public reblogs of private toots should remain private'
do
let
(
:visibility
)
{
:private
}
let
(
:reblog_visibility
)
{
:public
}
it
'reblogs privately'
do
expect
(
status
.
reblogs
.
first
.
visibility
).
to
eq
'private'
end
end
end
context
'OStatus'
do
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment