Skip to content

Commit

Permalink
Fix input length validation for polls
Browse files Browse the repository at this point in the history
  • Loading branch information
alxlion committed Jul 27, 2024
1 parent d40f3ad commit f1b732f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ test/e2e/node_modules
.DS_Store
priv/static/.well-known/apple-developer-merchantid-domain-association
priv/static/loaderio-eb3b956a176cdd4f54eb8570ce8bbb06.txt
.elixir_ls
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- LTI 1.3 support
- New layout for presentation manager

### Fixes and improvements

- Fix input length validation for polls

## v2.0.1

### Features
Expand Down
1 change: 1 addition & 0 deletions lib/claper/polls/poll.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ defmodule Claper.Polls.Poll do
|> cast(attrs, [:title, :presentation_file_id, :position, :enabled, :total, :multiple])
|> cast_assoc(:poll_opts, required: true)
|> validate_required([:title, :presentation_file_id, :position])
|> validate_length(:title, max: 255)
end
end
1 change: 1 addition & 0 deletions lib/claper/polls/poll_opt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ defmodule Claper.Polls.PollOpt do
poll_opt
|> cast(attrs, [:content, :vote_count, :poll_id])
|> validate_required([:content])
|> validate_length(:content, max: 255)
end
end
2 changes: 1 addition & 1 deletion lib/claper_web/live/poll_live/form_component.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<%= inputs_for f, :poll_opts, fn i -> %>
<div class="flex space-x-3 mt-3 items-center justify-start">
<div>
<div class="flex-1">
<ClaperWeb.Component.Input.text
form={i}
labelClass={if @dark, do: "text-white"}
Expand Down

0 comments on commit f1b732f

Please sign in to comment.