Skip to content

Commit

Permalink
allow users to edit story URLs
Browse files Browse the repository at this point in the history
We see a steady stream of typos, finding better links, or people getting
suprised by the tweaks in Story#url=. Edits go to the modlog, so the risks of
abusive URL replacement seems pretty low.
  • Loading branch information
pushcx committed Feb 23, 2024
1 parent f43752f commit 936045b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def is_editable_by_user?(user)
if is_moderated?
false
else
(Time.current.to_i - created_at.to_i < (60 * MAX_EDIT_MINS))
created_at.after?(MAX_EDIT_MINS.minutes.ago)
end
else
false
Expand Down Expand Up @@ -872,6 +872,8 @@ def url=(u)
def url_is_editable_by_user?(user)
if new_record?
true
elsif !is_moderated? && created_at.after?(MAX_EDIT_MINS.minutes.ago)
true
else
user&.is_moderator?
end
Expand Down

0 comments on commit 936045b

Please sign in to comment.