Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
391
Issues
391
List
Boards
Labels
Service Desk
Milestones
Merge Requests
54
Merge Requests
54
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
95871cb4
Commit
95871cb4
authored
Oct 05, 2019
by
kaniini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user: implement User.invisible?/1
parent
1469a084
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/pleroma/user.ex
lib/pleroma/user.ex
+3
-0
test/user_test.exs
test/user_test.exs
+14
-0
No files found.
lib/pleroma/user.ex
View file @
95871cb4
...
...
@@ -88,6 +88,9 @@ def superuser?(%User{local: true, info: %User.Info{is_admin: true}}), do: true
def
superuser?
(%
User
{
local:
true
,
info:
%
User
.
Info
{
is_moderator:
true
}}),
do
:
true
def
superuser?
(
_
),
do
:
false
def
invisible?
(%
User
{
info:
%
User
.
Info
{
invisible:
true
}}),
do
:
true
def
invisible?
(
_
),
do
:
false
def
avatar_url
(
user
,
options
\\
[])
do
case
user
.
avatar
do
%{
"url"
=>
[%{
"href"
=>
href
}
|
_
]}
->
href
...
...
test/user_test.exs
View file @
95871cb4
...
...
@@ -1232,6 +1232,20 @@ test "returns true for local admins" do
end
end
describe
"invisible?/1"
do
test
"returns true for an invisible user"
do
user
=
insert
(
:user
,
local:
true
,
info:
%{
invisible:
true
})
assert
User
.
invisible?
(
user
)
end
test
"returns false for a non-invisible user"
do
user
=
insert
(
:user
,
local:
true
)
refute
User
.
invisible?
(
user
)
end
end
describe
"visible_for?/2"
do
test
"returns true when the account is itself"
do
user
=
insert
(
:user
,
local:
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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