Browse Source

Update Profile component, fix remote urls

Daniel Supernault 4 years ago
parent
commit
6e56dbed1a
1 changed files with 12 additions and 5 deletions
  1. 12 5
      resources/assets/js/components/Profile.vue

+ 12 - 5
resources/assets/js/components/Profile.vue

@@ -423,12 +423,12 @@
 			</div>
 			</div>
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in following" :key="'following_'+index">
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in following" :key="'following_'+index">
 				<div class="media">
 				<div class="media">
-					<a :href="user.url">
+					<a :href="profileUrlRedirect(user)">
 						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px" loading="lazy">
 						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px" loading="lazy">
 					</a>
 					</a>
 					<div class="media-body text-truncate">
 					<div class="media-body text-truncate">
 						<p class="mb-0" style="font-size: 14px">
 						<p class="mb-0" style="font-size: 14px">
-							<a :href="user.url" class="font-weight-bold text-dark">
+							<a :href="profileUrlRedirect(user)" class="font-weight-bold text-dark">
 								{{user.username}}
 								{{user.username}}
 							</a>
 							</a>
 						</p>
 						</p>
@@ -470,12 +470,12 @@
 			</div>
 			</div>
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in followers" :key="'follower_'+index">
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in followers" :key="'follower_'+index">
 				<div class="media mb-0">
 				<div class="media mb-0">
-					<a :href="user.url">
+					<a :href="profileUrlRedirect(user)">
 						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px" height="30px" loading="lazy">
 						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px" height="30px" loading="lazy">
 					</a>
 					</a>
 					<div class="media-body mb-0">
 					<div class="media-body mb-0">
 						<p class="mb-0" style="font-size: 14px">
 						<p class="mb-0" style="font-size: 14px">
-							<a :href="user.url" class="font-weight-bold text-dark">
+							<a :href="profileUrlRedirect(user)" class="font-weight-bold text-dark">
 								{{user.username}}
 								{{user.username}}
 							</a>
 							</a>
 						</p>
 						</p>
@@ -1179,7 +1179,6 @@
 				});
 				});
 			},
 			},
 
 
-
 			followersLoadMore() {
 			followersLoadMore() {
 				if($('body').hasClass('loggedIn') == false) {
 				if($('body').hasClass('loggedIn') == false) {
 					return;
 					return;
@@ -1279,6 +1278,14 @@
 				return '/i/web/profile/_/' + status.account.id;
 				return '/i/web/profile/_/' + status.account.id;
 			},
 			},
 
 
+			profileUrlRedirect(profile) {
+				if(profile.local == true) {
+					return profile.url;
+				}
+
+				return '/i/web/profile/_/' + profile.id;
+			},
+
 			showEmbedProfileModal() {
 			showEmbedProfileModal() {
 				this.ctxEmbedPayload = window.App.util.embed.profile(this.profile.url);
 				this.ctxEmbedPayload = window.App.util.embed.profile(this.profile.url);
 				this.$refs.visitorContextMenu.hide();
 				this.$refs.visitorContextMenu.hide();