mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add rubocop to our build. (#5004)
This commit is contained in:
@@ -23,7 +23,7 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
|
||||
def execute
|
||||
create_users(@client.query("SELECT uid id, name, mail email, created FROM users;")) do |row|
|
||||
{id: row['id'], username: row['name'], email: row['email'], created_at: Time.zone.at(row['created'])}
|
||||
{ id: row['id'], username: row['name'], email: row['email'], created_at: Time.zone.at(row['created']) }
|
||||
end
|
||||
|
||||
# You'll need to edit the following query for your Drupal install:
|
||||
@@ -32,7 +32,7 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
# * Table name may be term_data.
|
||||
# * May need to select a vid other than 1.
|
||||
create_categories(categories_query) do |c|
|
||||
{id: c['tid'], name: c['name'], description: c['description']}
|
||||
{ id: c['tid'], name: c['name'], description: c['description'] }
|
||||
end
|
||||
|
||||
# "Nodes" in Drupal are divided into types. Here we import two types,
|
||||
@@ -82,7 +82,7 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
created_at: Time.zone.at(row['created']),
|
||||
pinned_at: row['sticky'].to_i == 1 ? Time.zone.at(row['created']) : nil,
|
||||
title: row['title'].try(:strip),
|
||||
custom_fields: {import_id: "nid:#{row['nid']}"}
|
||||
custom_fields: { import_id: "nid:#{row['nid']}" }
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -121,7 +121,7 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
|
||||
break if results.size < 1
|
||||
|
||||
next if all_records_exist? :posts, results.map {|p| "nid:#{p['nid']}"}
|
||||
next if all_records_exist? :posts, results.map { |p| "nid:#{p['nid']}" }
|
||||
|
||||
create_posts(results, total: total_count, offset: offset) do |row|
|
||||
{
|
||||
@@ -169,7 +169,7 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
|
||||
break if results.size < 1
|
||||
|
||||
next if all_records_exist? :posts, results.map {|p| "cid:#{p['cid']}"}
|
||||
next if all_records_exist? :posts, results.map { |p| "cid:#{p['cid']}" }
|
||||
|
||||
create_posts(results, total: total_count, offset: offset) do |row|
|
||||
topic_mapping = topic_lookup_from_imported_post_id("nid:#{row['nid']}")
|
||||
@@ -183,7 +183,7 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
}
|
||||
if row['pid']
|
||||
parent = topic_lookup_from_imported_post_id("cid:#{row['pid']}")
|
||||
h[:reply_to_post_number] = parent[:post_number] if parent and parent[:post_number] > 1
|
||||
h[:reply_to_post_number] = parent[:post_number] if parent && parent[:post_number] > (1)
|
||||
end
|
||||
h
|
||||
else
|
||||
@@ -196,6 +196,6 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||
|
||||
end
|
||||
|
||||
if __FILE__==$0
|
||||
if __FILE__ == $0
|
||||
ImportScripts::Drupal.new.perform
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user