Skip to content

Commit

Permalink
Revert "fix(Twitter): urls are now formatted with the std https://twi…
Browse files Browse the repository at this point in the history
  • Loading branch information
AmTryingMyBest committed Apr 22, 2020
1 parent 3a040bd commit 6cffd7e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 62 deletions.
48 changes: 0 additions & 48 deletions migrations/20200409232153_rewrite_twitter_urls.php

This file was deleted.

13 changes: 2 additions & 11 deletions src/App/DataSource/Twitter/Twitter.php
Expand Up @@ -187,22 +187,13 @@ public function fetch($limit = false)
) {
continue;
}
$user_id = $user['id_str'];
// @todo Check for similar messages in the database before saving
$messages[] = [
'type' => MessageType::TWITTER,
'contact_type' => Contact::TWITTER,
'from' => $user_id,
'from' => $user['id_str'],
'to' => null,
/**
* Best compromise I could find was just make the proper urls with user_id rather than only
* tweet id (for which there is an unofficial formula)...
* since there doesn't seem to be a way to grab the URL from the
* API itself in the v1.1 search endpoint.
* Fun fact: if the user id is wrong, twitter
* still takes you to the correct Tweet... they just use the tweet id
**/
'message' => "https://twitter.com/$user_id/status/$id",
'message' => 'https://twitter.com/statuses/' . $id,
'title' => 'From twitter on ' . $date,
'datetime' => $date,
'data_source_message_id' => $id,
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/App/DataSource/TwitterDataSourceTest.php
Expand Up @@ -271,7 +271,7 @@ function ($a, $b, $c, $d) use ($mockTwitterOAuth) {
'type' => 'twitter',
'contact_type' => 'twitter',
'from' => '1112222223', // twitter user id
'message' => 'https://twitter.com/1112222223/status/abc123',
'message' => 'https://twitter.com/statuses/abc123',
'to' => null,
'title' => 'From twitter on Thu Apr 06 15:24:15 +0000 2017',
'data_source_message_id' => 'abc123',
Expand All @@ -282,7 +282,7 @@ function ($a, $b, $c, $d) use ($mockTwitterOAuth) {
'type' => 'twitter',
'contact_type' => 'twitter',
'from' => '1112222225', // twitter user id
'message' => 'https://twitter.com/1112222225/status/abc125',
'message' => 'https://twitter.com/statuses/abc125',
'to' => null,
'title' => 'From twitter on Thu Apr 06 15:24:15 +0000 2017',
'data_source_message_id' => 'abc125',
Expand All @@ -293,7 +293,7 @@ function ($a, $b, $c, $d) use ($mockTwitterOAuth) {
'type' => 'twitter',
'contact_type' => 'twitter',
'from' => '12344494949', //twitter user id
'message' => 'https://twitter.com/12344494949/status/abc126',
'message' => 'https://twitter.com/statuses/abc126',
'to' => null,
'title' => 'From twitter on Thu Apr 06 15:24:15 +0000 2017',
'data_source_message_id' => 'abc126',
Expand Down

0 comments on commit 6cffd7e

Please sign in to comment.