fix: use short usernames in options dialog (#1576)

This commit is contained in:
Nolan Lawson 2019-10-15 07:56:39 -07:00 committed by GitHub
parent ac4d512363
commit 67b71231d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 21 deletions

View file

@ -35,25 +35,26 @@ export default {
followRequested: ({ relationship }) => relationship && relationship.requested, followRequested: ({ relationship }) => relationship && relationship.requested,
accountId: ({ account }) => account && account.id, accountId: ({ account }) => account && account.id,
acct: ({ account }) => account.acct, acct: ({ account }) => account.acct,
username: ({ account }) => account.username,
muting: ({ relationship }) => relationship && relationship.muting, muting: ({ relationship }) => relationship && relationship.muting,
blocking: ({ relationship }) => relationship && relationship.blocking, blocking: ({ relationship }) => relationship && relationship.blocking,
followLabel: ({ following, followRequested, account, acct }) => { followLabel: ({ following, followRequested, account, username }) => {
if (typeof following === 'undefined' || !account) { if (typeof following === 'undefined' || !account) {
return '' return ''
} }
return (following || followRequested) return (following || followRequested)
? `Unfollow @${acct}` ? `Unfollow @${username}`
: `Follow @${acct}` : `Follow @${username}`
}, },
followIcon: ({ following, followRequested }) => ( followIcon: ({ following, followRequested }) => (
following ? '#fa-user-times' : followRequested ? '#fa-hourglass' : '#fa-user-plus' following ? '#fa-user-times' : followRequested ? '#fa-hourglass' : '#fa-user-plus'
), ),
blockLabel: ({ blocking, acct }) => ( blockLabel: ({ blocking, username }) => (
blocking ? `Unblock @${acct}` : `Block @${acct}` blocking ? `Unblock @${username}` : `Block @${username}`
), ),
blockIcon: ({ blocking }) => blocking ? '#fa-unlock' : '#fa-ban', blockIcon: ({ blocking }) => blocking ? '#fa-unlock' : '#fa-ban',
muteLabel: ({ muting, acct }) => ( muteLabel: ({ muting, username }) => (
muting ? `Unmute @${acct}` : `Mute @${acct}` muting ? `Unmute @${username}` : `Mute @${username}`
), ),
muteIcon: ({ muting }) => muting ? '#fa-volume-up' : '#fa-volume-off', muteIcon: ({ muting }) => muting ? '#fa-volume-up' : '#fa-volume-off',
isUser: ({ accountId, verifyCredentialsId }) => accountId === verifyCredentialsId, isUser: ({ accountId, verifyCredentialsId }) => accountId === verifyCredentialsId,
@ -61,10 +62,10 @@ export default {
// end copypasta (StatusOptionsDialog.html / AccountProfileOptionsDialog.html) // end copypasta (StatusOptionsDialog.html / AccountProfileOptionsDialog.html)
// //
showingReblogs: ({ relationship }) => relationship ? relationship.showing_reblogs : true, showingReblogs: ({ relationship }) => relationship ? relationship.showing_reblogs : true,
showReblogsLabel: ({ showingReblogs, acct }) => ( showReblogsLabel: ({ showingReblogs, username }) => (
showingReblogs showingReblogs
? `Hide boosts from @${acct}` ? `Hide boosts from @${username}`
: `Show boosts from @${acct}` : `Show boosts from @${username}`
), ),
domain: ({ acct }) => acct.split('@')[1], domain: ({ acct }) => acct.split('@')[1],
blockingDomain: ({ relationship }) => relationship && relationship.domain_blocking, blockingDomain: ({ relationship }) => relationship && relationship.domain_blocking,
@ -73,16 +74,16 @@ export default {
? `Unhide ${domain}` ? `Unhide ${domain}`
: `Hide ${domain}` : `Hide ${domain}`
), ),
reportLabel: ({ acct }) => `Report @${acct}`, reportLabel: ({ username }) => `Report @${username}`,
items: ({ items: ({
blockLabel, blocking, blockIcon, muteLabel, muteIcon, blockLabel, blocking, blockIcon, muteLabel, muteIcon,
followLabel, followIcon, following, followRequested, followLabel, followIcon, following, followRequested,
accountId, verifyCredentialsId, acct, isUser, showReblogsLabel, accountId, verifyCredentialsId, username, isUser, showReblogsLabel,
domain, blockDomainLabel, reportLabel domain, blockDomainLabel, reportLabel
}) => ([ }) => ([
!isUser && { !isUser && {
key: 'mention', key: 'mention',
label: `Mention @${acct}`, label: `Mention @${username}`,
icon: '#fa-comments' icon: '#fa-comments'
}, },
!isUser && !blocking && { !isUser && !blocking && {

View file

@ -48,26 +48,26 @@ export default {
following: ({ relationship }) => relationship && relationship.following, following: ({ relationship }) => relationship && relationship.following,
followRequested: ({ relationship }) => relationship && relationship.requested, followRequested: ({ relationship }) => relationship && relationship.requested,
accountId: ({ account }) => account && account.id, accountId: ({ account }) => account && account.id,
acct: ({ account }) => account.acct, username: ({ account }) => account.username,
muting: ({ relationship }) => relationship.muting, muting: ({ relationship }) => relationship.muting,
blocking: ({ relationship }) => relationship.blocking, blocking: ({ relationship }) => relationship.blocking,
followLabel: ({ following, followRequested, account, acct }) => { followLabel: ({ following, followRequested, account, username }) => {
if (typeof following === 'undefined' || !account) { if (typeof following === 'undefined' || !account) {
return '' return ''
} }
return (following || followRequested) return (following || followRequested)
? `Unfollow @${acct}` ? `Unfollow @${username}`
: `Follow @${acct}` : `Follow @${username}`
}, },
followIcon: ({ following, followRequested }) => ( followIcon: ({ following, followRequested }) => (
following ? '#fa-user-times' : followRequested ? '#fa-hourglass' : '#fa-user-plus' following ? '#fa-user-times' : followRequested ? '#fa-hourglass' : '#fa-user-plus'
), ),
blockLabel: ({ blocking, acct }) => ( blockLabel: ({ blocking, username }) => (
blocking ? `Unblock @${acct}` : `Block @${acct}` blocking ? `Unblock @${username}` : `Block @${username}`
), ),
blockIcon: ({ blocking }) => blocking ? '#fa-unlock' : '#fa-ban', blockIcon: ({ blocking }) => blocking ? '#fa-unlock' : '#fa-ban',
muteLabel: ({ muting, acct }) => ( muteLabel: ({ muting, username }) => (
muting ? `Unmute @${acct}` : `Mute @${acct}` muting ? `Unmute @${username}` : `Mute @${username}`
), ),
muteIcon: ({ muting }) => muting ? '#fa-volume-up' : '#fa-volume-off', muteIcon: ({ muting }) => muting ? '#fa-volume-up' : '#fa-volume-off',
isUser: ({ accountId, verifyCredentialsId }) => accountId === verifyCredentialsId, isUser: ({ accountId, verifyCredentialsId }) => accountId === verifyCredentialsId,