Skip to content

Commit

Permalink
Merge pull request #222 from digitalnatives/ghatighorias/remove_notif…
Browse files Browse the repository at this point in the history
…ication_job_executed_at_from_edit_page

Remove "NOTIFICATION_JOB_EXECUTED_AT" from the edit page
  • Loading branch information
ggpasqualino authored Sep 12, 2017
2 parents a9c1706 + 4540948 commit 469a5bd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions lib/course_planner/notifications/notifications.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ defmodule CoursePlanner.Notifications do
type: "utc_datetime",
required: true,
visible: false,
editable: true
editable: false
})
end

Expand All @@ -82,8 +82,7 @@ defmodule CoursePlanner.Notifications do
%{
value: DateTime.to_iso8601(timestamp),
type: "utc_datetime"
},
:update)
})
end

def create_simple_notification(%{type: type, user: user, path: path, data: data}) do
Expand Down
2 changes: 1 addition & 1 deletion lib/course_planner/settings/settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ defmodule CoursePlanner.Settings do
is_nil(found_system_variable) -> :non_existing_resource
not found_system_variable.editable -> :uneditable_resource
found_system_variable.editable ->
SystemVariable.changeset(found_system_variable, %{"value" => param_value}, :update)
SystemVariable.changeset(found_system_variable, %{"value" => param_value}, :user_update)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/course_planner/settings/system_variable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defmodule CoursePlanner.Settings.SystemVariable do
|> validate_value_type()
end

def changeset(struct, params, :update) do
def changeset(struct, params, :user_update) do
target_params =
[
:value,
Expand Down
2 changes: 1 addition & 1 deletion priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ unless Repo.get_by(SystemVariable, key: "NOTIFICATION_JOB_EXECUTED_AT") do
key: "NOTIFICATION_JOB_EXECUTED_AT",
value: DateTime.utc_now() |> DateTime.to_iso8601(),
type: "utc_datetime",
editable: true,
editable: false,
visible: false,
required: true
}) |> Repo.insert!
Expand Down
2 changes: 1 addition & 1 deletion test/lib/course_planner/settings/system_variable_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule CoursePlanner.SystemVariableTest do
end

test "changeset fails for uneditable system variable" do
changeset = SystemVariable.changeset(%SystemVariable{}, %{@string_valid_attrs | editable: false}, :update)
changeset = SystemVariable.changeset(%SystemVariable{}, %{@string_valid_attrs | editable: false}, :user_update)
refute changeset.valid?
end

Expand Down

0 comments on commit 469a5bd

Please sign in to comment.