More quick fixes
This commit is contained in:
parent
eefdd093b2
commit
cb44d35869
3 changed files with 8 additions and 3 deletions
|
|
@ -37,7 +37,9 @@ class User(BaseModel):
|
||||||
mastodon_post_public = BooleanField(null=True, default=False)
|
mastodon_post_public = BooleanField(null=True, default=False)
|
||||||
|
|
||||||
def mastodon_account(self):
|
def mastodon_account(self):
|
||||||
if self.mastodon_server.name == MASTODON_INSTANCE:
|
if self.mastodon_server is None or self.mastodon_username is None:
|
||||||
|
return
|
||||||
|
elif self.mastodon_server.name == MASTODON_INSTANCE:
|
||||||
return self.mastodon_username
|
return self.mastodon_username
|
||||||
else:
|
else:
|
||||||
return f"{self.mastodon_username}@{self.mastodon_server}"
|
return f"{self.mastodon_username}@{self.mastodon_server}"
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ def mastodon_oauth():
|
||||||
|
|
||||||
user_mastodon_user_set(current_user.db_user.id, username, access_token)
|
user_mastodon_user_set(current_user.db_user.id, username, access_token)
|
||||||
|
|
||||||
return redirect('/profile')
|
return redirect('/profile/')
|
||||||
|
|
||||||
@app.route('/login')
|
@app.route('/login')
|
||||||
def login():
|
def login():
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,10 @@ export const Profile: React.FC = () => {
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
|
||||||
const mastodon_account = React.useMemo(
|
const mastodon_account = React.useMemo(
|
||||||
() => `@${mastodon_username}@${mastodon_server}`,
|
() =>
|
||||||
|
mastodon_username && mastodon_server
|
||||||
|
? `@${mastodon_username}@${mastodon_server}`
|
||||||
|
: null,
|
||||||
[mastodon_server, mastodon_username],
|
[mastodon_server, mastodon_username],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue