Skip to content

Commit

Permalink
bugfix: get broadcast num after logging in #90
Browse files Browse the repository at this point in the history
  • Loading branch information
CapFreddy committed May 21, 2020
1 parent 6c7c3de commit f61773c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/controllers/broadcasts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def destroy_all
Broadcast.where(:to_id => user_id).each do |item|
item.destroy
end
update_broadcast_num
redirect_to broadcasts_path
end

Expand Down
6 changes: 4 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ def projects_data
end

def get_broadcast_num
user_id = User.find_by(gitlab_id: current_user.id).id
Broadcast.where(:to_id => user_id).length
if current_user.id
user_id = User.find_by(gitlab_id: current_user.id).id
Broadcast.where(:to_id => user_id).length
end
end

def ie_svg_meta_tag
Expand Down

0 comments on commit f61773c

Please sign in to comment.