diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index 1084de75..799fb21e 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -195,7 +195,7 @@ def user_profile(actor): if is_activitypub_request(): server = current_app.config['SERVER_NAME'] actor_data = { "@context": default_context(), - "type": "Person", + "type": "Person" if not user.bot else "Service", "id": f"https://{server}/u/{actor}", "preferredUsername": actor, "name": user.title if user.title else user.user_name, diff --git a/app/activitypub/util.py b/app/activitypub/util.py index a094b19f..a59c5f19 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -488,7 +488,7 @@ def refresh_community_profile_task(community_id): def actor_json_to_model(activity_json, address, server): - if activity_json['type'] == 'Person': + if activity_json['type'] == 'Person' or activity_json['type'] == 'Service': try: user = User(user_name=activity_json['preferredUsername'], title=activity_json['name'] if 'name' in activity_json else None, @@ -508,6 +508,7 @@ def actor_json_to_model(activity_json, address, server): ap_fetched_at=utcnow(), ap_domain=server, public_key=activity_json['publicKey']['publicKeyPem'], + bot=True if activity_json['type'] == 'Service' else False, instance_id=find_instance_id(server) # language=community_json['language'][0]['identifier'] # todo: language ) diff --git a/app/static/scss/_typography.scss b/app/static/scss/_typography.scss index 780e81d2..002d6197 100644 --- a/app/static/scss/_typography.scss +++ b/app/static/scss/_typography.scss @@ -282,6 +282,14 @@ h1 { } } +.fe-bot-account { + position: relative; + top: 1px; + &:before { + content: "\e94d"; + } +} + .fe-video { position: relative; top: 2px; diff --git a/app/static/structure.css b/app/static/structure.css index 0500d613..47e25f42 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -305,6 +305,14 @@ h1 .fe-bell, h1 .fe-no-bell { content: "\e986"; } +.fe-bot-account { + position: relative; + top: 1px; +} +.fe-bot-account:before { + content: "\e94d"; +} + .fe-video { position: relative; top: 2px; diff --git a/app/static/styles.css b/app/static/styles.css index 149e1db0..d9d731ff 100644 --- a/app/static/styles.css +++ b/app/static/styles.css @@ -304,6 +304,14 @@ h1 .fe-bell, h1 .fe-no-bell { content: "\e986"; } +.fe-bot-account { + position: relative; + top: 1px; +} +.fe-bot-account:before { + content: "\e94d"; +} + .fe-video { position: relative; top: 2px; diff --git a/app/templates/base.html b/app/templates/base.html index 879c124f..f7b34d82 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -11,6 +11,9 @@ {% if user.created_recently() %} {% endif %} + {% if user.bot %} + + {% endif %} {% if user.reputation < -10 %} diff --git a/app/templates/post/continue_discussion.html b/app/templates/post/continue_discussion.html index dae25ab5..d0e19b7e 100644 --- a/app/templates/post/continue_discussion.html +++ b/app/templates/post/continue_discussion.html @@ -29,6 +29,9 @@ {% if comment['comment'].author.created_recently() %} {% endif %} + {% if comment['comment'].author.bot %} + + {% endif %} {% if comment['comment'].author.id != current_user.id %} {% if comment['comment'].author.reputation < -10 %} diff --git a/app/templates/post/post.html b/app/templates/post/post.html index 1ba56c72..3aed36a8 100644 --- a/app/templates/post/post.html +++ b/app/templates/post/post.html @@ -90,6 +90,9 @@ {% if comment['comment'].author.created_recently() %} {% endif %} + {% if comment['comment'].author.bot %} + + {% endif %} {% if comment['comment'].author.id != current_user.id %} {% if comment['comment'].author.reputation < -10 %} diff --git a/app/templates/user/show_profile.html b/app/templates/user/show_profile.html index fc880048..17cced75 100644 --- a/app/templates/user/show_profile.html +++ b/app/templates/user/show_profile.html @@ -57,6 +57,9 @@ {% endif %}
{{ _('Joined') }}: {{ moment(user.created).fromNow(refresh=True) }}
+ {% if user.bot %}
+ {{ _('Bot Account') }}
+ {% endif %}
{{ _('Attitude') }}: {{ (user.attitude * 100) | round | int }}%