-
Notifications
You must be signed in to change notification settings - Fork 11
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
6064 – Refactor duplicated media creation methods #2223
Merged
+119
−144
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ed377e0
[WIP] First part: move methods to Media
vasconsaurus fa98310
[WIP] make create_media and create_original_claim similar
vasconsaurus ac8664e
merge methods to create claim into one
vasconsaurus 574319b
extract setting the media_type
vasconsaurus 9bc9271
merge methods to create uplodaded media and fix a variable name
vasconsaurus f194c1f
merge create_link methods
vasconsaurus 371bf03
do some cleanup
vasconsaurus e5f58d6
update methods names
vasconsaurus 4442c7b
fix undefined method `match?'
vasconsaurus d914b85
move set_media_type back and make create_media and create_original_cl…
vasconsaurus 007bc76
trying to combine methods and remove set_media_type
vasconsaurus fe841ae
Fix failing tests
vasconsaurus da90f9e
update condition on when to set_media_type
vasconsaurus 4a2be9e
update to use ProjectMedia.create instead of create_project_media
vasconsaurus 3d2f767
update to keep create_media only, instead of create_original_claim
vasconsaurus a2a97db
add ! to method name
vasconsaurus 9c49d01
Update so we only send the necessary data to media
vasconsaurus d4ebac0
try to deal with codeclimate complains
vasconsaurus 7507a0a
fix indentation
vasconsaurus 00dd298
try to make this a bit clearer
vasconsaurus 09625ae
remove deprecated tests
vasconsaurus d47e1ef
clean up
vasconsaurus 5b99440
replace ProjectMedia.create by ProjectMedia.create!
vasconsaurus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -745,7 +745,7 @@ def teardown | |
|
||
t = create_team | ||
p = create_project team: t | ||
pm = create_project_media team: t, set_original_claim: url | ||
pm = ProjectMedia.create!(team: t, set_original_claim: url) | ||
|
||
assert_not_nil pm | ||
|
||
|
@@ -807,7 +807,7 @@ def teardown | |
t.settings[:languages] << 'pt' | ||
t.save! | ||
p = create_project team: t | ||
pm = create_project_media team: t, set_original_claim: url | ||
pm = ProjectMedia.create!(team: t, set_original_claim: url) | ||
c = create_claim_description project_media: pm | ||
fc_1 = create_fact_check claim_description: c | ||
|
||
|
@@ -870,7 +870,7 @@ def teardown | |
WebMock.stub_request(:get, pender_url).with({ query: { url: url } }).to_return(body: response_body) | ||
|
||
t = create_team | ||
pm = create_project_media team: t, set_original_claim: url | ||
pm = ProjectMedia.create!(team: t, set_original_claim: url) | ||
cd = create_claim_description project_media: pm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest you replace |
||
fc = create_fact_check claim_description: cd | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Q: this line should return
self.media_id
or assign a value toself.media_id
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.
The
create_media
method changes the object and assigns the value, if I'm not mistaken. So I think we should be able to just returnself.media_id
.