浏览代码

Update RemotePost, RemoteProfile components, add fallback avatars

Daniel Supernault 3 年之前
父节点
当前提交
754151dc84
共有 2 个文件被更改,包括 8 次插入8 次删除
  1. 7 7
      resources/assets/js/components/RemotePost.vue
  2. 1 1
      resources/assets/js/components/RemoteProfile.vue

+ 7 - 7
resources/assets/js/components/RemotePost.vue

@@ -35,7 +35,7 @@
 				<div class="d-flex d-md-none align-items-center justify-content-between card-header bg-white w-100">
 					<div class="d-flex">
 						<div class="status-avatar mr-2" @click="redirect(profileUrl)">
-							<img :src="statusAvatar" width="24px" height="24px" style="border-radius:12px;" class="cursor-pointer">
+							<img :src="statusAvatar" width="24px" height="24px" style="border-radius:12px;" class="cursor-pointer" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 						</div>
 						<div class="username">
 							<span class="username-link font-weight-bold text-dark cursor-pointer" @click="redirect(profileUrl)">{{ statusUsername }}</span>
@@ -94,7 +94,7 @@
 						<div class="d-md-flex d-none align-items-center justify-content-between card-header py-3 bg-white">
 							<div class="d-flex align-items-center status-username text-truncate">
 								<div class="status-avatar mr-2" @click="redirect(profileUrl)">
-									<img :src="statusAvatar" width="24px" height="24px" style="border-radius:12px;" class="cursor-pointer">
+									<img :src="statusAvatar" width="24px" height="24px" style="border-radius:12px;" class="cursor-pointer" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 								</div>
 								<div class="username">
 									<span class="username-link font-weight-bold text-dark cursor-pointer" @click="redirect(profileUrl)">{{ statusUsername }}</span>
@@ -157,7 +157,7 @@
 											</p>
 											<div class="comments mt-3">
 												<div v-for="(reply, index) in results" class="pb-4 media" :key="'tl' + reply.id + '_' + index">
-													<img :src="reply.account.avatar" class="rounded-circle border mr-3" width="42px" height="42px">
+													<img :src="reply.account.avatar" class="rounded-circle border mr-3" width="42px" height="42px" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 													<div class="media-body">
 														<div v-if="reply.sensitive == true">
 															<span class="py-3">
@@ -190,7 +190,7 @@
 															</div>
 															<div v-if="reply.thread == true" class="comment-thread">
 																<div v-for="(s, sindex) in reply.replies" class="pb-3 media" :key="'cr' + s.id + '_' + index">
-																	<img :src="s.account.avatar" class="rounded-circle border mr-3" width="25px" height="25px">
+																	<img :src="s.account.avatar" class="rounded-circle border mr-3" width="25px" height="25px" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 																	<div class="media-body">
 																		<p class="d-flex justify-content-between align-items-top read-more" style="overflow-y: hidden;">
 																			<span>
@@ -315,7 +315,7 @@
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in likes" :key="'modal_likes_'+index">
 				<div class="media">
 					<a :href="user.url">
-						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px">
+						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 					</a>
 					<div class="media-body">
 						<p class="mb-0" style="font-size: 14px">
@@ -348,7 +348,7 @@
 			<div class="list-group-item border-0 py-1" v-for="(user, index) in shares" :key="'modal_shares_'+index">
 				<div class="media">
 					<a :href="user.url">
-						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px">
+						<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 					</a>
 					<div class="media-body">
 						<div class="d-inline-block">
@@ -382,7 +382,7 @@
 			<div class="list-group-item border-0 py-1" v-for="(taguser, index) in status.taggedPeople" :key="'modal_taggedpeople_'+index">
 				<div class="media">
 					<a :href="'/'+taguser.username">
-						<img class="mr-3 rounded-circle box-shadow" :src="taguser.avatar" :alt="taguser.username + '’s avatar'" width="30px">
+						<img class="mr-3 rounded-circle box-shadow" :src="taguser.avatar" :alt="taguser.username + '’s avatar'" width="30px" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 					</a>
 					<div class="media-body">
 						<p class="pt-1 d-flex justify-content-between" style="font-size: 14px">

+ 1 - 1
resources/assets/js/components/RemoteProfile.vue

@@ -19,7 +19,7 @@
 					</div>
 					<div class="card-body pb-0">
 						<div class="mt-n5 mb-3">
-							<img class="rounded-circle p-1 border mt-n4 bg-white shadow" :src="profile.avatar" width="90px" height="90px;">
+							<img class="rounded-circle p-1 border mt-n4 bg-white shadow" :src="profile.avatar" width="90px" height="90px;" onerror="this.onerror=null;this.src='/storage/avatars/default.jpg?v=0';">
 							<span class="float-right mt-n1">
 								<span>
 									<button v-if="relationship && relationship.following == false" class="btn btn-outline-light py-0 px-3 mt-n1" style="font-size:13px; font-weight: 500;" @click="followProfile();">Follow</button>