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
dca1560c
Commit
dca1560c
authored
4 years ago
by
xaralis
Browse files
Options
Downloads
Patches
Plain Diff
feat: disallow adding proposals by regp
parent
05654387
No related branches found
No related tags found
No related merge requests found
Pipeline
#2067
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/containers/AddPostForm.jsx
+53
-43
53 additions, 43 deletions
src/containers/AddPostForm.jsx
src/pages/Home.jsx
+1
-1
1 addition, 1 deletion
src/pages/Home.jsx
with
54 additions
and
44 deletions
src/containers/AddPostForm.jsx
+
53
−
43
View file @
dca1560c
...
@@ -10,7 +10,7 @@ import ErrorMessage from "components/ErrorMessage";
...
@@ -10,7 +10,7 @@ import ErrorMessage from "components/ErrorMessage";
import
MarkdownEditor
from
"
components/mde/MarkdownEditor
"
;
import
MarkdownEditor
from
"
components/mde/MarkdownEditor
"
;
import
{
useActionState
}
from
"
hooks
"
;
import
{
useActionState
}
from
"
hooks
"
;
const
AddPostForm
=
({
className
})
=>
{
const
AddPostForm
=
({
className
,
canAddProposal
})
=>
{
const
cardRef
=
useRef
();
const
cardRef
=
useRef
();
const
editorRef
=
useRef
();
const
editorRef
=
useRef
();
const
[
expanded
,
setExpanded
]
=
useState
(
false
);
const
[
expanded
,
setExpanded
]
=
useState
(
false
);
...
@@ -34,16 +34,24 @@ const AddPostForm = ({ className }) => {
...
@@ -34,16 +34,24 @@ const AddPostForm = ({ className }) => {
setExpanded
(
false
);
setExpanded
(
false
);
},
[
setExpanded
]);
},
[
setExpanded
]);
const
onWrite
=
useCallback
(()
=>
{
const
onWrite
=
useCallback
(
(
evt
)
=>
{
setShowAddConfirm
(
false
);
if
(
!
expanded
)
{
if
(
!
expanded
)
{
setExpanded
(
true
);
setExpanded
(
true
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
editorRef
.
current
&&
editorRef
.
current
.
finalRefs
.
textarea
.
current
)
{
if
(
editorRef
.
current
&&
editorRef
.
current
.
finalRefs
.
textarea
.
current
)
{
editorRef
.
current
.
finalRefs
.
textarea
.
current
.
focus
();
editorRef
.
current
.
finalRefs
.
textarea
.
current
.
focus
();
}
}
},
0
);
},
0
);
}
}
},
[
setExpanded
,
expanded
]);
},
[
setExpanded
,
expanded
,
setShowAddConfirm
]
);
const
hideAddConfirm
=
useCallback
(()
=>
{
const
hideAddConfirm
=
useCallback
(()
=>
{
setShowAddConfirm
(
false
);
setShowAddConfirm
(
false
);
...
@@ -88,7 +96,7 @@ const AddPostForm = ({ className }) => {
...
@@ -88,7 +96,7 @@ const AddPostForm = ({ className }) => {
className
,
className
,
"
hover:elevation-16 transition duration-500
"
,
"
hover:elevation-16 transition duration-500
"
,
{
{
"
elevation-4 cursor-text
"
:
!
expanded
,
"
elevation-4 cursor-text
"
:
!
expanded
&&
!
showAddConfirm
,
"
lg:elevation-16 container-padding--zero lg:container-padding--auto
"
:
expanded
,
"
lg:elevation-16 container-padding--zero lg:container-padding--auto
"
:
expanded
,
}
}
);
);
...
@@ -146,6 +154,7 @@ const AddPostForm = ({ className }) => {
...
@@ -146,6 +154,7 @@ const AddPostForm = ({ className }) => {
]
}
]
}
/>
/>
{
canAddProposal
&&
(
<
div
<
div
className
=
"form-field"
className
=
"form-field"
onChange
=
{
(
evt
)
=>
setType
(
evt
.
target
.
value
)
}
onChange
=
{
(
evt
)
=>
setType
(
evt
.
target
.
value
)
}
...
@@ -179,6 +188,7 @@ const AddPostForm = ({ className }) => {
...
@@ -179,6 +188,7 @@ const AddPostForm = ({ className }) => {
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
{
type
===
"
procedure-proposal
"
&&
(
{
type
===
"
procedure-proposal
"
&&
(
<
p
className
=
"alert alert--light text-sm"
>
<
p
className
=
"alert alert--light text-sm"
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/Home.jsx
+
1
−
1
View file @
dca1560c
...
@@ -330,7 +330,7 @@ const Home = () => {
...
@@ -330,7 +330,7 @@ const Home = () => {
)
}
)
}
{
programEntry
.
discussionOpened
&&
{
programEntry
.
discussionOpened
&&
isAuthenticated
&&
isAuthenticated
&&
!
user
.
isBanned
&&
<
AddPostForm
className
=
"mb-8"
/>
}
!
user
.
isBanned
&&
<
AddPostForm
className
=
"mb-8"
canAddProposal
=
{
user
.
role
===
"
member
"
||
user
.
role
===
"
chairman
"
}
/>
}
<
PostsContainer
<
PostsContainer
className
=
"container-padding--zero lg:container-padding--auto"
className
=
"container-padding--zero lg:container-padding--auto"
...
...
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