Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
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
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
Pierre Boudes
mastodon
Commits
b7910bc7
Unverified
Commit
b7910bc7
authored
1 year ago
by
Eugen Rochko
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add button to see results for polls in web UI (#25726)
parent
eb2417ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/javascript/mastodon/components/poll.jsx
+9
-4
9 additions, 4 deletions
app/javascript/mastodon/components/poll.jsx
app/javascript/mastodon/locales/en.json
+1
-0
1 addition, 0 deletions
app/javascript/mastodon/locales/en.json
with
10 additions
and
4 deletions
app/javascript/mastodon/components/poll.jsx
+
9
−
4
View file @
b7910bc7
...
...
@@ -130,6 +130,10 @@ class Poll extends ImmutablePureComponent {
this
.
props
.
refresh
();
};
handleReveal
=
()
=>
{
this
.
setState
({
revealed
:
true
});
}
renderOption
(
option
,
optionIndex
,
showResults
)
{
const
{
poll
,
lang
,
disabled
,
intl
}
=
this
.
props
;
const
pollVotesCount
=
poll
.
get
(
'
voters_count
'
)
||
poll
.
get
(
'
votes_count
'
);
...
...
@@ -205,14 +209,14 @@ class Poll extends ImmutablePureComponent {
render
()
{
const
{
poll
,
intl
}
=
this
.
props
;
const
{
expired
}
=
this
.
state
;
const
{
revealed
,
expired
}
=
this
.
state
;
if
(
!
poll
)
{
return
null
;
}
const
timeRemaining
=
expired
?
intl
.
formatMessage
(
messages
.
closed
)
:
<
RelativeTimestamp
timestamp
=
{
poll
.
get
(
'
expires_at
'
)
}
futureDate
/>;
const
showResults
=
poll
.
get
(
'
voted
'
)
||
expired
;
const
showResults
=
poll
.
get
(
'
voted
'
)
||
revealed
||
expired
;
const
disabled
=
this
.
props
.
disabled
||
Object
.
entries
(
this
.
state
.
selected
).
every
(
item
=>
!
item
);
let
votesCount
=
null
;
...
...
@@ -231,9 +235,10 @@ class Poll extends ImmutablePureComponent {
<
div
className
=
'poll__footer'
>
{
!
showResults
&&
<
button
className
=
'button button-secondary'
disabled
=
{
disabled
||
!
this
.
context
.
identity
.
signedIn
}
onClick
=
{
this
.
handleVote
}
><
FormattedMessage
id
=
'poll.vote'
defaultMessage
=
'Vote'
/></
button
>
}
{
showResults
&&
!
this
.
props
.
disabled
&&
<
span
><
button
className
=
'poll__link'
onClick
=
{
this
.
handleRefresh
}
><
FormattedMessage
id
=
'poll.refresh'
defaultMessage
=
'Refresh'
/></
button
>
·
</
span
>
}
{
!
showResults
&&
<><
button
className
=
'poll__link'
onClick
=
{
this
.
handleReveal
}
><
FormattedMessage
id
=
'poll.reveal'
defaultMessage
=
'See results'
/></
button
>
·
</>
}
{
showResults
&&
!
this
.
props
.
disabled
&&
<><
button
className
=
'poll__link'
onClick
=
{
this
.
handleRefresh
}
><
FormattedMessage
id
=
'poll.refresh'
defaultMessage
=
'Refresh'
/></
button
>
·
</>
}
{
votesCount
}
{
poll
.
get
(
'
expires_at
'
)
&&
<
span
>
·
{
timeRemaining
}
</
span
>
}
{
poll
.
get
(
'
expires_at
'
)
&&
<>
·
{
timeRemaining
}
</>
}
</
div
>
</
div
>
);
...
...
This diff is collapsed.
Click to expand it.
app/javascript/mastodon/locales/en.json
+
1
−
0
View file @
b7910bc7
...
...
@@ -487,6 +487,7 @@
"picture_in_picture.restore"
:
"Put it back"
,
"poll.closed"
:
"Closed"
,
"poll.refresh"
:
"Refresh"
,
"poll.reveal"
:
"See results"
,
"poll.total_people"
:
"{count, plural, one {# person} other {# people}}"
,
"poll.total_votes"
:
"{count, plural, one {# vote} other {# votes}}"
,
"poll.vote"
:
"Vote"
,
...
...
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