Skip to content

Commit 834370f

Browse files
committed
fix: ci fail standardrb fix
1 parent 3a23e15 commit 834370f

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

app/controllers/simple_discussion/forum_posts_controller.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class SimpleDiscussion::ForumPostsController < SimpleDiscussion::ApplicationCont
1010
delete_post: -10, # on forum post deletion
1111
marked_as_solution: 100, # if forum thread author/moderator marked the post as solved
1212
unmarked_as_solution: -100, # undoing the marked as solution
13-
delete_reported_post: -100, # if moderator deletes the post hence it is spam post
13+
delete_reported_post: -100 # if moderator deletes the post hence it is spam post
1414
}
1515

1616
def create
@@ -51,12 +51,12 @@ def destroy
5151
end
5252

5353
# leaderboard points distribution
54-
if is_moderator? and @forum_post.user != current_user
54+
if is_moderator? && (@forum_post.user != current_user)
5555
update_leaderboard(@forum_post.user, POINTS[:delete_reported_post])
5656
# further we can distribute points if needed to the user who reported the post
5757

58-
#spam_report = SpamReport.find_by(forum_post: @forum_post)
59-
#update_leaderboard(spam_report.user, POINTS[:report_spam]) if spam_report
58+
# spam_report = SpamReport.find_by(forum_post: @forum_post)
59+
# update_leaderboard(spam_report.user, POINTS[:report_spam]) if spam_report
6060
else
6161
update_leaderboard(@forum_post.user, POINTS[:delete_post])
6262
end
@@ -141,4 +141,3 @@ def redirect_after_delete_path(is_first_post)
141141
end
142142
end
143143
end
144-

app/controllers/simple_discussion/forum_threads_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class SimpleDiscussion::ForumThreadsController < SimpleDiscussion::ApplicationCo
77
POINTS = {
88
create_thread: 20, # on forum thread creation
99
delete_thread: -20, # on forum thread deletion
10-
delete_reported_thread_by_moderator: -100, # if moderator deletes the thread hence it is spam post
10+
delete_reported_thread_by_moderator: -100 # if moderator deletes the thread hence it is spam post
1111
}
1212

1313
def index
@@ -82,7 +82,7 @@ def update
8282
def destroy
8383
ActiveRecord::Base.transaction do
8484
@forum_thread.destroy!
85-
if is_moderator? and @forum_thread.user != current_user
85+
if is_moderator? && (@forum_thread.user != current_user)
8686
update_leaderboard(@forum_thread.user, POINTS[:delete_reported_thread_by_moderator])
8787
else
8888
update_leaderboard(@forum_thread.user, POINTS[:delete_thread])

db/migrate/20240808180738_create_forum_leaderboard.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class CreateForumLeaderboard < ActiveRecord::Migration[7.0]
22
def change
33
create_table :forum_leaderboards do |t|
4-
t.references :user, null: false, foreign_key: true, index: { unique: true }
4+
t.references :user, null: false, foreign_key: true, index: {unique: true}
55
t.integer :points, null: false, default: 0
66

77
t.timestamps

0 commit comments

Comments
 (0)