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
5e38ef87
Commit
5e38ef87
authored
6 years ago
by
ThibG
Committed by
Eugen Rochko
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix reblogs privacy (#10302)
* Fix reblogs privacy * Fix Announce processing specs
parent
c92a1cf5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/status.rb
+1
-1
1 addition, 1 deletion
app/models/status.rb
spec/lib/activitypub/activity/announce_spec.rb
+1
-0
1 addition, 0 deletions
spec/lib/activitypub/activity/announce_spec.rb
spec/services/reblog_service_spec.rb
+21
-0
21 additions, 0 deletions
spec/services/reblog_service_spec.rb
with
23 additions
and
1 deletion
app/models/status.rb
+
1
−
1
View file @
5e38ef87
...
...
@@ -453,8 +453,8 @@ class Status < ApplicationRecord
end
def
set_visibility
self
.
visibility
=
reblog
.
visibility
if
reblog?
&&
visibility
.
nil?
self
.
visibility
=
(
account
.
locked?
?
:private
:
:public
)
if
visibility
.
nil?
self
.
visibility
=
reblog
.
visibility
if
reblog?
self
.
sensitive
=
false
if
sensitive
.
nil?
end
...
...
This diff is collapsed.
Click to expand it.
spec/lib/activitypub/activity/announce_spec.rb
+
1
−
0
View file @
5e38ef87
...
...
@@ -12,6 +12,7 @@ RSpec.describe ActivityPub::Activity::Announce do
type:
'Announce'
,
actor:
'https://example.com/actor'
,
object:
object_json
,
to:
'http://example.com/followers'
,
}.
with_indifferent_access
end
...
...
This diff is collapsed.
Click to expand it.
spec/services/reblog_service_spec.rb
+
21
−
0
View file @
5e38ef87
...
...
@@ -3,6 +3,27 @@ require 'rails_helper'
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
)
}
subject
{
ReblogService
.
new
}
before
do
subject
.
call
(
alice
,
status
,
visibility:
reblog_visibility
)
end
describe
'boosting privately'
do
let
(
:reblog_visibility
)
{
:private
}
it
'reblogs privately'
do
expect
(
status
.
reblogs
.
first
.
visibility
).
to
eq
'private'
end
end
end
context
'OStatus'
do
let
(
:bob
)
{
Fabricate
(
:account
,
username:
'bob'
,
domain:
'example.com'
,
salmon_url:
'http://salmon.example.com'
)
}
let
(
:status
)
{
Fabricate
(
:status
,
account:
bob
,
uri:
'tag:example.com;something:something'
)
}
...
...
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