Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
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
Container 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
Sean King
admin-fe
Commits
7b4184cb
Commit
7b4184cb
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Add ability to change status scope
parent
7a0180c7
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
src/api/reports.js
+10
-0
10 additions, 0 deletions
src/api/reports.js
src/store/modules/reports.js
+13
-1
13 additions, 1 deletion
src/store/modules/reports.js
src/views/reports/components/Statuses.vue
+28
-6
28 additions, 6 deletions
src/views/reports/components/Statuses.vue
with
51 additions
and
7 deletions
src/api/reports.js
+
10
−
0
View file @
7b4184cb
...
...
@@ -12,6 +12,16 @@ export async function changeState(state, id, authHost, token) {
})
}
export
async
function
changeStatusScope
(
id
,
sensitive
,
visibility
,
authHost
,
token
)
{
return
await
request
({
baseURL
:
baseName
(
authHost
),
url
:
`/api/pleroma/admin/statuses/
${
id
}
`
,
method
:
'
put
'
,
headers
:
authHeaders
(
token
),
data
:
{
sensitive
,
visibility
}
})
}
export
async
function
fetchReports
(
limit
,
max_id
,
authHost
,
token
)
{
return
await
request
({
baseURL
:
baseName
(
authHost
),
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/reports.js
+
13
−
1
View file @
7b4184cb
import
{
changeState
,
fetchReports
,
filterReports
}
from
'
@/api/reports
'
import
{
changeState
,
changeStatusScope
,
fetchReports
,
filterReports
}
from
'
@/api/reports
'
const
reports
=
{
state
:
{
...
...
@@ -28,6 +28,18 @@ const reports = {
const
updatedReports
=
state
.
fetchedReports
.
map
(
report
=>
report
.
id
===
reportId
?
data
:
report
)
commit
(
'
SET_REPORTS
'
,
updatedReports
)
},
async
ChangeStatusScope
({
commit
,
getters
,
state
},
{
statusId
,
isSensitive
,
visibility
,
reportId
})
{
const
{
data
}
=
await
changeStatusScope
(
statusId
,
isSensitive
,
visibility
,
getters
.
authHost
,
getters
.
token
)
const
updatedReports
=
state
.
fetchedReports
.
map
(
report
=>
{
if
(
report
.
id
===
reportId
)
{
const
statuses
=
report
.
statuses
.
map
(
status
=>
status
.
id
===
statusId
?
data
:
status
)
return
{
...
report
,
statuses
}
}
else
{
return
report
}
})
commit
(
'
SET_REPORTS
'
,
updatedReports
)
},
async
FetchReports
({
commit
,
getters
,
state
})
{
commit
(
'
SET_LOADING
'
,
true
)
const
response
=
await
fetchReports
(
state
.
page_limit
,
state
.
idOfLastReport
,
getters
.
authHost
,
getters
.
token
)
...
...
This diff is collapsed.
Click to expand it.
src/views/reports/components/Statuses.vue
+
28
−
6
View file @
7b4184cb
...
...
@@ -13,11 +13,31 @@
<el-dropdown
trigger=
"click"
>
<el-button
plain
size=
"small"
icon=
"el-icon-edit"
>
{{
$t
(
'
reports.changeScope
'
)
}}
<i
class=
"el-icon-arrow-down el-icon--right"
/></el-button>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
v-if=
"!status.sensitive"
>
{{
$t
(
'
reports.addSensitive
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.sensitive"
>
{{
$t
(
'
reports.removeSensitive
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.visibility !== 'public'"
>
{{
$t
(
'
reports.public
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.visibility !== 'private'"
>
{{
$t
(
'
reports.private
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.visibility !== 'unlisted'"
>
{{
$t
(
'
reports.unlisted
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"!status.sensitive"
@
click.native=
"changeStatus(status.id, true, status.visibility, report.id)"
>
{{
$t
(
'
reports.addSensitive
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.sensitive"
@
click.native=
"changeStatus(status.id, false, status.visibility, report.id)"
>
{{
$t
(
'
reports.removeSensitive
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.visibility !== 'public'"
@
click.native=
"changeStatus(status.id, status.sensitive, 'public', report.id)"
>
{{
$t
(
'
reports.public
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.visibility !== 'private'"
@
click.native=
"changeStatus(status.id, status.sensitive, 'private', report.id)"
>
{{
$t
(
'
reports.private
'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-if=
"status.visibility !== 'unlisted'"
@
click.native=
"changeStatus(status.id, status.sensitive, 'unlisted', report.id)"
>
{{
$t
(
'
reports.unlisted
'
)
}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
...
...
@@ -51,8 +71,10 @@ export default {
capitalizeFirstLetter
(
str
)
{
return
str
.
charAt
(
0
).
toUpperCase
()
+
str
.
slice
(
1
)
},
changeStatus
(
statusId
,
isSensitive
,
visibility
,
reportId
)
{
this
.
$store
.
dispatch
(
'
ChangeStatusScope
'
,
{
statusId
,
isSensitive
,
visibility
,
reportId
})
},
getStatusesTitle
(
statuses
)
{
console
.
log
(
this
.
report
)
return
`Reported statuses:
${
statuses
.
length
}
item(s)`
},
parseTimestamp
(
timestamp
)
{
...
...
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