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
401
Issues
401
List
Boards
Labels
Service Desk
Milestones
Merge Requests
59
Merge Requests
59
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
56cfe718
Commit
56cfe718
authored
Feb 21, 2018
by
lain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add moderator task.
parent
765671a5
Pipeline
#786
passed with stage
in 2 minutes and 38 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
lib/mix/tasks/make_moderator.ex
lib/mix/tasks/make_moderator.ex
+27
-0
No files found.
lib/mix/tasks/make_moderator.ex
0 → 100644
View file @
56cfe718
defmodule
Mix
.
Tasks
.
SetModerator
do
use
Mix
.
Task
import
Mix
.
Ecto
alias
Pleroma
.
{
Repo
,
User
}
@shortdoc
"Set moderator status"
def
run
([
nickname
|
rest
])
do
ensure_started
(
Repo
,
[])
moderator
=
case
rest
do
[
moderator
]
->
moderator
==
"true"
_
->
true
end
with
%
User
{
local:
true
}
=
user
<-
User
.
get_by_nickname
(
nickname
)
do
info
=
user
.
info
|>
Map
.
put
(
"is_moderator"
,
!!moderator
)
cng
=
User
.
info_changeset
(
user
,
%{
info:
info
})
user
=
Repo
.
update!
(
cng
)
IO
.
puts
"Moderator status of
#{
nickname
}
:
#{
user
.
info
[
"is_moderator"
]
}
"
else
_
->
IO
.
puts
"No local user
#{
nickname
}
"
end
end
end
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