Skip to content

Commit aafd6a2

Browse files
committed
Update Notification component, add at (@) symbol for remote profiles and local urls for remote posts and profiles
1 parent c27da49 commit aafd6a2

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

resources/assets/js/components/NotificationCard.vue

+26-10
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,51 @@
2020
<div class="media-body font-weight-light small">
2121
<div v-if="n.type == 'favourite'">
2222
<p class="my-0">
23-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> liked your
23+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> liked your
2424
<span v-if="n.status.hasOwnProperty('media_attachments')">
25-
<a class="font-weight-bold" v-bind:href="n.status.url" :id="'fvn-' + n.id">post</a>.
25+
<a class="font-weight-bold" v-bind:href="getPostUrl(n.status)" :id="'fvn-' + n.id">post</a>.
2626
<b-popover :target="'fvn-' + n.id" title="" triggers="hover" placement="top" boundary="window">
2727
<img :src="notificationPreview(n)" width="100px" height="100px" style="object-fit: cover;">
2828
</b-popover>
2929
</span>
3030
<span v-else>
31-
<a class="font-weight-bold" v-bind:href="n.status.url">post</a>.
31+
<a class="font-weight-bold" v-bind:href="getPostUrl(n.status)">post</a>.
3232
</span>
3333
</p>
3434
</div>
3535
<div v-else-if="n.type == 'comment'">
3636
<p class="my-0">
37-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> commented on your <a class="font-weight-bold" v-bind:href="n.status.url">post</a>.
37+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> commented on your <a class="font-weight-bold" v-bind:href="getPostUrl(n.status)">post</a>.
3838
</p>
3939
</div>
4040
<div v-else-if="n.type == 'mention'">
4141
<p class="my-0">
42-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> <a class="font-weight-bold" v-bind:href="mentionUrl(n.status)">mentioned</a> you.
42+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> <a class="font-weight-bold" v-bind:href="mentionUrl(n.status)">mentioned</a> you.
4343
</p>
4444
</div>
4545
<div v-else-if="n.type == 'follow'">
4646
<p class="my-0">
47-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> followed you.
47+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> followed you.
4848
</p>
4949
</div>
5050
<div v-else-if="n.type == 'share'">
5151
<p class="my-0">
52-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> shared your <a class="font-weight-bold" v-bind:href="n.status.url">post</a>.
52+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> shared your <a class="font-weight-bold" v-bind:href="getPostUrl(n.status)">post</a>.
5353
</p>
5454
</div>
5555
<div v-else-if="n.type == 'modlog'">
5656
<p class="my-0">
57-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> updated a <a class="font-weight-bold" v-bind:href="n.modlog.url">modlog</a>.
57+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> updated a <a class="font-weight-bold" v-bind:href="n.modlog.url">modlog</a>.
5858
</p>
5959
</div>
6060
<div v-else-if="n.type == 'tagged'">
6161
<p class="my-0">
62-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> tagged you in a <a class="font-weight-bold" v-bind:href="n.tagged.post_url">post</a>.
62+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> tagged you in a <a class="font-weight-bold" v-bind:href="n.tagged.post_url">post</a>.
6363
</p>
6464
</div>
6565
<div v-else-if="n.type == 'direct'">
6666
<p class="my-0">
67-
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> sent a <a class="font-weight-bold" v-bind:href="'/account/direct/t/'+n.account.id">dm</a>.
67+
<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.username">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> sent a <a class="font-weight-bold" v-bind:href="'/account/direct/t/'+n.account.id">dm</a>.
6868
</p>
6969
</div>
7070
<div v-else>
@@ -256,6 +256,22 @@
256256
return '/storage/no-preview.png';
257257
}
258258
return n.status.media_attachments[0].preview_url;
259+
},
260+
261+
getProfileUrl(account) {
262+
if(account.local == true) {
263+
return account.url;
264+
}
265+
266+
return '/i/web/profile/_/' + account.id;
267+
},
268+
269+
getPostUrl(status) {
270+
if(status.local == true) {
271+
return status.url;
272+
}
273+
274+
return '/i/web/post/_/' + status.account.id + '/' + status.id;
259275
}
260276
}
261277
}

0 commit comments

Comments
 (0)