From 02cbecb193f85467ac998fc4b5c10fbe14e85ff4 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 27 Sep 2020 00:09:39 -0400 Subject: [PATCH] remove comment edit time limit (philomena-dev/philomena#26) --- lib/philomena/users/ability.ex | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/philomena/users/ability.ex b/lib/philomena/users/ability.ex index 2a3efbc5..a8cedb88 100644 --- a/lib/philomena/users/ability.ex +++ b/lib/philomena/users/ability.ex @@ -340,13 +340,9 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do do: true # Edit comments on images - def can?(%User{id: id}, action, %Comment{hidden_from_users: false, user_id: id} = comment) - when action in [:edit, :update] do - # comment must have been made no later than 15 minutes ago - time_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-15 * 60) - - NaiveDateTime.diff(comment.created_at, time_ago) > 0 - end + def can?(%User{id: id}, action, %Comment{hidden_from_users: false, user_id: id}) + when action in [:edit, :update], + do: true # Edit metadata on images where that is allowed def can?(_user, :edit_metadata, %Image{hidden_from_users: false, tag_editing_allowed: true}),