Commit 6e537e26 authored by Eugen Rochko's avatar Eugen Rochko

Add warning when not logged in to Mastodon

parent a7726a58
......@@ -311,6 +311,10 @@ h4 {
margin-bottom: 30px;
border-radius: 10px;
&.bottomless {
border-radius: 10px 10px 0 0;
}
h3 {
font-family: 'Montserrat', sans-serif;
font-size: 26px;
......@@ -569,3 +573,18 @@ h4 {
text-decoration: none;
}
}
.connect-prompt {
background: $vibrant;
margin-top: -30px;
margin-bottom: 30px;
color: $white;
padding: 10px;
border-radius: 0 0 5px 5px;
text-align: center;
a {
color: $white;
font-weight: 500;
}
}
......@@ -85,6 +85,8 @@ class FriendsController < ApplicationController
def fetch_account_id(user)
user.tap do |user|
next if current_user.mastodon.nil?
begin
user.relative_account_id = Rails.cache.fetch("#{current_user.id}/#{current_user.mastodon.domain}/#{user.mastodon.uid}", expires_in: 1.week) do
account, _ = current_user.mastodon_client.perform_request(:get, '/api/v1/accounts/search', q: user.mastodon.uid, resolve: 'true', limit: 1)
......@@ -92,7 +94,7 @@ class FriendsController < ApplicationController
account['id']
end
rescue Mastodon::Error, HTTP::Error, OpenSSL::SSL::SSLError
user.relative_account_id = nil
next
end
end
end
......
.page-heading
.page-heading{ class: current_user.mastodon.nil? ? 'bottomless' : '' }
%h3
Your friends
%small Here are your Twitter friends who are on Mastodon:
- if current_user.mastodon.nil?
.connect-prompt
For your friends to find you as well, you still need to
= link_to 'login via Mastodon', user_mastodon_omniauth_authorize_path
- if @friends.empty?
%p.empty-message Well, this is unfortunate. Looks like none of your Twitter friends are on Mastodon yet. Or maybe they are, but haven't signed in to this bridge service.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment