Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cf-online-ui
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
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
TO
cf-online-ui
Commits
e060ae5e
Commit
e060ae5e
authored
4 years ago
by
xaralis
Browse files
Options
Downloads
Patches
Plain Diff
feat: do not allow banned users to edit their posts
parent
35b9dd80
No related branches found
No related tags found
No related merge requests found
Pipeline
#1967
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/actions/posts.js
+16
-1
16 additions, 1 deletion
src/actions/posts.js
src/components/posts/Post.jsx
+2
-1
2 additions, 1 deletion
src/components/posts/Post.jsx
with
18 additions
and
2 deletions
src/actions/posts.js
+
16
−
1
View file @
e060ae5e
...
@@ -3,7 +3,7 @@ import property from "lodash/property";
...
@@ -3,7 +3,7 @@ import property from "lodash/property";
import
{
createAsyncAction
,
errorResult
,
successResult
}
from
"
pullstate
"
;
import
{
createAsyncAction
,
errorResult
,
successResult
}
from
"
pullstate
"
;
import
{
fetch
}
from
"
api
"
;
import
{
fetch
}
from
"
api
"
;
import
{
PostStore
}
from
"
stores
"
;
import
{
AuthStore
,
PostStore
}
from
"
stores
"
;
import
{
import
{
createSeenWriter
,
createSeenWriter
,
filterPosts
,
filterPosts
,
...
@@ -176,6 +176,21 @@ export const edit = createAsyncAction(
...
@@ -176,6 +176,21 @@ export const edit = createAsyncAction(
}
catch
(
err
)
{
}
catch
(
err
)
{
return
errorResult
([],
err
.
toString
());
return
errorResult
([],
err
.
toString
());
}
}
},
{
shortCircuitHook
:
({
args
})
=>
{
const
{
user
}
=
AuthStore
.
getRawState
();
if
(
!
user
)
{
return
errorResult
();
}
if
(
user
&&
user
.
isBanned
)
{
return
errorResult
();
}
return
false
;
},
}
}
);
);
...
...
This diff is collapsed.
Click to expand it.
src/components/posts/Post.jsx
+
2
−
1
View file @
e060ae5e
...
@@ -163,7 +163,8 @@ const Post = ({
...
@@ -163,7 +163,8 @@ const Post = ({
type
===
"
procedure-proposal
"
&&
type
===
"
procedure-proposal
"
&&
[
"
announced
"
,
"
pending
"
].
includes
(
state
);
[
"
announced
"
,
"
pending
"
].
includes
(
state
);
const
showEditAction
=
const
showEditAction
=
isChairman
||
(
currentUser
&&
currentUser
.
id
===
author
.
id
);
isChairman
||
(
currentUser
&&
currentUser
.
id
===
author
.
id
&&
!
currentUser
.
isBanned
);
const
showBanAction
=
isChairman
&&
!
author
.
isBanned
;
const
showBanAction
=
isChairman
&&
!
author
.
isBanned
;
const
showUnbanAction
=
isChairman
&&
author
.
isBanned
;
const
showUnbanAction
=
isChairman
&&
author
.
isBanned
;
const
showHideAction
=
isChairman
&&
!
archived
;
const
showHideAction
=
isChairman
&&
!
archived
;
...
...
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