Skip to content

Commit

Permalink
REFACTOR - Twitter to X (Twitter) and twitter.com to x.com (#1170)
Browse files Browse the repository at this point in the history
* REFACTOR - Twitter to X (Twitter) and twitter.com to x.com

* FIX - Tests

* wip

* wip

---------

Co-authored-by: Dries Vints <[email protected]>
  • Loading branch information
tauseefsshah and driesvints authored Nov 22, 2024
1 parent 918d09f commit cd89b93
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 114 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ New threads will be automatically added to the index and threads which get updat
php artisan scout:flush App\\Models\\Thread
```

### Twitter Sharing (optional)
### X (Twitter) Sharing (optional)

To enable published articles to be automatically shared on Twitter, you'll need to [create a Twitter app](https://developer.twitter.com/apps/). Once the app has been created, update the below variables in your `.env` file. The consumer key and secret and access token and secret can be found in the `Keys and tokens` section of the Twitter developers UI.
To enable published articles to be automatically shared on X, you'll need to [create an app](https://developer.x.com/apps/). Once the app has been created, update the below variables in your `.env` file. The consumer key and secret and access token and secret can be found in the `Keys and tokens` section of the X developers UI.

```
TWITTER_CONSUMER_KEY=
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/PostArticleToTwitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class PostArticleToTwitter extends Command
{
protected $signature = 'lio:post-article-to-twitter';

protected $description = 'Posts the latest unshared article to Twitter';
protected $description = 'Posts the latest unshared article to X';

public function handle(AnonymousNotifiable $notifiable): void
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"algolia/scout-extended": "^3.1",
"blade-ui-kit/blade-heroicons": "^2.3",
"blade-ui-kit/blade-icons": "^1.6",
"blade-ui-kit/blade-ui-kit": "^0.6",
"blade-ui-kit/blade-ui-kit": "^0.6.3",
"blade-ui-kit/blade-zondicons": "^1.5",
"codeat3/blade-simple-icons": "^5.0",
"guzzlehttp/guzzle": "^7.2",
Expand Down
156 changes: 78 additions & 78 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/views/articles/overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<h2 class="text-2xl font-extrabold tracking-tight text-gray-900 md:text-3xl">
<span class="block">Got some knowledge to share?</span>
<span class="block">
Share your article with <a href="https://twitter.com/laravelio" class="text-lio-500 hover:text-lio-600 hover:underline">our 50,000+ Twitter followers</a>.
Share your article with <a href="https://x.com/laravelio" class="text-lio-500 hover:text-lio-600 hover:underline">our 50,000+ X (Twitter) followers</a>.
</span>
</h2>
<div class="mt-8 flex lg:mt-0 lg:shrink-0">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/articles/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class="prose prose-lg text-gray-800 prose-lio"
@endif

@if ($article->author()->hasTwitterAccount())
<a href="https://twitter.com/{{ $article->author()->twitter() }}" class="text-twitter">
<a href="https://x.com/{{ $article->author()->twitter() }}" class="text-twitter">
<x-si-x class="w-6 h-6" />
</a>
@endif
Expand Down
4 changes: 2 additions & 2 deletions resources/views/auth/passwords/reset.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
</div>

<div>
<x-forms.label for="password" />
<x-forms.label for="password">New Password</x-forms.label>

<x-forms.inputs.password name="password" id="password" required />
</div>

<div>
<x-forms.label for="password_confirmation" />
<x-forms.label for="password_confirmation">Confirm New Password</x-forms.label>

<x-forms.inputs.password name="password_confirmation" id="password_confirmation" required />
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/articles/engage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="uppercase text-gray-500">Share</span>

<a class="text-gray-300 hover:text-twitter" target="_blank" rel="noopener" aria-label="Share on Twitter"
href="http://twitter.com/share?text={{ urlencode('"'.$article->title().'" by '. ($article->author()->twitter() ? '@'.$article->author()->twitter() : $article->author()->name()) . ' - ') }}&url={{ urlencode(route('articles.show', $article->slug())) }}">
href="http://x.com/share?text={{ urlencode('"'.$article->title().'" by '. ($article->author()->twitter() ? '@'.$article->author()->twitter() : $article->author()->name()) . ' - ') }}&url={{ urlencode(route('articles.show', $article->slug())) }}">
<x-si-x class="w-6 h-6" />
</a>

Expand Down
13 changes: 6 additions & 7 deletions resources/views/components/articles/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</x-info>

<x-info class="mt-4">
Every article that gets approved will be shared with our 50.000 users and wil be tweeted out on our <a href="https://twitter.com/laravelio" class="text-lio-700 underline">Twitter account</a> which has over 50,000 followers. Feel free to submit as many articles as you like. You can even cross-reference an article on your blog with the original url.
Every article that gets approved will be shared with our 50.000 users and wil be tweeted out on our <a href="https://x.com/laravelio" class="text-lio-700 underline">X (Twitter) account</a> which has over 50,000 followers. Feel free to submit as many articles as you like. You can even cross-reference an article on your blog with the original url.
</x-info>

<x-info class="mt-4">
Expand All @@ -38,7 +38,7 @@
<div class="flex flex-col space-y-6">
<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="title">Title</x-forms.label>
<x-forms.label for="title" />

<x-forms.inputs.input name="title" :value="old('title', $article?->title())" required maxlength="100" />

Expand All @@ -50,7 +50,7 @@

<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="body">Body</x-forms.label>
<x-forms.label for="body" />

<livewire:editor :body="$article?->body()"/>

Expand All @@ -73,7 +73,7 @@

<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="tags">Tags</x-forms.label>
<x-forms.label for="tags" />

<select name="tags[]" id="create-article" multiple x-data="{}" x-init="$nextTick(function () { choices($el) })">
@foreach ($tags as $tag)
Expand Down Expand Up @@ -148,9 +148,8 @@ class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:t

@unless (Auth::user()->twitter())
<span class="text-gray-600 text-sm mt-4 block">
Articles will be shared on Twitter.
<a href="{{ route('settings.profile') }}" class="text-green-darker">Add your Twitter handle</a>
and we'll include that too.
Articles will be shared on X (Twitter).
<a href="{{ route('settings.profile') }}" class="text-green-darker">Add your X (Twitter) handle</a> and we'll include that too.
</span>
@endunless
</div>
Expand Down
10 changes: 5 additions & 5 deletions resources/views/components/threads/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div class="flex flex-col space-y-6">
<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="subject"/>
<x-forms.label for="subject" />

<x-forms.inputs.input name="subject" :value="$thread?->subject()" required maxlength="60" />

Expand All @@ -44,9 +44,7 @@

<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="tags">
Tags
</x-forms.label>
<x-forms.label for="tags" />

<select name="tags[]" id="create-thread" multiple x-data="{}" x-init="$nextTick(function () { choices($el) })">
@foreach($tags as $tag)
Expand All @@ -58,7 +56,9 @@

<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="body">Compose your question</x-forms.label>
<x-forms.label for="body">
Compose your question
</x-forms.label>

<livewire:editor
:body="$thread?->body()"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/users/profile-block.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@endif

@if ($user->hasTwitterAccount())
<a href="https://twitter.com/{{ $user->twitter() }}" class="text-twitter">
<a href="https://x.com/{{ $user->twitter() }}" class="text-twitter">
<x-si-x class="w-6 h-6" />
</a>
@endif
Expand Down
4 changes: 2 additions & 2 deletions resources/views/layouts/_footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
</p>

<div class="flex flex-wrap lg:flex-col lg:flex-no-wrap">
<a href="https://twitter.com/laravelio" class="w-1/2 text-gray-400 mb-4 hover:text-gray-200 lg:mb-6 whitespace-nowrap">
<a href="https://x.com/laravelio" class="w-1/2 text-gray-400 mb-4 hover:text-gray-200 lg:mb-6 whitespace-nowrap">
<x-si-x class="text-white w-4 h-4 inline mr-2"/>
Twitter
(Twitter)
</a>

<a href="https://github.com/laravelio" class="w-1/2 text-gray-400 mb-4 hover:text-gray-200 lg:mb-6 whitespace-nowrap">
Expand Down
4 changes: 2 additions & 2 deletions resources/views/layouts/_nav.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<x-icon-github class="w-6 h-6 inline"/>
</a>

<a href="https://twitter.com/laravelio" class="inline-block">
<a href="https://x.com/laravelio" class="inline-block">
<x-si-x class="w-6 h-6 inline text-twitter"/>
</a>

Expand Down Expand Up @@ -145,7 +145,7 @@
<x-icon-github class="w-5 h-5 inline"/>
</a>

<a href="https://twitter.com/laravelio" class="hidden lg:inline-block">
<a href="https://x.com/laravelio" class="hidden lg:inline-block">
<x-si-x class="w-5 h-5 inline text-twitter"/>
</a>

Expand Down
2 changes: 1 addition & 1 deletion resources/views/users/articles.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="container mx-auto px-4 py-8">
@unless(Auth::user()->hasTwitterAccount())
<x-primary-info-panel icon="heroicon-s-information-circle">
Set your <a href="{{ route('settings.profile') }}" class="underline">Twitter handle</a> so we can link to your profile when we tweet out your article.
Set your <a href="{{ route('settings.profile') }}" class="underline">X (Twitter) handle</a> so we can link to your profile when we tweet out your article.
</x-primary-info-panel>
@endunless

Expand Down
2 changes: 1 addition & 1 deletion resources/views/users/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class="w-full bg-center bg-gray-800 h-60 container mx-auto"
@endif

@if ($user->hasTwitterAccount())
<a href="https://twitter.com/{{ $user->twitter() }}" class="text-twitter">
<a href="https://x.com/{{ $user->twitter() }}" class="text-twitter">
<x-si-x class="w-6 h-6" />
</a>
@endif
Expand Down
2 changes: 1 addition & 1 deletion resources/views/users/settings/api_tokens.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<div>
<div class="col-span-12">
<x-forms.label for="token_name">Token name</x-forms.label>
<x-forms.label for="token_name" />

<x-forms.inputs.input name="token_name" form="api_token_settings_form" required />
</div>
Expand Down
10 changes: 5 additions & 5 deletions resources/views/users/settings/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<div class="flex flex-col space-y-6 lg:flex-row lg:space-y-0 lg:space-x-6">
<div class="grow space-y-6">
<div class="space-y-1">
<x-forms.label for="name"/>
<x-forms.label for="name" />

<x-forms.inputs.input name="name" :value="Auth::user()->name()" required />
</div>

<div class="space-y-1">
<x-forms.label for="bio"/>
<x-forms.label for="bio" />

<x-forms.inputs.textarea name="bio" maxlength="160">
{{ Auth::user()->bio() }}
Expand Down Expand Up @@ -79,18 +79,18 @@
</div>

<div class="col-span-12 sm:col-span-6">
<x-forms.label for="website">Website</x-forms.label>
<x-forms.label for="website" />

<x-forms.inputs.input name="website" :value="Auth::user()->website()" prefix-icon="heroicon-o-globe-alt" />
</div>

<div class="col-span-12 sm:col-span-6">
<x-forms.label for="twitter">Twitter handle</x-forms.label>
<x-forms.label for="twitter">X (Twitter) handle</x-forms.label>

<x-forms.inputs.input name="twitter" :value="Auth::user()->twitter()" prefix-icon="heroicon-o-at-symbol" class="nav-search" />

<span class="mt-2 text-sm text-gray-500">
Enter your Twitter handle without the leading @ symbol
Enter your X (Twitter) handle without the leading @ symbol
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,15 @@
$this->login(['twitter' => null]);

$this->get('/articles/authored')
->assertSeeText('Twitter handle', '<a>')
->assertSeeText('X (Twitter) handle', '<a>')
->assertSee('so we can link to your profile when we tweet out your article.');
});

test('user do not see tip if they have set the twitter handle', function () {
$this->login();

$this->get('/articles/authored')
->assertDontSeeText('Twitter handle', '<a>')
->assertDontSeeText('X (Twitter) handle', '<a>')
->assertDontSee('so we can link to your profile when we tweet out your article.');
});

Expand Down

0 comments on commit cd89b93

Please sign in to comment.