somewhat workign version still with fixture

This commit is contained in:
Shpuld Shpuldson 2021-01-06 18:31:34 +02:00
parent ab2c2c66bf
commit a4e3cccf1c
9 changed files with 177 additions and 99 deletions

View file

@ -76,6 +76,9 @@ const Notification = {
this.$store.dispatch('dismissNotificationLocal', { id: this.notification.id }) this.$store.dispatch('dismissNotificationLocal', { id: this.notification.id })
this.$store.dispatch('removeFollowRequest', this.user) this.$store.dispatch('removeFollowRequest', this.user)
}) })
},
testlog (a) {
console.log(a)
} }
}, },
computed: { computed: {

View file

@ -56,6 +56,34 @@
margin: 0 0.1em; margin: 0 0.1em;
} }
.report-content {
margin: 0.5em 0;
}
.reported-status {
border: 1px solid $fallback--faint;
border-color: var(--faint, $fallback--faint);
border-radius: $fallback--inputRadius;
border-radius: var(--inputRadius, $fallback--inputRadius);
color: $fallback--text;
color: var(--text, $fallback--text);
display: block;
padding: 0.5em;
margin: 0.5em 0;
.status-content {
pointer-events: none;
}
.reported-status-name {
font-weight: bold;
}
.reported-status-timeago {
float: right;
}
}
&.-type--repeat .type-icon { &.-type--repeat .type-icon {
color: $fallback--cGreen; color: $fallback--cGreen;
color: var(--cGreen, $fallback--cGreen); color: var(--cGreen, $fallback--cGreen);

View file

@ -106,6 +106,9 @@
</i18n> </i18n>
</small> </small>
</span> </span>
<span v-if="notification.type === 'pleroma:report'">
<small>{{ $t('notifications.submitted_report') }}</small>
</span>
</div> </div>
<div <div
v-if="isStatusNotification" v-if="isStatusNotification"
@ -180,6 +183,37 @@
@{{ notification.target.screen_name }} @{{ notification.target.screen_name }}
</router-link> </router-link>
</div> </div>
<div
v-else-if="notification.type === 'pleroma:report'"
>
<small>Reported user:</small>
<router-link :to="generateUserProfileLink(notification.report.acct)">
@{{ notification.report.acct.screen_name }}
</router-link>
<!-- eslint-disable vue/no-v-html -->
<div
class="report-content"
v-html="notification.report.content"
/>
<div v-if="notification.report.statuses.length">
<small>Reported statuses:</small>
<!-- eslint-enable vue/no-v-html -->
<router-link
v-for="status in notification.report.statuses"
:key="status.id"
:to="{ name: 'conversation', params: { id: status.id } }"
class="reported-status"
>
<span class="reported-status-name">{{ status.user.name }}</span>
<Timeago
:time="status.created_at"
:auto-update="240"
class="reported-status-timeago faint"
/>
<status-content :status="status" />
</router-link>
</div>
</div>
<template v-else> <template v-else>
<status-content <status-content
class="faint" class="faint"

View file

@ -66,6 +66,7 @@ const Notifications = {
return this.$store.state.statuses.notifications.loading return this.$store.state.statuses.notifications.loading
}, },
notificationsToDisplay () { notificationsToDisplay () {
console.log(this.notifications)
return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount) return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount)
}, },
...mapGetters(['unreadChatCount']) ...mapGetters(['unreadChatCount'])

View file

@ -60,8 +60,10 @@
height: 32px; height: 32px;
} }
--link: var(--faintLink); .faint {
--text: var(--faint); --link: var(--faintLink);
--text: var(--faint);
}
} }
.follow-request-accept { .follow-request-accept {

View file

@ -141,7 +141,8 @@
"repeated_you": "repeated your status", "repeated_you": "repeated your status",
"no_more_notifications": "No more notifications", "no_more_notifications": "No more notifications",
"migrated_to": "migrated to", "migrated_to": "migrated to",
"reacted_with": "reacted with {0}" "reacted_with": "reacted with {0}",
"submitted_report": "submitted a report"
}, },
"polls": { "polls": {
"add_poll": "Add Poll", "add_poll": "Add Poll",

View file

@ -44,8 +44,9 @@ export const defaultState = {
likes: true, likes: true,
repeats: true, repeats: true,
moves: true, moves: true,
emojiReactions: false, emojiReactions: true,
followRequest: true, followRequest: true,
reports: true,
chatMention: true chatMention: true
}, },
webPushNotifications: false, webPushNotifications: false,

View file

@ -488,8 +488,103 @@ const deleteUser = ({ credentials, user }) => {
headers: headers headers: headers
}) })
} }
/* eslint-disable */ /* eslint-disable */
const mockStatus = {
"account": {
"acct": "reported_account",
"avatar": "https://develop.ilja.space/images/avi.png",
"avatar_static": "https://develop.ilja.space/images/avi.png",
"bot": false,
"created_at": "2020-09-03T14:18:21.000Z",
"display_name": "Reported Account",
"emojis": [],
"fields": [],
"followers_count": 0,
"following_count": 0,
"header": "https://develop.ilja.space/images/banner.png",
"header_static": "https://develop.ilja.space/images/banner.png",
"id": "A2xvLMMFLmqUQiZSqG",
"locked": false,
"note": "I&#39;m an account made for an example report notification. I&#39;m the one that will be reported.",
"pleroma": {
"accepts_chat_messages": true,
"ap_id": "https://develop.ilja.space/users/reported_account",
"background_image": null,
"confirmation_pending": false,
"favicon": null,
"hide_favorites": true,
"hide_followers": false,
"hide_followers_count": false,
"hide_follows": false,
"hide_follows_count": false,
"is_admin": false,
"is_moderator": false,
"relationship": {},
"skip_thread_containment": false,
"tags": []
},
"source": {
"fields": [],
"note": "",
"pleroma": {
"actor_type": "Person",
"discoverable": false
},
"sensitive": false
},
"statuses_count": 1,
"url": "https://develop.ilja.space/users/reported_account",
"username": "reported_account"
},
"application": {
"name": "Web",
"website": null
},
"bookmarked": false,
"card": null,
"content": "A post I made that will be included in the report",
"created_at": "2020-09-03T14:18:51.000Z",
"emojis": [],
"favourited": false,
"favourites_count": 0,
"id": "A2xvLMMFLmqUQiZSqG",
"in_reply_to_account_id": null,
"in_reply_to_id": null,
"language": null,
"media_attachments": [],
"mentions": [],
"muted": false,
"pinned": false,
"pleroma": {
"content": {
"text/plain": "A post I made that will be included in the report"
},
"conversation_id": 7,
"direct_conversation_id": null,
"emoji_reactions": [],
"expires_at": null,
"in_reply_to_account_acct": null,
"local": true,
"parent_visible": false,
"spoiler_text": {
"text/plain": ""
},
"thread_muted": false
},
"poll": null,
"reblog": null,
"reblogged": false,
"reblogs_count": 0,
"replies_count": 0,
"sensitive": false,
"spoiler_text": "",
"tags": [],
"text": null,
"uri": "https://develop.ilja.space/objects/8fe7611a-07e7-403a-ae08-f74580b6cc53",
"url": "https://develop.ilja.space/notice/9ymgJaQxAbTzDDZMJs",
"visibility": "public"
}
const report = { const report = {
"account": { "account": {
"acct": "reporting_account", "acct": "reporting_account",
@ -668,99 +763,12 @@ const report = {
"state": "open", "state": "open",
"statuses": [ "statuses": [
{ {
"account": { ...mockStatus,
"acct": "reported_account", },
"avatar": "https://develop.ilja.space/images/avi.png", {
"avatar_static": "https://develop.ilja.space/images/avi.png", ...mockStatus,
"bot": false, content: 'This is another status that I created to be included in the report to test multiple statuses.',
"created_at": "2020-09-03T14:18:21.000Z", id: '123'
"display_name": "Reported Account",
"emojis": [],
"fields": [],
"followers_count": 0,
"following_count": 0,
"header": "https://develop.ilja.space/images/banner.png",
"header_static": "https://develop.ilja.space/images/banner.png",
"id": "9ymgGklmHjZ2OpxVLM",
"locked": false,
"note": "I&#39;m an account made for an example report notification. I&#39;m the one that will be reported.",
"pleroma": {
"accepts_chat_messages": true,
"ap_id": "https://develop.ilja.space/users/reported_account",
"background_image": null,
"confirmation_pending": false,
"favicon": null,
"hide_favorites": true,
"hide_followers": false,
"hide_followers_count": false,
"hide_follows": false,
"hide_follows_count": false,
"is_admin": false,
"is_moderator": false,
"relationship": {},
"skip_thread_containment": false,
"tags": []
},
"source": {
"fields": [],
"note": "",
"pleroma": {
"actor_type": "Person",
"discoverable": false
},
"sensitive": false
},
"statuses_count": 1,
"url": "https://develop.ilja.space/users/reported_account",
"username": "reported_account"
},
"application": {
"name": "Web",
"website": null
},
"bookmarked": false,
"card": null,
"content": "A post I made that will be included in the report",
"created_at": "2020-09-03T14:18:51.000Z",
"emojis": [],
"favourited": false,
"favourites_count": 0,
"id": "9ymgJaQxAbTzDDZMJs",
"in_reply_to_account_id": null,
"in_reply_to_id": null,
"language": null,
"media_attachments": [],
"mentions": [],
"muted": false,
"pinned": false,
"pleroma": {
"content": {
"text/plain": "A post I made that will be included in the report"
},
"conversation_id": 7,
"direct_conversation_id": null,
"emoji_reactions": [],
"expires_at": null,
"in_reply_to_account_acct": null,
"local": true,
"parent_visible": false,
"spoiler_text": {
"text/plain": ""
},
"thread_muted": false
},
"poll": null,
"reblog": null,
"reblogged": false,
"reblogs_count": 0,
"replies_count": 0,
"sensitive": false,
"spoiler_text": "",
"tags": [],
"text": null,
"uri": "https://develop.ilja.space/objects/8fe7611a-07e7-403a-ae08-f74580b6cc53",
"url": "https://develop.ilja.space/notice/9ymgJaQxAbTzDDZMJs",
"visibility": "public"
} }
] ]
}, },
@ -848,6 +856,7 @@ const fetchTimeline = ({
if (isNotifications) { if (isNotifications) {
return { data: [parseNotification(report)], pagination } return { data: [parseNotification(report)], pagination }
} }
return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination } return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination }
} else { } else {
data.status = status data.status = status

View file

@ -201,7 +201,6 @@ export const parseUser = (data) => {
// Convert punycode to unicode // Convert punycode to unicode
if (output.screen_name.includes('@')) { if (output.screen_name.includes('@')) {
const parts = output.screen_name.split('@') const parts = output.screen_name.split('@')
console.log(parts)
let unicodeDomain = punycode.toUnicode(parts[1]) let unicodeDomain = punycode.toUnicode(parts[1])
if (unicodeDomain !== parts[1]) { if (unicodeDomain !== parts[1]) {
// Add some identifier so users can potentially spot spoofing attempts: // Add some identifier so users can potentially spot spoofing attempts: