aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--locale/en_GB.json1
-rw-r--r--routes/actor_profile.php2
-rw-r--r--routes/actor_profile_fragment.php6
-rw-r--r--static/icons.css3
-rw-r--r--templates/actor/profile.php10
5 files changed, 20 insertions, 2 deletions
diff --git a/locale/en_GB.json b/locale/en_GB.json
index aecb6cd..0f36b5b 100644
--- a/locale/en_GB.json
+++ b/locale/en_GB.json
@@ -5,6 +5,7 @@
"action.share": "Share",
"user.profile.createdAt": "Joined %s",
"user.profile.openRemote": "Open remote profile page",
+ "user.profile.forceRefetch": "Reload from remote instance",
"user.profile.bio.placeholder": "This user hasn't written a bio yet.",
"user.profile.follow.action": "Follow",
"user.profile.follow.pending": "Request pending",
diff --git a/routes/actor_profile.php b/routes/actor_profile.php
index 2f297b9..4a197ee 100644
--- a/routes/actor_profile.php
+++ b/routes/actor_profile.php
@@ -7,7 +7,7 @@ use Digitigrade\Router;
Router::getInstance()->mount('/@/:handle', function (array $args) {
if (str_contains($args['handle'], '@')) {
// remote actor
- $actor = Actor::findByWebfinger($args['handle']);
+ $actor = Actor::findByWebfinger($args['handle'], forceRefetch: isset($_GET['forceRefetch']));
} else {
// local actor
$actor = Actor::findLocalByHandle($args['handle']);
diff --git a/routes/actor_profile_fragment.php b/routes/actor_profile_fragment.php
index debead0..b93556a 100644
--- a/routes/actor_profile_fragment.php
+++ b/routes/actor_profile_fragment.php
@@ -11,7 +11,11 @@ use Digitigrade\Router;
use Digitigrade\StorageProvider\FilesystemStorage;
Router::getInstance()->mount('/fragment/actor/:id', function (array $args) {
- render_template('actor/profile', ['actor' => Actor::find($args['id'])]);
+ $actor = Actor::find($args['id']);
+ if (isset($_GET['forceRefetch'])) {
+ $actor = Actor::findByUri($actor->uri, forceRefetch: true);
+ }
+ render_template('actor/profile', ['actor' => $actor]);
});
Router::getInstance()->mount('/fragment/actor/:id/followButton', function (array $args) {
diff --git a/static/icons.css b/static/icons.css
index b30e66c..3cd60be 100644
--- a/static/icons.css
+++ b/static/icons.css
@@ -132,4 +132,7 @@
&.select-all {
--svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M7 17V7h10v10zm2-2h6V9H9zm-4 4v2q-.825 0-1.412-.587T3 19zm-2-2v-2h2v2zm0-4v-2h2v2zm0-4V7h2v2zm2-4H3q0-.825.588-1.412T5 3zm2 16v-2h2v2zM7 5V3h2v2zm4 16v-2h2v2zm0-16V3h2v2zm4 16v-2h2v2zm0-16V3h2v2zm4 16v-2h2q0 .825-.587 1.413T19 21m0-4v-2h2v2zm0-4v-2h2v2zm0-4V7h2v2zm0-4V3q.825 0 1.413.588T21 5z'/%3E%3C/svg%3E");
}
+ &.sync {
+ --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M4 20v-2h2.75l-.4-.35q-1.225-1.225-1.787-2.662T4 12.05q0-2.775 1.663-4.937T10 4.25v2.1Q8.2 7 7.1 8.563T6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V14h2v6zm10-.25v-2.1q1.8-.65 2.9-2.212T18 11.95q0-1.125-.425-2.187T16.25 7.8L16 7.55V10h-2V4h6v2h-2.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.775-1.662 4.938T14 19.75'/%3E%3C/svg%3E");
+ }
}
diff --git a/templates/actor/profile.php b/templates/actor/profile.php
index 3165586..3e1a11e 100644
--- a/templates/actor/profile.php
+++ b/templates/actor/profile.php
@@ -53,6 +53,16 @@ $actorUser = UserAccount::findByLinkedActor($actor);
<?php if ($user != null && $user->actor != $actor): ?>
<li><?php call_template('actor/profile_block_button', ['user' => $user, 'actor' => $actor]) ?></li>
<?php endif; ?>
+ <?php if (!$actor->isLocal): ?>
+ <li>
+ <a href="<?= $actor->getLocalUiHref() . '?forceRefetch=1' ?>"
+ hx-get="/fragment/actor/<?= $actor->id ?>?forceRefetch=1" hx-target="closest .fullProfile"
+ hx-swap="outerHTML">
+ <span class="material-symbols sync"></span>
+ <span><?= __('user.profile.forceRefetch') ?></span>
+ </a>
+ </li>
+ <?php endif; ?>
<?php }); ?>
</div>