diff --git a/books/views.py b/books/views.py index e71c0736..90cc5f6c 100644 --- a/books/views.py +++ b/books/views.py @@ -227,7 +227,7 @@ def create_update_mark(request): words = BookMarkStatusTranslator(int(form.cleaned_data['status'])) +\ f"《{book.title}》" + rating_to_emoji(form.cleaned_data['rating']) content = words + '\n' + url + '\n' + form.cleaned_data['text'] - post_toot(content, visibility, request.session['oauth_token']) + post_toot(content, visibility, request.session['oauth_token'], local_only=True) else: return HttpResponseBadRequest() diff --git a/common/mastodon/api.py b/common/mastodon/api.py index db9196b0..73da37e2 100644 --- a/common/mastodon/api.py +++ b/common/mastodon/api.py @@ -66,7 +66,7 @@ def check_visibility(user_owned_entity, token, visitor): return True -def post_toot(content, visibility, token): +def post_toot(content, visibility, token, local_only=False): url = 'https://' + MASTODON_DOMAIN_NAME + API_PUBLISH_TOOT headers = { 'Authorization': f'Bearer {token}', @@ -74,7 +74,8 @@ def post_toot(content, visibility, token): } payload = { 'status': content, - 'visibility': visibility + 'visibility': visibility, + 'local_only': local_only, } response = post(url, headers=headers, data=payload) return response