remove comment edit time limit (philomena-dev/philomena#26)

This commit is contained in:
byte[] 2020-09-27 00:09:39 -04:00
parent f01a9cf20b
commit 02cbecb193

View file

@ -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}),