-
Notifications
You must be signed in to change notification settings - Fork 506
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
fix(Twitter): urls are now formatted with the std https://twitter.com… #3925
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1aef7ab
fix(Twitter): urls are now formatted with the std https://twitter.com…
rowasc 9d56472
fix(Twitter): urls are now formatted with the std https://twitter.com…
rowasc bd2280c
fix(Twitter): urls are now formatted with the std https://twitter.com…
rowasc 12e2ced
Fix twitter test with new tweet url
rowasc 190c0b6
Merge branch 'develop' into twitter-urls-fix
rowasc de2adf2
Fix style issues
rowasc 1b074f9
Merge branch 'twitter-urls-fix' of https://github.com/ushahidi/platfo…
rowasc 97a8399
Fix style issues
rowasc 3769936
Fix lint
rowasc bf7598e
Fix lint
rowasc 3241f62
Merge branch 'develop' into twitter-urls-fix
rowasc 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class RewriteTwitterUrls extends AbstractMigration | ||
{ | ||
/** | ||
* Change Method. | ||
* | ||
* Write your reversible migrations using this method. | ||
* | ||
* More information on writing migrations is available here: | ||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class | ||
* | ||
* The following commands can be used in this method and Phinx will | ||
* automatically reverse them when rolling back: | ||
* | ||
* createTable | ||
* renameTable | ||
* addColumn | ||
* renameColumn | ||
* addIndex | ||
* addForeignKey | ||
* | ||
* Remember to call "create()" or "update()" and NOT "save()" when working | ||
* with the Table class. | ||
*/ | ||
public function up() | ||
{ | ||
$sql = "UPDATE messages INNER JOIN contacts on contacts.id = messages.contact_id " . | ||
"SET messages.message = " . | ||
"REPLACE(messages.message, concat('https://twitter.com/statuses/', messages.data_source_message_id), " . | ||
"concat('https://twitter.com/', contacts.contact, '/status/', messages.data_source_message_id)) " . | ||
"WHERE `messages`.`type` = 'twitter'"; | ||
$this->execute($sql); | ||
} | ||
|
||
public function down() | ||
{ | ||
// phpcs:ignore | ||
$sql = "UPDATE messages INNER JOIN contacts on contacts.id = messages.contact_id " . | ||
"SET messages.message = REPLACE(messages.message, " . | ||
"concat('https://twitter.com/', contacts.contact, '/status/', messages.data_source_message_id), " . | ||
"concat('https://twitter.com/statuses/', messages.data_source_message_id)) " . | ||
"WHERE `messages`.`type` = 'twitter'"; | ||
$this->execute($sql); | ||
} | ||
} |
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
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.
couldn't find a way to get twitter urls... so I'm using this more obvious user facing URL instead of /statuses... which I suppose gives me more peace of mind... but still, would prefer if twitter actually gave us the url to use, you know?
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'd so much love that too!