Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Pleroma
pleroma-fe
Commits
52c22e86
Commit
52c22e86
authored
4 years ago
by
Shpuld Shpludson
Browse files
Options
Downloads
Patches
Plain Diff
Fix setting report state, add proper error handling
parent
3e6309ef
No related branches found
No related tags found
2 merge requests
!1711
Update stable - 2.5.0 release
,
!1322
#949 Feat/report notification
Pipeline
#34610
passed
4 years ago
Stage: lint
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/i18n/en.json
+1
-0
1 addition, 0 deletions
src/i18n/en.json
src/modules/reports.js
+7
-2
7 additions, 2 deletions
src/modules/reports.js
src/services/api/api.service.js
+26
-10
26 additions, 10 deletions
src/services/api/api.service.js
with
34 additions
and
12 deletions
src/i18n/en.json
+
1
−
0
View file @
52c22e86
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
"more"
:
"More"
,
"more"
:
"More"
,
"loading"
:
"Loading…"
,
"loading"
:
"Loading…"
,
"generic_error"
:
"An error occured"
,
"generic_error"
:
"An error occured"
,
"generic_error_message"
:
"An error occured: {0}"
,
"error_retry"
:
"Please try again"
,
"error_retry"
:
"Please try again"
,
"retry"
:
"Try again"
,
"retry"
:
"Try again"
,
"optional"
:
"optional"
,
"optional"
:
"optional"
,
...
...
This diff is collapsed.
Click to expand it.
src/modules/reports.js
+
7
−
2
View file @
52c22e86
...
@@ -41,7 +41,7 @@ const reports = {
...
@@ -41,7 +41,7 @@ const reports = {
closeUserReportingModal
({
commit
})
{
closeUserReportingModal
({
commit
})
{
commit
(
'
closeUserReportingModal
'
)
commit
(
'
closeUserReportingModal
'
)
},
},
setReportState
({
commit
,
rootState
},
{
id
,
state
})
{
setReportState
({
commit
,
dispatch
,
rootState
},
{
id
,
state
})
{
const
oldState
=
rootState
.
reports
.
reports
[
id
].
state
const
oldState
=
rootState
.
reports
.
reports
[
id
].
state
console
.
log
(
oldState
,
state
)
console
.
log
(
oldState
,
state
)
commit
(
'
setReportState
'
,
{
id
,
state
})
commit
(
'
setReportState
'
,
{
id
,
state
})
...
@@ -49,8 +49,13 @@ const reports = {
...
@@ -49,8 +49,13 @@ const reports = {
console
.
log
(
report
)
console
.
log
(
report
)
}).
catch
(
e
=>
{
}).
catch
(
e
=>
{
console
.
error
(
'
Failed to set report state
'
,
e
)
console
.
error
(
'
Failed to set report state
'
,
e
)
dispatch
(
'
pushGlobalNotice
'
,
{
level
:
'
error
'
,
messageKey
:
'
general.generic_error_message
'
,
messageArgs
:
[
e
.
message
],
timeout
:
5000
})
commit
(
'
setReportState
'
,
{
id
,
state
:
oldState
})
commit
(
'
setReportState
'
,
{
id
,
state
:
oldState
})
console
.
log
(
oldState
)
})
})
},
},
addReport
({
commit
},
report
)
{
addReport
({
commit
},
report
)
{
...
...
This diff is collapsed.
Click to expand it.
src/services/api/api.service.js
+
26
−
10
View file @
52c22e86
...
@@ -1270,18 +1270,34 @@ const deleteChatMessage = ({ chatId, messageId, credentials }) => {
...
@@ -1270,18 +1270,34 @@ const deleteChatMessage = ({ chatId, messageId, credentials }) => {
}
}
const
setReportState
=
({
id
,
state
,
credentials
})
=>
{
const
setReportState
=
({
id
,
state
,
credentials
})
=>
{
return
promisedRequest
({
// Can't use promisedRequest because on OK this does not return json
url
:
PLEROMA_ADMIN_REPORTS
,
return
fetch
(
PLEROMA_ADMIN_REPORTS
,
{
headers
:
{
...
authHeaders
(
credentials
),
'
Accept
'
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
},
method
:
'
PATCH
'
,
method
:
'
PATCH
'
,
payload
:
{
body
:
JSON
.
stringify
({
'
reports
'
:
[
reports
:
[{
{
id
,
id
,
state
state
}]
}
})
]
}
})
})
.
then
(
data
=>
{
if
(
data
.
status
>=
500
)
{
throw
Error
(
data
.
statusText
)
}
else
if
(
data
.
status
>=
400
)
{
return
data
.
json
()
}
return
data
})
.
then
(
data
=>
{
if
(
data
.
errors
)
{
throw
Error
(
data
.
errors
[
0
].
message
)
}
})
}
}
const
apiService
=
{
const
apiService
=
{
...
...
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