Skip to content

Commit ce7844d

Browse files
committed
allow users to delete their own threads
1 parent 293e745 commit ce7844d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

config/initializers/thredded.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,13 @@
156156
#
157157
# add in (must install separate gem (under development) as well):
158158
# Thredded.notifiers = [Thredded::EmailNotifier.new, Thredded::PushoverNotifier.new(ENV['PUSHOVER_APP_ID'])]
159+
160+
module AllowUsersToDeleteOwnTopics
161+
def destroy?
162+
super || @topic.user_id == @user.id
163+
end
164+
end
165+
166+
Rails.application.config.to_prepare do
167+
Thredded::TopicPolicy.prepend AllowUsersToDeleteOwnTopics
168+
end

0 commit comments

Comments
 (0)