Skip to content

Commit

Permalink
Add plugin url to plugin statistics store
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Oct 6, 2023
1 parent f873e25 commit 9c37dee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/plugin_manager/statistics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def discourse_params

def plugin_params
params.require(:plugins)
params.permit(plugins: [:name, :branch, :sha, data: {}])
params.permit(plugins: [:name, :branch, :sha, :url, data: {}])
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true
class AddUrlToDiscoursePluginStatisticsPlugin < ActiveRecord::Migration[7.0]
def change
add_column :discourse_plugin_statistics_plugins, :url, :string
end
end
3 changes: 3 additions & 0 deletions spec/requests/plugin_manager/statistics_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
let(:non_registered_plugin) { third_party_plugin }
let(:plugin_sha) { "12345678910" }
let(:plugin_branch) { "plugin_branch" }
let(:plugin_url) { "https://github.com/paviliondev/discourse-custom-wizard.git" }
let(:plugin_data) do
{
data_key_1: "data-val-1",
Expand All @@ -26,6 +27,7 @@
name: registered_plugin,
branch: plugin_branch,
sha: plugin_sha,
url: plugin_url,
data: plugin_data
}
]
Expand Down Expand Up @@ -91,6 +93,7 @@
discourse_id = #{discourse.id} AND
name = '#{registered_plugin}' AND
branch = '#{plugin_branch}' AND
url = '#{plugin_url}' AND
sha = '#{plugin_sha}' AND
data->>'data_key_1' = '#{plugin_data[:data_key_1]}'
").exists?
Expand Down

0 comments on commit 9c37dee

Please sign in to comment.