diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 98f797f277..1647b5de9e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp` -# using RuboCop version 1.75.0. +# using RuboCop version 1.75.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -64,11 +64,6 @@ Style/HashTransformValues: - 'app/serializers/rest/web_push_subscription_serializer.rb' - 'app/services/import_service.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/MapToHash: - Exclude: - - 'app/models/status.rb' - # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: diff --git a/Gemfile.lock b/Gemfile.lock index e49854c6bf..2d724b397b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -395,7 +395,7 @@ GEM rexml link_header (0.0.8) lint_roller (1.1.0) - linzer (0.6.2) + linzer (0.6.3) openssl (~> 3.0, >= 3.0.0) rack (>= 2.2, < 4.0) starry (~> 0.2) @@ -839,7 +839,7 @@ GEM base64 stoplight (4.1.1) redlock (~> 1.0) - stringio (3.1.5) + stringio (3.1.6) strong_migrations (2.2.1) activerecord (>= 7) swd (2.0.3) diff --git a/app/javascript/flavours/glitch/components/poll.tsx b/app/javascript/flavours/glitch/components/poll.tsx index 6302e80ce1..34ecb0d255 100644 --- a/app/javascript/flavours/glitch/components/poll.tsx +++ b/app/javascript/flavours/glitch/components/poll.tsx @@ -7,7 +7,6 @@ import classNames from 'classnames'; import { animated, useSpring } from '@react-spring/web'; import escapeTextContentForBrowser from 'escape-html'; -import { debounce } from 'lodash'; import CheckIcon from '@/material-icons/400-24px/check.svg?react'; import { openModal } from 'flavours/glitch/actions/modal'; @@ -45,9 +44,7 @@ interface PollProps { disabled?: boolean; } -export const Poll: React.FC = (props) => { - const { pollId, status } = props; - +export const Poll: React.FC = ({ pollId, disabled, status }) => { // Third party hooks const poll = useAppSelector((state) => state.polls[pollId]); const identity = useIdentity(); @@ -97,12 +94,12 @@ export const Poll: React.FC = (props) => { ); }, [poll]); - const disabled = - props.disabled || Object.values(selected).every((item) => !item); + const voteDisabled = + disabled || Object.values(selected).every((item) => !item); // Event handlers const handleVote = useCallback(() => { - if (disabled) { + if (voteDisabled) { return; } @@ -120,7 +117,7 @@ export const Poll: React.FC = (props) => { }), ); } - }, [disabled, dispatch, identity, pollId, selected, status]); + }, [voteDisabled, dispatch, identity, pollId, selected, status]); const handleReveal = useCallback(() => { setRevealed(true); @@ -130,13 +127,7 @@ export const Poll: React.FC = (props) => { if (disabled) { return; } - debounce( - () => { - void dispatch(fetchPoll({ pollId })); - }, - 1000, - { leading: true }, - ); + void dispatch(fetchPoll({ pollId })); }, [disabled, dispatch, pollId]); const handleOptionChange = useCallback( @@ -181,7 +172,7 @@ export const Poll: React.FC = (props) => { {!showResults && (