feat(auth): guest Subscribe shows prompt + preserves intended URL

Clicking Subscribe as a guest used to redirect straight to /login with no
context. Now a short toast tells the visitor "Sign in to subscribe to
{channel}" and the redirect carries ?intended=<current path> so after
login they land back on the same video instead of the home page.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
ghassanandClaude Opus 4.7 committed 2026-10-21 12:31:55 +03:00
1 parent e550d8d15b
commit f7c3b236ab
1 file changed
+7 -2
@@ -158,8 +158,13 @@
</button> </button>
@endif @endif
@else @else
<button onclick="window.location.href='{{ route('login') }}'" class="action-btn desktop-action"> {{-- Guest Subscribe: showToast first so the user understands what's
<i class="bi bi-bell"></i><span>Subscribe</span> happening, then redirect to the login page with intended=
preserving the current URL so after login they land back on
this video. 600 ms gives the toast a moment to be seen. --}}
<button type="button" class="action-btn desktop-action"
onclick="(function(){ if (typeof showToast==='function') showToast('Sign in to subscribe to {{ addslashes($video->user->name ?? 'this channel') }}', 'info'); setTimeout(function(){ window.location.href='{{ route('login') }}?intended=' + encodeURIComponent(window.location.pathname + window.location.search); }, 600); })();">
<i class="bi bi-bell" aria-hidden="true"></i><span>Subscribe</span>
</button> </button>
@endauth @endauth