Compare commits

...

34 commits

Author SHA1 Message Date
sfr 5385797ff1 Smarter scope copy (#28)
Reviewed-on: AkkomaGang/pleroma-fe#28
Co-authored-by: sfr <sol@solfisher.com>
Co-committed-by: sfr <sol@solfisher.com>
2022-07-12 09:04:28 +00:00
floatingghost 7d377b8e88 Merge pull request '[#30] increase spacing of icons' (#31) from icon-spacing into develop
Reviewed-on: AkkomaGang/pleroma-fe#31
2022-07-10 17:11:44 +00:00
FloatingGhost 67bc9e5ba3 increase spacing of icons 2022-07-10 18:05:55 +01:00
floatingghost 3dac486688 Merge pull request 'refactor list search' (#27) from list-searcher into develop
Reviewed-on: AkkomaGang/pleroma-fe#27
2022-07-05 13:42:17 +00:00
FloatingGhost 88d04f0af7 also run search on checkbox update 2022-07-05 14:37:26 +01:00
FloatingGhost 617cd7d1f8 refactor list search 2022-07-05 14:28:23 +01:00
sfr 677e5325fa implement Move activities (#26)
Reviewed-on: AkkomaGang/pleroma-fe#26
Co-authored-by: sfr <sol@solfisher.com>
Co-committed-by: sfr <sol@solfisher.com>
2022-07-04 16:38:58 +00:00
floatingghost 101f15a078 Merge pull request 'fix search rendering' (#25) from mfm-search into develop
Reviewed-on: AkkomaGang/pleroma-fe#25
2022-07-01 12:50:44 +00:00
FloatingGhost 370f3b14fa fix search rendering 2022-07-01 13:50:14 +01:00
floatingghost 6e641a99a2 Show warning if a post has a subject line but is not marked as sensitive (#24)
Reviewed-on: AkkomaGang/pleroma-fe#24
2022-06-28 13:53:12 +00:00
sfr 716320de35 Respect subject lines in notifications (#23)
Reviewed-on: AkkomaGang/pleroma-fe#23
Co-authored-by: sfr <sol@solfisher.com>
Co-committed-by: sfr <sol@solfisher.com>
2022-06-27 16:15:24 +00:00
floatingghost 06343addef Merge pull request 'Render inline code correctly in MFM' (#21) from sfr/pleroma-fe:mfm-code into develop
Reviewed-on: AkkomaGang/pleroma-fe#21
2022-06-27 09:33:49 +00:00
Sol Fisher Romanoff eb69fc33f6
Render inline code correctly in MFM 2022-06-27 10:15:57 +03:00
floatingghost 9e13e5d164 Add cleaner message for rate-limited users (#19)
Reviewed-on: AkkomaGang/pleroma-fe#19
2022-06-26 19:02:49 +00:00
sfr 794906f01e Fix alt text wrap and line breaks (#14)
Reviewed-on: AkkomaGang/pleroma-fe#14
Co-authored-by: sfr <sol@solfisher.com>
Co-committed-by: sfr <sol@solfisher.com>
2022-06-26 18:36:04 +00:00
sfr 263ef17816 Use textarea instead of input for composing alt text (#15)
Reviewed-on: AkkomaGang/pleroma-fe#15
Co-authored-by: sfr <sol@solfisher.com>
Co-committed-by: sfr <sol@solfisher.com>
2022-06-26 17:51:13 +00:00
FloatingGhost 7025cb8bb0 Merge branch 'build-on-merge' into develop 2022-06-26 18:20:54 +01:00
FloatingGhost 821460075a also run build on push 2022-06-26 18:20:41 +01:00
floatingghost b87637c611 Merge pull request 'Build and release on merge into develop' (#17) from build-on-merge into develop
Reviewed-on: AkkomaGang/pleroma-fe#17
2022-06-26 17:14:52 +00:00
FloatingGhost e10588430f builds on merge into develop for ease of release 2022-06-26 18:13:57 +01:00
floatingghost dda1a2f75c Merge pull request 'Allow boosting own private posts' (#16) from sfr/pleroma-fe:boost-priv into develop
Reviewed-on: AkkomaGang/pleroma-fe#16
2022-06-26 17:11:08 +00:00
Yureka cc35202911
Allow boosting own private posts 2022-06-26 07:54:42 +03:00
floatingghost 9827c0e81e Merge pull request 'Remove auto-dismissing notifications' (#13) from sfr/pleroma-fe:develop into develop
Reviewed-on: AkkomaGang/pleroma-fe#13
2022-06-24 15:47:48 +00:00
Sol Fisher Romanoff f481cdd00b
Remove auto-dismissing notifications 2022-06-23 22:31:48 +03:00
floatingghost f0e180693e Merge pull request 'Don't show note textarea if logged out' (#12) from sfr/pleroma-fe:notes into develop
Reviewed-on: AkkomaGang/pleroma-fe#12
2022-06-23 19:09:57 +00:00
Sol Fisher Romanoff 9f9c5e01f1
Don't show note textarea if logged out 2022-06-23 20:02:47 +03:00
floatingghost c71405ccad Merge pull request 'Add private note field to user profile' (#9) from sfr/pleroma-fe:notes into develop
Reviewed-on: AkkomaGang/pleroma-fe#9
2022-06-23 14:33:18 +00:00
Sol Fisher Romanoff 231a4af754
Disable private note for self 2022-06-23 15:04:54 +03:00
Sol Fisher Romanoff 398b2624c8
Add note saving indicator 2022-06-23 15:04:19 +03:00
Sol Fisher Romanoff 4f0eabbd55
api: turn MASTODON_USER_URL into a function 2022-06-23 15:02:43 +03:00
Sol Fisher Romanoff fb2fc686b1
Add debounce to API request 2022-06-22 19:42:27 +03:00
Sol Fisher Romanoff 9923ff587b
Add private note field to user profile 2022-06-22 19:14:06 +03:00
FloatingGhost 261a9da374 remove parsing of sparkle 2022-06-22 11:26:48 +01:00
FloatingGhost ca8689fc88 bugfix: don't error if emoji not found 2022-06-20 14:55:38 +01:00
33 changed files with 617 additions and 150 deletions

View file

@ -25,7 +25,9 @@ pipeline:
build:
when:
event:
- tag
- push
branch:
- develop
image: node:16
commands:
- yarn
@ -34,7 +36,9 @@ pipeline:
release:
when:
event:
- tag
- push
branch:
- develop
image: node:16
secrets:
- SCW_ACCESS_KEY

View file

@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Media modal now also displays description and counter position in gallery (i.e. 1/5)
- Ability to rearrange order of attachments when uploading
- Enabled users to zoom and pan images in media viewer with mouse and touch
- Added frontend ui for account migration
## [2.4.2] - 2022-01-09

View file

@ -199,6 +199,26 @@ const Attachment = {
const width = image.naturalWidth
const height = image.naturalHeight
this.$emit('naturalSizeLoad', { id: this.attachment.id, width, height })
},
resize (e) {
const target = e.target || e
if (!(target instanceof window.Element)) { return }
// Reset to default height for empty form, nothing else to do here.
if (target.value === '') {
target.style.height = null
this.$emit('resize')
return
}
const paddingString = getComputedStyle(target)['padding']
// remove -px suffix
const padding = Number(paddingString.substring(0, paddingString.length - 2))
target.style.height = 'auto'
const newHeight = Math.floor(target.scrollHeight - padding * 2)
target.style.height = `${newHeight}px`
this.$emit('resize', newHeight)
}
}
}

View file

@ -16,7 +16,7 @@
.attachment-wrapper {
flex: 1 1 auto;
height: 100%;
height: 200px;
position: relative;
overflow: hidden;
}
@ -33,7 +33,8 @@
line-height: 1.5;
padding: 0.5em;
margin: 0;
white-space: nowrap;
white-space: pre-line;
word-break: break-word;
text-overflow: ellipsis;
overflow: hidden;
}
@ -52,6 +53,19 @@
.description-field {
flex: 1;
min-width: 0;
box-sizing: content-box;
overflow: hidden;
transition: min-height 200ms 100ms;
padding-bottom: var(--_padding);
height: calc(var(--post-line-height) * 1em);
min-height: calc(var(--post-line-height) * 1em);
resize: none;
&.scrollable-form {
overflow-y: auto;
}
}
& .placeholder-container,

View file

@ -248,14 +248,15 @@
class="description-container"
:class="{ '-static': !edit }"
>
<input
<textarea
v-if="edit"
v-model="localDescription"
type="text"
class="description-field"
:placeholder="$t('post_status.media_description')"
@keydown.enter.prevent=""
>
rows="1"
cols="1"
@input="resize"
/>
<p v-else>
{{ localDescription }}
</p>

View file

@ -80,11 +80,16 @@
}
.nav-icon {
margin-left: 0.2em;
margin-left: 1em;
width: 2em;
height: 100%;
font-size: 130%;
text-align: center;
&-logout {
margin-left: 2em;
}
.svg-inline--fa {
color: $fallback--link;
color: var(--topBarLink, $fallback--link);

View file

@ -63,7 +63,7 @@
</a>
<button
v-if="currentUser"
class="button-unstyled nav-icon"
class="button-unstyled nav-icon nav-icon-logout"
@click.prevent="logout"
>
<FAIcon

View file

@ -171,7 +171,6 @@
.gallery-item {
margin: 0;
height: 200px;
}
}
}

View file

@ -1,5 +1,6 @@
import { mapState, mapGetters } from 'vuex'
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
import ListUserSearch from '../list_user_search/list_user_search.vue'
import UserAvatar from '../user_avatar/user_avatar.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
@ -15,15 +16,14 @@ library.add(
const ListNew = {
components: {
BasicUserCard,
UserAvatar
UserAvatar,
ListUserSearch
},
data () {
return {
title: '',
userIds: [],
selectedUserIds: [],
loading: false,
query: ''
selectedUserIds: []
}
},
created () {
@ -47,13 +47,6 @@ const ListNew = {
selectedUsers () {
return this.selectedUserIds.map(userId => this.findUser(userId)).filter(user => user)
},
availableUsers () {
if (this.query.length !== 0) {
return this.users
} else {
return this.selectedUsers
}
},
...mapState({
currentUser: state => state.users.currentUser
}),
@ -79,19 +72,8 @@ const ListNew = {
removeUser (userId) {
this.selectedUserIds = this.selectedUserIds.filter(id => id !== userId)
},
search (query) {
if (!query) {
this.loading = false
return
}
this.loading = true
this.userIds = []
this.$store.dispatch('search', { q: query, resolve: true, type: 'accounts', following: true })
.then(data => {
this.loading = false
this.userIds = data.accounts.map(a => a.id)
})
onResults (results) {
this.userIds = results
},
updateList () {
this.$store.dispatch('setList', { id: this.id, title: this.title })

View file

@ -21,23 +21,23 @@
:placeholder="$t('lists.title')"
>
</div>
<div class="input-wrap">
<div class="input-search">
<FAIcon
class="search-icon fa-scale-110 fa-old-padding"
icon="search"
/>
</div>
<input
ref="search"
v-model="query"
:placeholder="$t('lists.search')"
@input="onInput"
>
</div>
<div class="member-list">
<div
v-for="user in availableUsers"
v-for="user in selectedUsers"
:key="user.id"
class="member"
>
<BasicUserCard
:user="user"
:class="isSelected(user) ? 'selected' : ''"
@click.capture.prevent="selectUser(user)"
/>
</div>
</div>
<ListUserSearch @results="onResults" />
<div class="member-list">
<div
v-for="user in users"
:key="user.id"
class="member"
>

View file

@ -1,6 +1,7 @@
import { mapState, mapGetters } from 'vuex'
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
import UserAvatar from '../user_avatar/user_avatar.vue'
import ListUserSearch from '../list_user_search/list_user_search.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faSearch,
@ -15,15 +16,14 @@ library.add(
const ListNew = {
components: {
BasicUserCard,
UserAvatar
UserAvatar,
ListUserSearch
},
data () {
return {
title: '',
userIds: [],
selectedUserIds: [],
loading: false,
query: ''
selectedUserIds: []
}
},
computed: {
@ -33,13 +33,6 @@ const ListNew = {
selectedUsers () {
return this.selectedUserIds.map(userId => this.findUser(userId))
},
availableUsers () {
if (this.query.length !== 0) {
return this.users
} else {
return this.selectedUsers
}
},
...mapState({
currentUser: state => state.users.currentUser
}),
@ -68,19 +61,8 @@ const ListNew = {
removeUser (userId) {
this.selectedUserIds = this.selectedUserIds.filter(id => id !== userId)
},
search (query) {
if (!query) {
this.loading = false
return
}
this.loading = true
this.userIds = []
this.$store.dispatch('search', { q: query, resolve: true, type: 'accounts', following: true })
.then(data => {
this.loading = false
this.userIds = data.accounts.map(a => a.id)
})
onResults (results) {
this.userIds = results
},
createList () {
// the API has two different endpoints for "creating a list with a name"

View file

@ -21,23 +21,10 @@
:placeholder="$t('lists.title')"
>
</div>
<div class="input-wrap">
<div class="input-search">
<FAIcon
class="search-icon fa-scale-110 fa-old-padding"
icon="search"
/>
</div>
<input
ref="search"
v-model="query"
:placeholder="$t('lists.search')"
@input="onInput"
>
</div>
<div class="member-list">
<div
v-for="user in availableUsers"
v-for="user in selectedUsers"
:key="user.id"
class="member"
>
@ -48,6 +35,21 @@
/>
</div>
</div>
<ListUserSearch
@results="onResults"
/>
<div
v-for="user in users"
:key="user.id"
class="member"
>
<BasicUserCard
:user="user"
:class="isSelected(user) ? 'selected' : ''"
@click.capture.prevent="selectUser(user)"
/>
</div>
<button
:disabled="title && title.length === 0"
class="btn button-default"
@ -64,15 +66,6 @@
@import '../../_variables.scss';
.list-new {
.input-wrap {
display: flex;
margin: 0.7em 0.5em 0.7em 0.5em;
input {
width: 100%;
}
}
.search-icon {
margin-right: 0.3em;
}

View file

@ -0,0 +1,46 @@
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faSearch,
faChevronLeft
} from '@fortawesome/free-solid-svg-icons'
import { debounce } from 'lodash'
import Checkbox from '../checkbox/checkbox.vue'
library.add(
faSearch,
faChevronLeft
)
const ListUserSearch = {
components: {
Checkbox
},
data () {
return {
loading: false,
query: '',
followingOnly: true
}
},
methods: {
onInput: debounce(function () {
this.search(this.query)
}, 2000),
search (query) {
if (!query) {
this.loading = false
return
}
this.loading = true
this.userIds = []
this.$store.dispatch('search', { q: query, resolve: true, type: 'accounts', following: this.followingOnly })
.then(data => {
this.loading = false
this.$emit('results', data.accounts.map(a => a.id))
})
}
}
}
export default ListUserSearch

View file

@ -0,0 +1,45 @@
<template>
<div>
<div class="input-wrap">
<div class="input-search">
<FAIcon
class="search-icon fa-scale-110 fa-old-padding"
icon="search"
/>
</div>
<input
ref="search"
v-model="query"
:placeholder="$t('lists.search')"
@input="onInput"
>
</div>
<div class="input-wrap">
<Checkbox
v-model="followingOnly"
@change="onInput"
>
{{ $t('lists.following_only') }}
</Checkbox>
</div>
</div>
</template>
<script src="./list_user_search.js"></script>
<style lang="scss">
@import '../../_variables.scss';
.input-wrap {
display: flex;
margin: 0.7em 0.5em 0.7em 0.5em;
input {
width: 100%;
}
}
.search-icon {
margin-right: 0.3em;
}
</style>

View file

@ -189,7 +189,8 @@ $modal-view-button-icon-margin: 0.5em;
min-height: 1em;
max-width: 500px;
max-height: 9.5em;
word-break: break-all;
word-break: break-word;
white-space: pre-line;
}
.modal-image {

View file

@ -1,13 +1,12 @@
import { defineComponent, h } from 'vue'
import * as mfm from 'mfm-js'
import MentionLink from '../mention_link/mention_link.vue'
import mention_link from '../mention_link/mention_link'
function concat (xss) {
return ([]).concat(...xss)
}
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'font', 'blur', 'rainbow', 'sparkle', 'rotate']
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'font', 'blur', 'rainbow', 'rotate']
export default defineComponent({
props: {
@ -138,9 +137,6 @@ export default defineComponent({
style = 'animation: mfm-rainbow 1s linear infinite;'
break
}
case 'sparkle': {
return h(MkSparkle, {}, genEl(token.children))
}
case 'rotate': {
const degrees = parseInt(token.props.args.deg) || '90'
style = `transform: rotate(${degrees}deg); transform-origin: center center;`
@ -214,11 +210,10 @@ export default defineComponent({
}
case 'inlineCode': {
return [h('pre', {
return [h('code', {
key: Math.random(),
code: token.props.code,
inline: true
})]
display: 'inline'
}, token.props.code)]
}
case 'quote': {
@ -234,16 +229,21 @@ export default defineComponent({
}
case 'emojiCode': {
return [h('div', {
class: 'still-image emoji img'
},
[h('img', {
key: Math.random(),
title: token.props.name,
alt: token.props.name,
src: this.status.emojis.find((emoji) => emoji.shortcode === token.props.name).static_url
})]
)]
const emoj = this.status.emojis.find((emoji) => emoji.shortcode === token.props.name)
if (emoj) {
return [h('div', {
class: 'still-image emoji img'
},
[h('img', {
key: Math.random(),
title: token.props.name,
alt: token.props.name,
src: this.status.emojis.find((emoji) => emoji.shortcode === token.props.name).static_url
})]
)]
} else {
return `:${token.props.name}:`
}
}
case 'unicodeEmoji': {
@ -265,6 +265,13 @@ export default defineComponent({
})]
}
case 'search': {
return [h('a', {
href: `https://www.google.com/search?q=${token.props.query}`
}, token.props.content)
]
}
default: {
console.error('unrecognized ast type:', token.type)

View file

@ -112,17 +112,11 @@ const PostStatusForm = {
const preset = this.$route.query.message
let statusText = preset || ''
const { scopeCopy } = this.$store.getters.mergedConfig
if (this.replyTo) {
const currentUser = this.$store.state.users.currentUser
statusText = buildMentionsString({ user: this.repliedUser, attentions: this.attentions }, currentUser)
}
const scope = ((this.copyMessageScope && scopeCopy) || this.copyMessageScope === 'direct')
? this.copyMessageScope
: this.$store.state.users.currentUser.default_scope
const { postContentType: contentType, sensitiveByDefault, sensitiveIfSubject } = this.$store.getters.mergedConfig
return {
@ -139,7 +133,7 @@ const PostStatusForm = {
files: [],
poll: {},
mediaDescriptions: {},
visibility: scope,
visibility: this.suggestedVisibility(),
contentType
},
caret: 0,
@ -281,8 +275,6 @@ const PostStatusForm = {
if (this.preview) this.previewStatus()
},
async postStatus (event, newStatus, opts = {}) {
const { sensitiveIfSubject } = this.$store.getters.mergedConfig
if (this.posting && !this.optimisticPosting) { return }
if (this.disableSubmit) { return }
if (this.emojiInputShown) { return }
@ -318,7 +310,7 @@ const PostStatusForm = {
status: newStatus.status,
spoilerText: newStatus.spoilerText || null,
visibility: newStatus.visibility,
sensitive: (newStatus.nsfw || (sensitiveIfSubject && newStatus.spoilerText)),
sensitive: newStatus.nsfw,
media: newStatus.files,
store: this.$store,
inReplyToStatusId: this.replyTo,
@ -392,6 +384,10 @@ const PostStatusForm = {
},
addMediaFile (fileInfo) {
this.newStatus.files.push(fileInfo)
if (this.newStatus.sensitiveIfSubject && this.newStatus.spoilerText !== '') {
this.newStatus.nsfw = true
}
this.$emit('resize', { delayed: true })
},
removeMediaFile (fileInfo) {
@ -468,6 +464,11 @@ const PostStatusForm = {
this.resize(this.$refs['textarea'])
})
},
onSubjectInput (e) {
if (this.newStatus.sensitiveIfSubject) {
this.newStatus.nsfw = true
}
},
resize (e) {
const target = e.target || e
if (!(target instanceof window.Element)) { return }
@ -607,6 +608,19 @@ const PostStatusForm = {
},
openProfileTab () {
this.$store.dispatch('openSettingsModalTab', 'profile')
},
suggestedVisibility () {
if (this.copyMessageScope) {
if (this.copyMessageScope === 'direct') {
return this.copyMessageScope
}
if (this.$store.getters.mergedConfig.scopeCopy) {
if (this.copyMessageScope !== 'public' && this.$store.state.users.currentUser.default_scope !== 'private') {
return this.copyMessageScope
}
}
}
return this.$store.state.users.currentUser.default_scope
}
}
}

View file

@ -124,8 +124,18 @@
:disabled="posting && !optimisticPosting"
size="1"
class="form-post-subject"
@input="onSubjectInput"
>
</EmojiInput>
<i18n-t
v-if="newStatus.files.length !== 0 && newStatus.nsfw === false && newStatus.spoilerText !== ''"
keypath="post_status.media_not_sensitive_warning"
tag="p"
class="visibility-notice"
scope="global"
>
{{ $t('post_status.media_not_sensitive_warning') }}
</i18n-t>
<EmojiInput
ref="emoji-input"
v-model="newStatus.status"

View file

@ -24,6 +24,9 @@ const RetweetButton = {
}
},
computed: {
isOwn () {
return this.status.user.id === this.$store.state.users.currentUser.id
},
mergedConfig () {
return this.$store.getters.mergedConfig
}

View file

@ -1,7 +1,7 @@
<template>
<div class="RetweetButton">
<button
v-if="visibility !== 'private' && visibility !== 'direct' && loggedIn"
v-if="(visibility !== 'private' || isOwn) && visibility !== 'direct' && loggedIn"
class="button-unstyled interactive"
:class="status.repeated && '-repeated'"
:title="$t('tool_tip.repeat')"

View file

@ -65,6 +65,14 @@
{{ $t('settings.enable_web_push_notifications') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting
path="webPushHideIfCW"
expert="1"
>
{{ $t('settings.notification_setting_hide_if_cw') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting
path="serverSide_webPushHideContents"

View file

@ -15,11 +15,21 @@ const SecurityTab = {
deleteAccountError: false,
changePasswordInputs: [ '', '', '' ],
changedPassword: false,
changePasswordError: false
changePasswordError: false,
moveAccountTarget: '',
moveAccountPassword: '',
movedAccount: false,
moveAccountError: false,
aliases: [],
listAliasesError: false,
addAliasTarget: '',
addedAlias: false,
addAliasError: false
}
},
created () {
this.$store.dispatch('fetchTokens')
this.fetchAliases()
},
components: {
ProgressButton,
@ -92,6 +102,49 @@ const SecurityTab = {
}
})
},
moveAccount () {
const params = {
targetAccount: this.moveAccountTarget,
password: this.moveAccountPassword
}
this.$store.state.api.backendInteractor.moveAccount(params)
.then((res) => {
if (res.status === 'success') {
this.movedAccount = true
this.moveAccountError = false
} else {
this.movedAccount = false
this.moveAccountError = res.error
}
})
},
removeAlias (alias) {
this.$store.state.api.backendInteractor.deleteAlias({ alias })
.then(() => this.fetchAliases())
},
addAlias () {
this.$store.state.api.backendInteractor.addAlias({ alias: this.addAliasTarget })
.then((res) => {
this.addedAlias = true
this.addAliasError = false
this.addAliasTarget = ''
})
.catch((error) => {
this.addedAlias = false
this.addAliasError = error
})
.then(() => this.fetchAliases())
},
fetchAliases () {
this.$store.state.api.backendInteractor.listAliases()
.then((res) => {
this.aliases = res.aliases
this.listAliasesError = false
})
.catch((error) => {
this.listAliasesError = error.error
})
},
logout () {
this.$store.dispatch('logout')
this.$router.replace('/')

View file

@ -103,6 +103,114 @@
</table>
</div>
<mfa />
<div class="setting-item">
<h2>{{ $t('settings.account_alias') }}</h2>
<table>
<thead>
<tr>
<th>{{ $t('settings.account_alias_table_head') }}</th>
<th />
</tr>
</thead>
<tbody>
<tr
v-for="alias in aliases"
:key="alias"
>
<td>{{ alias }}</td>
<td class="actions">
<button
class="btn button-default"
@click="removeAlias(alias)"
>
{{ $t('settings.remove_alias') }}
</button>
</td>
</tr>
</tbody>
</table>
<div
v-if="listAliasesError"
class="alert error"
>
{{ $t('settings.list_aliases_error', { error }) }}
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="times"
:title="$t('settings.hide_list_aliases_error_action')"
@click="listAliasesError = false"
/>
</div>
<div>
<i18n
path="settings.new_alias_target"
tag="p"
>
<code
place="example"
>
foo@example.org
</code>
</i18n>
<input
v-model="addAliasTarget"
>
</div>
<button
class="btn button-default"
@click="addAlias"
>
{{ $t('settings.save') }}
</button>
<p v-if="addedAlias">
{{ $t('settings.added_alias') }}
</p>
<template v-if="addAliasError !== false">
<p>{{ $t('settings.add_alias_error', { error: addAliasError }) }}</p>
</template>
</div>
<div class="setting-item">
<h2>{{ $t('settings.move_account') }}</h2>
<p>{{ $t('settings.move_account_notes') }}</p>
<div>
<i18n
path="settings.move_account_target"
tag="p"
>
<code
place="example"
>
foo@example.org
</code>
</i18n>
<input
v-model="moveAccountTarget"
>
</div>
<div>
<p>{{ $t('settings.current_password') }}</p>
<input
v-model="moveAccountPassword"
type="password"
autocomplete="current-password"
>
</div>
<button
class="btn button-default"
@click="moveAccount"
>
{{ $t('settings.save') }}
</button>
<p v-if="movedAccount">
{{ $t('settings.moved_account') }}
</p>
<template v-if="moveAccountError !== false">
<p>{{ $t('settings.move_account_error', { error: moveAccountError }) }}</p>
</template>
</div>
<div class="setting-item">
<h2>{{ $t('settings.delete_account') }}</h2>
<p v-if="!deletingAccount">

View file

@ -7,6 +7,7 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import RichContent from 'src/components/rich_content/rich_content.jsx'
import List from '../list/list.vue'
import withLoadMore from '../../hocs/with_load_more/with_load_more'
import { debounce } from 'lodash'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faCircleNotch
@ -40,7 +41,9 @@ const UserProfile = {
error: false,
userId: null,
tab: defaultTabKey,
footerRef: null
footerRef: null,
note: null,
noteLoading: false
}
},
created () {
@ -110,9 +113,13 @@ const UserProfile = {
const user = this.$store.getters.findUser(userNameOrId)
if (user) {
loadById(user.id)
this.note = user.relationship.note
} else {
this.$store.dispatch('fetchUser', userNameOrId)
.then(({ id }) => loadById(id))
.then(({ id, relationship }) => {
this.note = relationship.note
return loadById(id)
})
.catch((reason) => {
const errorMessage = get(reason, 'error.error')
if (errorMessage === 'No user with such user_id') { // Known error
@ -145,7 +152,15 @@ const UserProfile = {
if (target.tagName === 'A') {
window.open(target.href, '_blank')
}
}
},
setNote () {
this.noteLoading = true
this.debounceSetNote()
},
debounceSetNote: debounce(function () {
this.$store.dispatch('setNote', { id: this.userId, note: this.note })
this.noteLoading = false
}, 1500)
},
watch: {
'$route.params.id': function (newVal) {

View file

@ -40,6 +40,27 @@
</dd>
</dl>
</div>
<div
v-if="currentUser && !isUs"
class="note"
>
<textarea
v-model="note"
class="resize-height"
:placeholder="$t('user_card.note')"
@input="setNote"
/>
<div
v-show="noteLoading"
class="preview-spinner"
>
<FAIcon
class="fa-old-padding"
spin
icon="circle-notch"
/>
</div>
</div>
<tab-switcher
:active-tab="tab"
:render-only-focused="true"
@ -202,6 +223,22 @@
align-items: middle;
padding: 2em;
}
.note {
position: relative;
margin: 0.5em 0.75em;
textarea {
width: 100%;
}
.preview-spinner {
position: absolute;
top: 0;
right: 0;
margin: 0.5em 0.25em;
}
}
}
.user-profile-placeholder {
.panel-body {

View file

@ -204,6 +204,7 @@
"new_status": "Post new status",
"account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
"account_not_locked_warning_link": "locked",
"media_not_sensitive_warning": "You have a Content Warning, but the attachments are not marked as sensitive!",
"attachments_sensitive": "Mark attachments as sensitive",
"media_description": "Media description",
"content_type": {
@ -348,6 +349,19 @@
"delete_account_description": "Permanently delete your data and deactivate your account.",
"delete_account_error": "There was an issue deleting your account. If this persists please contact your instance administrator.",
"delete_account_instructions": "Type your password in the input below to confirm account deletion.",
"account_alias": "Account aliases",
"account_alias_table_head": "Alias",
"list_aliases_error": "Error fetching aliases: {error}",
"hide_list_aliases_error_action": "Close",
"remove_alias": "Remove this alias",
"new_alias_target": "Add a new alias (e.g. {example})",
"added_alias": "Alias is added.",
"add_alias_error": "Error adding alias: {error}",
"move_account": "Move account",
"move_account_notes": "If you want to move the account somewhere else, you must go to your target account and add an alias pointing here.",
"move_account_target": "Target account (e.g. {example})",
"moved_account": "Account is moved.",
"move_account_error": "Error moving account: {error}",
"discoverable": "Allow discovery of this account in search results and other services",
"domain_mutes": "Domains",
"avatar_size_instruction": "The recommended minimum size for avatar images is 150x150 pixels.",
@ -546,6 +560,7 @@
"notification_setting_block_from_strangers": "Block notifications from users who you do not follow",
"notification_setting_privacy": "Privacy",
"notification_setting_hide_notification_contents": "Hide the sender and contents of push notifications",
"notification_setting_hide_if_cw": "Hide the contents of push notifications if under a Content Warning",
"notification_mutes": "To stop receiving notifications from a specific user, use a mute.",
"notification_blocks": "Blocking a user stops all notifications as well as unsubscribes them.",
"enable_web_push_notifications": "Enable web push notifications",
@ -845,6 +860,7 @@
"domain_muted": "Unblock domain",
"mute_domain": "Block domain",
"bot": "Bot",
"note": "Private note",
"admin_menu": {
"moderation": "Moderation",
"grant_admin": "Grant Admin",
@ -954,7 +970,8 @@
"search": "Search users",
"create": "Create",
"save": "Save changes",
"delete": "Delete list"
"delete": "Delete list",
"following_only": "Limit to Following"
},
"file_type": {
"audio": "Audio",

View file

@ -63,6 +63,7 @@ export const defaultState = {
polls: true
},
webPushNotifications: false,
webPushHideIfCW: true,
muteWords: [],
highlight: {},
interfaceLanguage: browserLocale,

View file

@ -54,7 +54,7 @@ const defaultState = {
theme: 'pleroma-dark',
virtualScrolling: true,
sensitiveByDefault: false,
sensitiveIfSubject: false,
sensitiveIfSubject: true,
renderMisskeyMarkdown: false,
conversationDisplay: 'linear',
conversationTreeAdvanced: false,

View file

@ -747,8 +747,8 @@ const statuses = {
rootState.api.backendInteractor.fetchRebloggedByUsers({ id })
.then(rebloggedByUsers => commit('addRepeats', { id, rebloggedByUsers, currentUser: rootState.users.currentUser }))
},
search (store, { q, resolve, limit, offset, following }) {
return store.rootState.api.backendInteractor.search2({ q, resolve, limit, offset, following })
search (store, { q, resolve, limit, offset, following, type }) {
return store.rootState.api.backendInteractor.search2({ q, resolve, limit, offset, following, type })
.then((data) => {
store.commit('addNewUsers', data.accounts)
store.commit('addNewStatuses', { statuses: data.statuses })

View file

@ -102,6 +102,11 @@ const unmuteDomain = (store, domain) => {
.then(() => store.commit('removeDomainMute', domain))
}
const setNote = (store, { id, note }) => {
return store.rootState.api.backendInteractor.setNote({ id, note })
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
}
export const mutations = {
tagUser (state, { user: { id }, tag }) {
const user = state.usersObject[id]
@ -366,6 +371,9 @@ const users = {
unmuteDomains (store, domain = []) {
return Promise.all(domain.map(domain => unmuteDomain(store, domain)))
},
setNote (store, { id, note }) {
return setNote(store, { id, note })
},
fetchFriends ({ rootState, commit }, id) {
const user = rootState.users.usersObject[id]
const maxId = last(user.friendIds)

View file

@ -9,6 +9,8 @@ const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
const CHANGE_EMAIL_URL = '/api/pleroma/change_email'
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
const MOVE_ACCOUNT_URL = '/api/pleroma/move_account'
const ALIASES_URL = '/api/pleroma/aliases'
const TAG_USER_URL = '/api/pleroma/admin/users/tag'
const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}`
const ACTIVATE_USER_URL = '/api/pleroma/admin/users/activate'
@ -47,7 +49,7 @@ const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
const MASTODON_STATUS_URL = id => `/api/v1/statuses/${id}`
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
const MASTODON_USER_URL = '/api/v1/accounts'
const MASTODON_USER_URL = id => `/api/v1/accounts/${id}?with_relationships=true`
const MASTODON_USER_RELATIONSHIPS_URL = '/api/v1/accounts/relationships'
const MASTODON_USER_TIMELINE_URL = id => `/api/v1/accounts/${id}/statuses`
const MASTODON_LIST_URL = id => `/api/v1/lists/${id}`
@ -63,6 +65,7 @@ const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
const MASTODON_SUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/subscribe`
const MASTODON_UNSUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/unsubscribe`
const MASTODON_SET_NOTE_URL = id => `/api/v1/accounts/${id}/note`
const MASTODON_BOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/bookmark`
const MASTODON_UNBOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/unbookmark`
const MASTODON_POST_STATUS_URL = '/api/v1/statuses'
@ -310,7 +313,7 @@ const denyUser = ({ id, credentials }) => {
}
const fetchUser = ({ id, credentials }) => {
let url = `${MASTODON_USER_URL}/${id}`
const url = MASTODON_USER_URL(id)
return promisedRequest({ url, credentials })
.then((data) => parseUser(data))
}
@ -461,6 +464,20 @@ const deleteList = ({ id, credentials }) => {
})
}
const errorStatusMapper = (response) => {
console.log(response)
switch (response.status) {
case 429:
return 'You are rate limited'
case 500:
return 'Internal Server Error'
case 503:
return 'The backend is not available'
default:
return `Unexpected status: ${response.status}`
}
}
const fetchConversation = ({ id, credentials }) => {
let urlContext = MASTODON_STATUS_CONTEXT_URL(id)
return fetch(urlContext, { headers: authHeaders(credentials) })
@ -468,7 +485,7 @@ const fetchConversation = ({ id, credentials }) => {
if (data.ok) {
return data
}
throw new Error('Error fetching timeline', data)
throw new Error('Error fetching timeline', errorStatusMapper(data))
})
.then((data) => data.json())
.then(({ ancestors, descendants }) => ({
@ -484,7 +501,7 @@ const fetchStatus = ({ id, credentials }) => {
if (data.ok) {
return data
}
throw new Error('Error fetching timeline', data)
throw new Error('Error fetching timeline', errorStatusMapper(data))
})
.then((data) => data.json())
.then((data) => parseStatus(data))
@ -656,8 +673,15 @@ const fetchTimeline = ({
})
return data
})
.then((data) => data.json())
.then((data) => {
if (data.ok) return data.json()
throw new Error(errorStatusMapper(data))
})
.then((data) => {
if (data.error) {
throw new Error(data.error)
}
if (!data.errors) {
return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination }
} else {
@ -875,6 +899,49 @@ const changeEmail = ({ credentials, email, password }) => {
.then((response) => response.json())
}
const moveAccount = ({ credentials, password, targetAccount }) => {
const form = new FormData()
form.append('password', password)
form.append('target_account', targetAccount)
return fetch(MOVE_ACCOUNT_URL, {
body: form,
method: 'POST',
headers: authHeaders(credentials)
})
.then((response) => response.json())
}
const addAlias = ({ credentials, alias }) => {
return promisedRequest({
url: ALIASES_URL,
method: 'PUT',
credentials,
payload: { alias }
})
}
const deleteAlias = ({ credentials, alias }) => {
return promisedRequest({
url: ALIASES_URL,
method: 'DELETE',
credentials,
payload: { alias }
})
}
const listAliases = ({ credentials }) => {
return promisedRequest({
url: ALIASES_URL,
method: 'GET',
credentials,
params: {
_cacheBooster: (new Date()).getTime()
}
})
}
const changePassword = ({ credentials, password, newPassword, newPasswordConfirmation }) => {
const form = new FormData()
@ -948,6 +1015,18 @@ const unmuteUser = ({ id, credentials }) => {
return promisedRequest({ url: MASTODON_UNMUTE_USER_URL(id), credentials, method: 'POST' })
}
const setNote = ({ id, note, credentials }) => {
const form = new FormData()
form.append('comment', note)
return fetch(MASTODON_SET_NOTE_URL(id), {
body: form,
headers: authHeaders(credentials),
method: 'POST'
}).then((data) => data.json())
}
const fetchMascot = ({ credentials }) => {
return promisedRequest({ url: MASTODON_MASCOT_URL, credentials })
}
@ -1109,7 +1188,7 @@ const searchUsers = ({ credentials, query }) => {
.then((data) => data.map(parseUser))
}
const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
const search2 = ({ credentials, q, resolve, limit, offset, following, type }) => {
let url = MASTODON_SEARCH_2
let params = []
@ -1133,6 +1212,10 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
params.push(['following', true])
}
if (type) {
params.push(['type', type])
}
params.push(['with_relationships', true])
let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
@ -1405,6 +1488,7 @@ const apiService = {
fetchMutes,
muteUser,
unmuteUser,
setNote,
subscribeUser,
unsubscribeUser,
fetchBlocks,
@ -1426,6 +1510,10 @@ const apiService = {
importFollows,
deleteAccount,
changeEmail,
moveAccount,
addAlias,
deleteAlias,
listAliases,
changePassword,
settingsMFA,
mfaDisableOTP,

View file

@ -2,8 +2,5 @@ export const showDesktopNotification = (rootState, desktopNotificationOpts) => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (rootState.statuses.notifications.desktopNotificationSilence) { return }
const desktopNotification = new window.Notification(desktopNotificationOpts.title, desktopNotificationOpts)
// Chrome is known for not closing notifications automatically
// according to MDN, anyway.
setTimeout(desktopNotification.close.bind(desktopNotification), 5000)
return new window.Notification(desktopNotificationOpts.title, desktopNotificationOpts)
}

View file

@ -58,7 +58,7 @@ export const maybeShowNotification = (store, notification) => {
if (!visibleTypes(store).includes(notification.type)) return
if (notification.type === 'mention' && isMutedNotification(store, notification)) return
const notificationObject = prepareNotificationObject(notification, store.rootGetters.i18n)
const notificationObject = prepareNotificationObject(notification, store.rootGetters.i18n, store)
showDesktopNotification(rootState, notificationObject)
}
@ -74,7 +74,7 @@ export const filteredNotificationsFromStore = (store, types) => {
export const unseenNotificationsFromStore = store =>
filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
export const prepareNotificationObject = (notification, i18n) => {
export const prepareNotificationObject = (notification, i18n, store) => {
const notifObj = {
tag: notification.id
}
@ -109,7 +109,15 @@ export const prepareNotificationObject = (notification, i18n) => {
} else if (i18nString) {
notifObj.body = i18n.t('notifications.' + i18nString)
} else if (isStatusNotification(notification.type)) {
notifObj.body = notification.status.text
if (notification.status.summary) {
if (store.getters.mergedConfig.webPushHideIfCW) {
notifObj.body = notification.status.summary
} else {
notifObj.body = `${notification.status.summary}:\n${notification.status.text}`
}
} else {
notifObj.body = notification.status.text
}
}
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...