fix #57: allow users vote even if they voted
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				/ depoly (push) Successful in 1m24s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	/ depoly (push) Successful in 1m24s
				
			This commit is contained in:
		
							parent
							
								
									b2db680076
								
							
						
					
					
						commit
						b6fbe71a51
					
				
					 1 changed files with 12 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -9,7 +9,7 @@ import {
 | 
			
		|||
} from "solid-js";
 | 
			
		||||
import "./TootPoll.css";
 | 
			
		||||
import type { mastodon } from "masto";
 | 
			
		||||
import { resolveCustomEmoji } from "../../masto/toot";
 | 
			
		||||
import { resolveCustomEmoji } from "../../masto/toot.js";
 | 
			
		||||
import {
 | 
			
		||||
  Button,
 | 
			
		||||
  Checkbox,
 | 
			
		||||
| 
						 | 
				
			
			@ -20,11 +20,11 @@ import {
 | 
			
		|||
  Radio,
 | 
			
		||||
} from "@suid/material";
 | 
			
		||||
import { formatDistance, isBefore } from "date-fns";
 | 
			
		||||
import { useTimeSource } from "~platform/timesrc";
 | 
			
		||||
import { useDateFnLocale } from "~platform/i18n";
 | 
			
		||||
import TootPollDialog from "./TootPollDialog";
 | 
			
		||||
import { ANIM_CURVE_STD } from "~material/theme";
 | 
			
		||||
import { useTootEnv } from "../RegularToot";
 | 
			
		||||
import { useTimeSource } from "~platform/timesrc.js";
 | 
			
		||||
import { useDateFnLocale } from "~platform/i18n.js";
 | 
			
		||||
import TootPollDialog from "./TootPollDialog.js";
 | 
			
		||||
import { ANIM_CURVE_STD } from "~material/theme.js";
 | 
			
		||||
import { useTootEnv } from "../RegularToot.js";
 | 
			
		||||
 | 
			
		||||
type TootPollProps = {
 | 
			
		||||
  value: mastodon.v1.Poll;
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +50,12 @@ const TootPoll: Component<TootPollProps> = (props) => {
 | 
			
		|||
      return n;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return poll().expired || poll().voted;
 | 
			
		||||
    // TODO: More info for when is a poll available for vote
 | 
			
		||||
    // I don't know the exact condition that the server
 | 
			
		||||
    // prevent the user voting - say, mona allows you
 | 
			
		||||
    // change your vote even after voted. I guess we
 | 
			
		||||
    // need more test on that.
 | 
			
		||||
    return poll().expired;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const isOwnVote = createSelector(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue