mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 22:27:59 +01:00
remove comment edit time limit (philomena-dev/philomena#26)
This commit is contained in:
parent
f01a9cf20b
commit
02cbecb193
1 changed files with 3 additions and 7 deletions
|
@ -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}),
|
||||
|
|
Loading…
Reference in a new issue