Skip to content

Commit

Permalink
allow users to delete their own threads
Browse files Browse the repository at this point in the history
  • Loading branch information
drusepth committed Dec 12, 2018
1 parent 293e745 commit ce7844d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/initializers/thredded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,13 @@
#
# add in (must install separate gem (under development) as well):
# Thredded.notifiers = [Thredded::EmailNotifier.new, Thredded::PushoverNotifier.new(ENV['PUSHOVER_APP_ID'])]

module AllowUsersToDeleteOwnTopics
def destroy?
super || @topic.user_id == @user.id
end
end

Rails.application.config.to_prepare do
Thredded::TopicPolicy.prepend AllowUsersToDeleteOwnTopics
end

0 comments on commit ce7844d

Please sign in to comment.