Skip to content

Implement public API feedback voting #641

@bajiat

Description

@bajiat

Refer to #542 for discussion

First version of communication channel between consumers and managers allows consumers to send feedback, request etc. about APIs and managers to view the feedback.

Wireframe

mockup

FeedbackVotes collection

This feature may use a new collection called FeedbackVotes. Each Feedback Vote document will contain the following fields:

  • feedbackId - string - the ID of the Feedback document
  • userId - string - the ID of the user
  • vote - integer - the numeric vote for the user (allowed values: 1 and -1)

Collection helper(s)

The following collection helper will be attached to the Feedback collection:

  • sumOfVotes() - adds all vote integers together, returns the sum of all votes as an integer

Server method(s)

The following method(s) will be defined on the server:

  • submitVote(vote) - takes an integer as an argument, checks whether user has already voted, either updates existing or adds new user vote

Publication(s)

The following publication(s) will be useful:

  • getAllVotesForSingleFeedback (feedbackId) - returns a database cursor for the following query:
FeedbackVotes.find({feedbackId: feedbackId});

Template-level subscription(s)

Each feedback template will subscribe to the getAllVotesForSingleFeedback publication. This will ensure that only votes for displayed feedback are returned.

Definition of done

  • Up and downvote arrows appear on each feedback item
  • The sum of all up/downvotes displays between up and down arrows
    • Display of sum of votes is visually prominent
  • Display of voting arrows is visually prominent
    • Arrows are large enough for easy interaction in touch device
  • Up/down arrows change visual appearance to indicate existing user vote
    • Color change
  • Mouse cursor changes to 'hand pointer' when hovering over vote arrow, to indicate the user can interact with arrow
  • Clicking on a vote a second time deletes user vote.
    • E.g. clicking up and up again 'resets' the user vote
  • Any given user can vote only once for a given feedback item
  • Anonymous votes are not allowed

Optional

  • Sum of votes displays to anonymous visitors
  • When anonymous visitor clicks vote arrow, an alert (sAlert) displays instructing the user to 'log in to vote'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions