Skip to content

Commit 2ea9951

Browse files
authored
DEV: Safe navigation to handle to nil current_user class issue (#344)
Another private plugin is extending this plugin and the current_user check here is a problem -- adding safe navigation does not break any existing functionality but allows for future changes.
1 parent 04edc37 commit 2ea9951

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/discourse_data_explorer/query_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def run
147147
query_params = {}
148148
query_params = MultiJson.load(params[:params]) if params[:params]
149149

150-
opts = { current_user: current_user.username }
150+
opts = { current_user: current_user&.username }
151151
opts[:explain] = true if params[:explain] == "true"
152152

153153
opts[:limit] = if params[:format] == "csv"

0 commit comments

Comments
 (0)