-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3624 - Upgrade rails #4237
base: development
Are you sure you want to change the base?
3624 - Upgrade rails #4237
Conversation
305985c
to
da47801
Compare
:preferred_locale, | ||
:help, | ||
:footer_block, | ||
notification_attributes: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can pass in accepts_nested_attributes
for notification at user
model so we can update them together.
Further optimization needed in update_profile logic.
@work = Work.includes(pages: [{notes: :user}, {page_versions: :user}]).find_by(id: work.id) | ||
render_to_string :layout => false, :template => "export/show.html.erb" | ||
@work = Work.includes(pages: [{ notes: :user }, { page_versions: :user }]).find_by(id: work.id) | ||
render_to_string template: 'export/show', layout: false, formats: [:html], handlers: [:erb] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax seems to be not supported in newer versions of rails (I got multiple failures due to doing relative path with extention, ex: deed/deed.html
, export/show.html.erb
).
We instead pass in formats
and handlers
params
@@ -165,7 +165,7 @@ def ingest_work(id) | |||
|
|||
self.save! | |||
# now fetch the scandata.xml file and parse it | |||
scandata_url = "http://#{server}#{dir}/#{URI.encode(scandata_file)}" # will not work on new format: we cannot assume filenames are re-named with their content | |||
scandata_url = "http://#{server}#{dir}/#{CGI.escape(scandata_file)}" # will not work on new format: we cannot assume filenames are re-named with their content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URI.encode is deprecated, use CGI.escape instead.
(This is also why we need to use forked version of gravatar gem, old one is not updated and is still using URI.encode)
td =f.check_box("notifications[user_activity]", {checked: @user.notification.user_activity}) | ||
th =f.label :user_activity, t('.user_activity') | ||
-if @user.owner | ||
=f.fields_for :notification do |nf| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do fields_for, this is so we don't have to manually add the names. This will fall under notification_attributes
and we can pass in @user.update(user_params)
and the notification will also be updated
@@ -106,16 +106,34 @@ ignore_missing: | |||
- 'deed.deed.*' | |||
- 'article.graph.title' | |||
- 'thredded.*' | |||
es: &NOT_EN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aliases in yml files are now considered unsafe and not supported anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason: aliases in yml files are unsafe and rails moved away from supporting this
@@ -6,29 +6,28 @@ en: | |||
collection_inactive: Collection Inactive | |||
collection_joined: Collection Joined | |||
deed: | |||
html: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to scope in .html anymore since we moved it to formats: [:html], it still looks at translations .deed instead of at .deed.html
@@ -0,0 +1,47 @@ | |||
Layout/EmptyLinesAroundModuleBody: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find these configs a good default startinig point for rubocop. But these are preferential so we can tweak more moving forward.
1c048a9
to
86bc5a7
Compare
after_destroy :update_featured_page, if: Proc.new {|page| page.work.featured_page == page.id} | ||
|
||
serialize :metadata, Hash | ||
serialize :metadata, type: Hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New syntax, old is causing error
context 'subject linking not disabled (default)' do | ||
it 'builds the xml document' do | ||
expect(work.collection).to eq(collection) | ||
xml = page.wiki_to_xml(page, Page::TEXT_TYPE::TRANSCRIPTION) | ||
expect(Article.all.count).to eq(3) | ||
expect(PageArticleLink.all.count).to eq(4) | ||
expect(xml).to eq(EXPECTED_XML) | ||
expect(Nokogiri::XML(xml).to_s).to eq(Nokogiri::XML(EXPECTED_XML).to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason eq() matching is failing due to inconsistent tabs/spaces, but contents are literally the same. Doing this ensures we compare the contents.
41ed7b9
to
2c808ae
Compare
e4917fc
to
7d50130
Compare
2ac7272
to
2c808ae
Compare
ea1ead6
to
2d3620d
Compare
2d3620d
to
204fff3
Compare
6a34cf4
to
6599dd2
Compare
6599dd2
to
9457096
Compare
Retained all specs for (with some minor changes on deprecated syntax)