diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 990d08ca7f..af0cb05bc3 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -18,6 +18,8 @@ class AccountsController < ApplicationController respond_to do |format| format.html do expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.hour) unless user_signed_in? + + redirect_to short_account_path(@account) if account_id_param.present? && username_param.blank? end format.rss do diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index 65db807d18..4bd9d45b7c 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -26,6 +26,8 @@ class StatusesController < ApplicationController respond_to do |format| format.html do expires_in 10.seconds, public: true if current_account.nil? + + redirect_to short_account_status_path(@account, @status) if account_id_param.present? && username_param.blank? end format.json do diff --git a/app/javascript/entrypoints/public.tsx b/app/javascript/entrypoints/public.tsx index dd1956446d..ff6819f8ac 100644 --- a/app/javascript/entrypoints/public.tsx +++ b/app/javascript/entrypoints/public.tsx @@ -183,15 +183,25 @@ function loaded() { ({ target }) => { if (!(target instanceof HTMLInputElement)) return; - if (target.value && target.value.length > 0) { + const checkedUsername = target.value; + if (checkedUsername && checkedUsername.length > 0) { axios - .get('/api/v1/accounts/lookup', { params: { acct: target.value } }) + .get('/api/v1/accounts/lookup', { + params: { acct: checkedUsername }, + }) .then(() => { - target.setCustomValidity(formatMessage(messages.usernameTaken)); + // Only update the validity if the result is for the currently-typed username + if (checkedUsername === target.value) { + target.setCustomValidity(formatMessage(messages.usernameTaken)); + } + return true; }) .catch(() => { - target.setCustomValidity(''); + // Only update the validity if the result is for the currently-typed username + if (checkedUsername === target.value) { + target.setCustomValidity(''); + } }); } else { target.setCustomValidity(''); diff --git a/app/javascript/flavours/glitch/components/follow_button.tsx b/app/javascript/flavours/glitch/components/follow_button.tsx index c06bfe4c77..ba7d0a0df3 100644 --- a/app/javascript/flavours/glitch/components/follow_button.tsx +++ b/app/javascript/flavours/glitch/components/follow_button.tsx @@ -129,6 +129,8 @@ export const FollowButton: React.FC<{ : messages.follow; let label; + let disabled = + relationship?.blocked_by || account?.suspended || !!account?.moved; if (!signedIn) { label = intl.formatMessage(followMessage); @@ -138,12 +140,16 @@ export const FollowButton: React.FC<{ label = ; } else if (relationship.muting) { label = intl.formatMessage(messages.unmute); + disabled = false; } else if (relationship.following) { label = intl.formatMessage(messages.unfollow); + disabled = false; } else if (relationship.blocking) { label = intl.formatMessage(messages.unblock); + disabled = false; } else if (relationship.requested) { label = intl.formatMessage(messages.followRequestCancel); + disabled = false; } else if (relationship.followed_by && !account?.locked) { label = intl.formatMessage(messages.followBack); } else { @@ -168,11 +174,7 @@ export const FollowButton: React.FC<{ return (