Skip to content

Disable vote button if user already voted#101

Merged
DavidIQ merged 2 commits intophpbb:masterfrom
iMattPro:vote-fix
Apr 17, 2018
Merged

Disable vote button if user already voted#101
DavidIQ merged 2 commits intophpbb:masterfrom
iMattPro:vote-fix

Conversation

@iMattPro
Copy link
Copy Markdown
Member

@iMattPro iMattPro commented Apr 3, 2018

Fixes #76

@iMattPro iMattPro requested a review from DavidIQ April 16, 2018 00:56
Comment thread event/listener.php
if ($this->user->data['user_id'] == $vote['user_id'])
{
$s_voted_up = ((int) $vote['vote_value'] === 1);
$s_voted_down = ((int) $vote['vote_value'] === 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t we just break here once we’ve matched on a vote?

Copy link
Copy Markdown
Member Author

@iMattPro iMattPro Apr 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because we still need to assign template vars for each user who voted, same goes for other comment why we need to go through this. This creates the list of all the users who voted.

Comment thread event/listener.php
$event['topic_data']['topic_status'] != ITEM_LOCKED);

$s_voted_up = $s_voted_down = false;
if ($idea['idea_votes_up'] || $idea['idea_votes_down'])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also check the $can_vote status here so there’s no need to even go in here.

@DavidIQ DavidIQ merged commit f70e27f into phpbb:master Apr 17, 2018
@iMattPro iMattPro deleted the vote-fix branch April 17, 2018 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants