Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Haelwenn
glitchsoc-fe
Commits
7ac9c595
Verified
Commit
7ac9c595
authored
Jun 04, 2018
by
Haelwenn
Browse files
Revert "Enable custom emojis in profiles (notes, field values, display names) (#7374)"
This reverts commit
61a90186
.
parent
a69b492b
Changes
17
Hide whitespace changes
Inline
Side-by-side
app/helpers/stream_entries_helper.rb
View file @
7ac9c595
...
...
@@ -5,11 +5,7 @@ module StreamEntriesHelper
EMBEDDED_ACTION
=
'embed'
def
display_name
(
account
,
**
options
)
if
options
[
:custom_emojify
]
Formatter
.
instance
.
format_display_name
(
account
,
options
)
else
account
.
display_name
.
presence
||
account
.
username
end
account
.
display_name
.
presence
||
account
.
username
end
def
account_description
(
account
)
...
...
app/javascript/mastodon/actions/importer/normalizer.js
View file @
7ac9c595
...
...
@@ -4,25 +4,18 @@ import { unescapeHTML } from '../../utils/html';
const
domParser
=
new
DOMParser
();
const
makeEmojiMap
=
record
=>
record
.
emojis
.
reduce
((
obj
,
emoji
)
=>
{
obj
[
`:
${
emoji
.
shortcode
}
:`
]
=
emoji
;
return
obj
;
},
{});
export
function
normalizeAccount
(
account
)
{
account
=
{
...
account
};
const
emojiMap
=
makeEmojiMap
(
account
);
const
displayName
=
account
.
display_name
.
length
===
0
?
account
.
username
:
account
.
display_name
;
account
.
display_name_html
=
emojify
(
escapeTextContentForBrowser
(
displayName
),
emojiMap
);
account
.
note_emojified
=
emojify
(
account
.
note
,
emojiMap
);
account
.
display_name_html
=
emojify
(
escapeTextContentForBrowser
(
displayName
));
account
.
note_emojified
=
emojify
(
account
.
note
);
if
(
account
.
fields
)
{
account
.
fields
=
account
.
fields
.
map
(
pair
=>
({
...
pair
,
name_emojified
:
emojify
(
escapeTextContentForBrowser
(
pair
.
name
)),
value_emojified
:
emojify
(
pair
.
value
,
emojiMap
),
value_emojified
:
emojify
(
pair
.
value
),
value_plain
:
unescapeHTML
(
pair
.
value
),
}));
}
...
...
@@ -51,7 +44,11 @@ export function normalizeStatus(status, normalOldStatus) {
normalStatus
.
hidden
=
normalOldStatus
.
get
(
'
hidden
'
);
}
else
{
const
searchContent
=
[
status
.
spoiler_text
,
status
.
content
].
join
(
'
\n\n
'
).
replace
(
/<br
\s
*
\/?
>/g
,
'
\n
'
).
replace
(
/<
\/
p><p>/g
,
'
\n\n
'
);
const
emojiMap
=
makeEmojiMap
(
normalStatus
);
const
emojiMap
=
normalStatus
.
emojis
.
reduce
((
obj
,
emoji
)
=>
{
obj
[
`:
${
emoji
.
shortcode
}
:`
]
=
emoji
;
return
obj
;
},
{});
normalStatus
.
search_index
=
domParser
.
parseFromString
(
searchContent
,
'
text/html
'
).
documentElement
.
textContent
;
normalStatus
.
contentHtml
=
emojify
(
normalStatus
.
content
,
emojiMap
);
...
...
app/lib/formatter.rb
View file @
7ac9c595
...
...
@@ -67,17 +67,9 @@ class Formatter
html
.
html_safe
# rubocop:disable Rails/OutputSafety
end
def
format_display_name
(
account
,
**
options
)
html
=
encode
(
account
.
display_name
.
presence
||
account
.
username
)
html
=
encode_custom_emojis
(
html
,
account
.
emojis
)
if
options
[
:custom_emojify
]
html
.
html_safe
# rubocop:disable Rails/OutputSafety
end
def
format_field
(
account
,
str
,
**
options
)
def
format_field
(
account
,
str
)
return
reformat
(
str
).
html_safe
unless
account
.
local?
# rubocop:disable Rails/OutputSafety
html
=
encode_and_link_urls
(
str
,
me:
true
)
html
=
encode_custom_emojis
(
html
,
account
.
emojis
)
if
options
[
:custom_emojify
]
html
.
html_safe
# rubocop:disable Rails/OutputSafety
encode_and_link_urls
(
str
,
me:
true
).
html_safe
# rubocop:disable Rails/OutputSafety
end
def
linkify
(
text
)
...
...
app/models/account.rb
View file @
7ac9c595
...
...
@@ -413,7 +413,7 @@ class Account < ApplicationRecord
end
def
emojis
@emojis
||=
CustomEmoji
.
from_text
(
emojifiable_text
,
domain
)
@emojis
||=
CustomEmoji
.
from_text
(
note
,
domain
)
end
before_create
:generate_keys
...
...
@@ -456,8 +456,4 @@ class Account < ApplicationRecord
self
.
domain
=
TagManager
.
instance
.
normalize_domain
(
domain
)
end
def
emojifiable_text
[
note
,
display_name
,
fields
.
map
(
&
:value
)].
join
(
' '
)
end
end
app/serializers/rest/account_serializer.rb
View file @
7ac9c595
...
...
@@ -8,7 +8,6 @@ class REST::AccountSerializer < ActiveModel::Serializer
:followers_count
,
:following_count
,
:statuses_count
has_one
:moved_to_account
,
key: :moved
,
serializer:
REST
::
AccountSerializer
,
if: :moved_and_not_nested?
has_many
:emojis
,
serializer:
REST
::
CustomEmojiSerializer
class
FieldSerializer
<
ActiveModel
::
Serializer
attributes
:name
,
:value
...
...
app/views/about/_administration.html.haml
View file @
7ac9c595
...
...
@@ -6,7 +6,7 @@
.account__avatar
{
style:
"background-image: url(#{@instance_presenter.contact_account.avatar.url})"
}
%span
.display-name
%bdi
%strong
.display-name__html.emojify
=
display_name
(
@instance_presenter
.
contact_account
,
custom_emojify:
true
)
%strong
.display-name__html.emojify
=
display_name
(
@instance_presenter
.
contact_account
)
%span
.display-name__account
@
#{
@instance_presenter
.
contact_account
.
acct
}
-
else
.account__display-name
...
...
app/views/about/_contact.html.haml
View file @
7ac9c595
...
...
@@ -12,7 +12,7 @@
.avatar
=
image_tag
contact
.
contact_account
.
avatar
.
url
.name
=
link_to
TagManager
.
instance
.
url_for
(
contact
.
contact_account
)
do
%span
.display_name.emojify
=
display_name
(
contact
.
contact_account
,
custom_emojify:
true
)
%span
.display_name.emojify
=
display_name
(
contact
.
contact_account
)
%span
.username
@
#{
contact
.
contact_account
.
acct
}
-
else
.owner
...
...
app/views/accounts/_grid_card.html.haml
View file @
7ac9c595
...
...
@@ -5,7 +5,7 @@
.avatar
=
image_tag
account
.
avatar
.
url
(
:original
)
.name
=
link_to
TagManager
.
instance
.
url_for
(
account
)
do
%span
.display_name.emojify
=
display_name
(
account
,
custom_emojify:
true
)
%span
.display_name.emojify
=
display_name
(
account
)
%span
.username
@
#{
account
.
local?
?
account
.
local_username_and_domain
:
account
.
acct
}
=
fa_icon
(
'lock'
)
if
account
.
locked?
...
...
app/views/accounts/_header.html.haml
View file @
7ac9c595
...
...
@@ -6,7 +6,7 @@
.card__bio
%h1
.name
%span
.p-name.emojify
=
display_name
(
account
,
custom_emojify:
true
)
%span
.p-name.emojify
=
display_name
(
account
)
%small<
%span
><
@
#{
account
.
local_username_and_domain
}
=
fa_icon
(
'lock'
)
if
account
.
locked?
...
...
app/views/accounts/_moved_strip.html.haml
View file @
7ac9c595
...
...
@@ -3,7 +3,7 @@
.moved-strip
.moved-strip__message
=
fa_icon
'suitcase'
=
t
(
'accounts.moved_html'
,
name:
content_tag
(
:strong
,
display_name
(
account
,
custom_emojify:
true
),
class: :emojify
),
new_profile_link:
link_to
(
content_tag
(
:strong
,
safe_join
([
'@'
,
content_tag
(
:span
,
moved_to_account
.
acct
)])),
TagManager
.
instance
.
url_for
(
moved_to_account
),
class:
'mention'
))
=
t
(
'accounts.moved_html'
,
name:
content_tag
(
:strong
,
display_name
(
account
),
class: :emojify
),
new_profile_link:
link_to
(
content_tag
(
:strong
,
safe_join
([
'@'
,
content_tag
(
:span
,
moved_to_account
.
acct
)])),
TagManager
.
instance
.
url_for
(
moved_to_account
),
class:
'mention'
))
.moved-strip__card
=
link_to
TagManager
.
instance
.
url_for
(
moved_to_account
),
class:
'detailed-status__display-name p-author h-card'
,
target:
'_blank'
,
rel:
'noopener'
do
...
...
@@ -13,5 +13,5 @@
.account__avatar-overlay-overlay
{
style:
"background-image: url('#{account.avatar.url(:original)}')"
}
%span
.display-name
%strong
.emojify
=
display_name
(
moved_to_account
,
custom_emojify:
true
)
%strong
.emojify
=
display_name
(
moved_to_account
)
%span
@
#{
moved_to_account
.
acct
}
app/views/admin/reports/_account.html.haml
View file @
7ac9c595
...
...
@@ -15,5 +15,5 @@
.account__avatar
{
style:
"background-image: url(#{account.avatar.url}); width: #{size}px; height: #{size}px; background-size: #{size}px #{size}px"
}
%span
.display-name
%bdi
%strong
.display-name__html.emojify
=
display_name
(
account
,
custom_emojify:
true
)
%strong
.display-name__html.emojify
=
display_name
(
account
)
%span
.display-name__account
@
#{
account
.
acct
}
app/views/authorize_follows/_card.html.haml
View file @
7ac9c595
...
...
@@ -6,7 +6,7 @@
%span
.display-name
-
account_url
=
local_assigns
[
:admin
]
?
admin_account_path
(
account
.
id
)
:
TagManager
.
instance
.
url_for
(
account
)
=
link_to
account_url
,
class:
'detailed-status__display-name p-author h-card'
,
target:
'_blank'
,
rel:
'noopener'
do
%strong
.emojify
=
display_name
(
account
,
custom_emojify:
true
)
%strong
.emojify
=
display_name
(
account
)
%span
@
#{
account
.
acct
}
-
if
account
.
note?
...
...
app/views/remote_unfollows/_card.html.haml
View file @
7ac9c595
...
...
@@ -6,7 +6,7 @@
%span
.display-name
-
account_url
=
local_assigns
[
:admin
]
?
admin_account_path
(
account
.
id
)
:
TagManager
.
instance
.
url_for
(
account
)
=
link_to
account_url
,
class:
'detailed-status__display-name p-author h-card'
,
target:
'_blank'
,
rel:
'noopener'
do
%strong
.emojify
=
display_name
(
account
,
custom_emojify:
true
)
%strong
.emojify
=
display_name
(
account
)
%span
@
#{
account
.
acct
}
-
if
account
.
note?
...
...
app/views/shared/_landing_strip.html.haml
View file @
7ac9c595
...
...
@@ -2,7 +2,7 @@
=
image_tag
asset_pack_path
(
'logo.svg'
),
class:
'logo'
%div
=
t
(
'landing_strip_html'
,
name:
content_tag
(
:span
,
display_name
(
account
,
custom_emojify:
true
),
class: :emojify
),
link_to_root_path:
link_to
(
content_tag
(
:strong
,
site_hostname
),
root_path
))
=
t
(
'landing_strip_html'
,
name:
content_tag
(
:span
,
display_name
(
account
),
class: :emojify
),
link_to_root_path:
link_to
(
content_tag
(
:strong
,
site_hostname
),
root_path
))
-
if
open_registrations?
=
t
(
'landing_strip_signup_html'
,
sign_up_path:
new_user_registration_path
)
app/views/stream_entries/_detailed_status.html.haml
View file @
7ac9c595
...
...
@@ -4,7 +4,7 @@
.avatar
=
image_tag
status
.
account
.
avatar
.
url
(
:original
),
width:
48
,
height:
48
,
alt:
''
,
class:
'u-photo'
%span
.display-name
%strong
.p-name.emojify
=
display_name
(
status
.
account
,
custom_emojify:
true
)
%strong
.p-name.emojify
=
display_name
(
status
.
account
)
%span
=
acct
(
status
.
account
)
-
if
embedded_view?
...
...
app/views/stream_entries/_simple_status.html.haml
View file @
7ac9c595
...
...
@@ -10,7 +10,7 @@
%div
=
image_tag
status
.
account
.
avatar
(
:original
),
width:
48
,
height:
48
,
alt:
''
,
class:
'u-photo'
%span
.display-name
%strong
.p-name.emojify
=
display_name
(
status
.
account
,
custom_emojify:
true
)
%strong
.p-name.emojify
=
display_name
(
status
.
account
)
%span
=
acct
(
status
.
account
)
.status__content.p-name.emojify
<
...
...
app/views/stream_entries/_status.html.haml
View file @
7ac9c595
...
...
@@ -28,7 +28,7 @@
=
fa_icon
(
'retweet fw'
)
%span
=
link_to
TagManager
.
instance
.
url_for
(
status
.
account
),
class:
'status__display-name muted'
do
%strong
.emojify
=
display_name
(
status
.
account
,
custom_emojify:
true
)
%strong
.emojify
=
display_name
(
status
.
account
)
=
t
(
'stream_entries.reblogged'
)
-
elsif
pinned
.pre-header
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment