Skip to content

Commit f4d549d

Browse files
authored
Redesign forms, verify link ownership with rel="me" (mastodon#8703)
* Verify link ownership with rel="me" * Add explanation about verification to UI * Perform link verifications * Add click-to-copy widget for verification HTML * Redesign edit profile page * Redesign forms * Improve responsive design of settings pages * Restore landing page sign-up form * Fix typo * Support <link> tags, add spec * Fix links not being verified on first discovery and passive updates
1 parent f8b54d2 commit f4d549d

46 files changed

Lines changed: 756 additions & 305 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/helpers/home_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,12 @@ def obscured_counter(count)
4848
'1+'
4949
end
5050
end
51+
52+
def custom_field_classes(field)
53+
if field.verified?
54+
'verified'
55+
else
56+
'emojify'
57+
end
58+
end
5159
end

app/javascript/mastodon/features/account/components/header.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ const messages = defineMessages({
1515
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
1616
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
1717
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
18+
linkVerifiedOn: { id: 'account.link_verified_on', defaultMessage: 'Ownership of this link was checked on {date}' },
1819
});
1920

21+
const dateFormatOptions = {
22+
month: 'short',
23+
day: 'numeric',
24+
year: 'numeric',
25+
hour12: false,
26+
hour: '2-digit',
27+
minute: '2-digit',
28+
};
29+
2030
class Avatar extends ImmutablePureComponent {
2131

2232
static propTypes = {
@@ -163,7 +173,10 @@ class Header extends ImmutablePureComponent {
163173
{fields.map((pair, i) => (
164174
<dl key={i}>
165175
<dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} />
166-
<dd dangerouslySetInnerHTML={{ __html: pair.get('value_emojified') }} title={pair.get('value_plain')} />
176+
177+
<dd className={pair.get('verified_at') && 'verified'} title={pair.get('value_plain')}>
178+
{pair.get('verified_at') && <span title={intl.formatMessage(messages.linkVerifiedOn, { date: intl.formatDate(pair.get('verified_at'), dateFormatOptions) })}><i className='fa fa-check verified__mark' /></span>} <span dangerouslySetInnerHTML={{ __html: pair.get('value_emojified') }} />
179+
</dd>
167180
</dl>
168181
))}
169182
</div>

app/javascript/packs/public.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function main() {
6868
});
6969

7070
const reactComponents = document.querySelectorAll('[data-component]');
71+
7172
if (reactComponents.length > 0) {
7273
import(/* webpackChunkName: "containers/media_container" */ '../mastodon/containers/media_container')
7374
.then(({ default: MediaContainer }) => {
@@ -80,13 +81,15 @@ function main() {
8081
}
8182

8283
const parallaxComponents = document.querySelectorAll('.parallax');
84+
8385
if (parallaxComponents.length > 0 ) {
8486
new Rellax('.parallax', { speed: -1 });
8587
}
8688

8789
const history = createHistory();
8890
const detailedStatuses = document.querySelectorAll('.public-layout .detailed-status');
8991
const location = history.location;
92+
9093
if (detailedStatuses.length === 1 && (!location.state || !location.state.scrolledToDetailedStatus)) {
9194
detailedStatuses[0].scrollIntoView();
9295
history.replace(location.pathname, { ...location.state, scrolledToDetailedStatus: true });
@@ -175,6 +178,30 @@ function main() {
175178
lock.style.display = 'none';
176179
}
177180
});
181+
182+
delegate(document, '.input-copy input', 'click', ({ target }) => {
183+
target.select();
184+
});
185+
186+
delegate(document, '.input-copy button', 'click', ({ target }) => {
187+
const input = target.parentNode.querySelector('input');
188+
189+
input.focus();
190+
input.select();
191+
192+
try {
193+
if (document.execCommand('copy')) {
194+
input.blur();
195+
target.parentNode.classList.add('copied');
196+
197+
setTimeout(() => {
198+
target.parentNode.classList.remove('copied');
199+
}, 700);
200+
}
201+
} catch (err) {
202+
console.error(err);
203+
}
204+
});
178205
}
179206

180207
loadPolyfills().then(main).catch(error => {

app/javascript/styles/mastodon/accounts.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,20 @@
265265
}
266266
}
267267

268+
.verified {
269+
border: 1px solid rgba($valid-value-color, 0.5);
270+
background: rgba($valid-value-color, 0.25);
271+
272+
a {
273+
color: $valid-value-color;
274+
font-weight: 500;
275+
}
276+
277+
&__mark {
278+
color: $valid-value-color;
279+
}
280+
}
281+
268282
dl:last-child {
269283
border-bottom: 0;
270284
}

app/javascript/styles/mastodon/admin.scss

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$no-columns-breakpoint: 600px;
2+
13
.admin-wrapper {
24
display: flex;
35
justify-content: center;
@@ -24,12 +26,22 @@
2426
height: 100px;
2527
}
2628

29+
@media screen and (max-width: $no-columns-breakpoint) {
30+
& > a:first-child {
31+
display: none;
32+
}
33+
}
34+
2735
ul {
2836
list-style: none;
2937
border-radius: 4px 0 0 4px;
3038
overflow: hidden;
3139
margin-bottom: 20px;
3240

41+
@media screen and (max-width: $no-columns-breakpoint) {
42+
margin-bottom: 0;
43+
}
44+
3345
a {
3446
display: block;
3547
padding: 15px;
@@ -62,20 +74,24 @@
6274
a {
6375
border: 0;
6476
padding: 15px 35px;
77+
}
78+
}
6579

66-
&.selected {
67-
color: $primary-text-color;
68-
background-color: $ui-highlight-color;
69-
border-bottom: 0;
70-
border-radius: 0;
80+
.simple-navigation-active-leaf a {
81+
color: $primary-text-color;
82+
background-color: $ui-highlight-color;
83+
border-bottom: 0;
84+
border-radius: 0;
7185

72-
&:hover {
73-
background-color: lighten($ui-highlight-color, 5%);
74-
}
75-
}
86+
&:hover {
87+
background-color: lighten($ui-highlight-color, 5%);
7688
}
7789
}
7890
}
91+
92+
& > ul > .simple-navigation-active-leaf a {
93+
border-radius: 4px 0 0 4px;
94+
}
7995
}
8096

8197
.content-wrapper {
@@ -89,11 +105,19 @@
89105
padding-top: 60px;
90106
padding-left: 25px;
91107

108+
@media screen and (max-width: $no-columns-breakpoint) {
109+
max-width: none;
110+
padding: 15px;
111+
padding-top: 30px;
112+
}
113+
92114
h2 {
93115
color: $secondary-text-color;
94116
font-size: 24px;
95117
line-height: 28px;
96118
font-weight: 400;
119+
padding-bottom: 40px;
120+
border-bottom: 1px solid lighten($ui-base-color, 8%);
97121
margin-bottom: 40px;
98122
}
99123

@@ -108,7 +132,7 @@
108132
h4 {
109133
text-transform: uppercase;
110134
font-size: 13px;
111-
font-weight: 500;
135+
font-weight: 700;
112136
color: $darker-text-color;
113137
padding-bottom: 8px;
114138
margin-bottom: 8px;
@@ -122,6 +146,11 @@
122146
font-weight: 400;
123147
}
124148

149+
.fields-group h6 {
150+
color: $primary-text-color;
151+
font-weight: 500;
152+
}
153+
125154
& > p {
126155
font-size: 14px;
127156
line-height: 18px;
@@ -172,30 +201,7 @@
172201
}
173202
}
174203

175-
.simple_form {
176-
max-width: 400px;
177-
178-
&.edit_user,
179-
&.new_form_admin_settings,
180-
&.new_form_two_factor_confirmation,
181-
&.new_form_delete_confirmation,
182-
&.new_import,
183-
&.new_domain_block,
184-
&.edit_domain_block {
185-
max-width: none;
186-
}
187-
188-
.form_two_factor_confirmation_code,
189-
.form_delete_confirmation_password {
190-
max-width: 400px;
191-
}
192-
193-
.actions {
194-
max-width: 400px;
195-
}
196-
}
197-
198-
@media screen and (max-width: 600px) {
204+
@media screen and (max-width: $no-columns-breakpoint) {
199205
display: block;
200206
overflow-y: auto;
201207
-webkit-overflow-scrolling: touch;
@@ -209,16 +215,8 @@
209215

210216
.sidebar {
211217
width: 100%;
212-
padding: 10px 0;
218+
padding: 0;
213219
height: auto;
214-
215-
.logo {
216-
margin: 20px auto;
217-
}
218-
}
219-
220-
.content {
221-
padding-top: 20px;
222220
}
223221
}
224222
}

app/javascript/styles/mastodon/basics.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
@function hex-color($color) {
2+
@if type-of($color) == 'color' {
3+
$color: str-slice(ie-hex-str($color), 4);
4+
}
5+
@return '%23' + unquote($color)
6+
}
7+
18
body {
29
font-family: 'mastodon-font-sans-serif', sans-serif;
310
background: darken($ui-base-color, 8%);

app/javascript/styles/mastodon/boost.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
@function hex-color($color) {
2-
@if type-of($color) == 'color' {
3-
$color: str-slice(ie-hex-str($color), 4);
4-
}
5-
@return '%23' + unquote($color)
6-
}
7-
81
button.icon-button i.fa-retweet {
92
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='209'><path d='M4.97 3.16c-.1.03-.17.1-.22.18L.8 8.24c-.2.3.03.78.4.8H3.6v2.68c0 4.26-.55 3.62 3.66 3.62h7.66l-2.3-2.84c-.03-.02-.03-.04-.05-.06H7.27c-.44 0-.72-.3-.72-.72v-2.7h2.5c.37.03.63-.48.4-.77L5.5 3.35c-.12-.17-.34-.25-.53-.2zm12.16.43c-.55-.02-1.32.02-2.4.02H7.1l2.32 2.85.03.06h5.25c.42 0 .72.28.72.72v2.7h-2.5c-.36.02-.56.54-.3.8l3.92 4.9c.18.25.6.25.78 0l3.94-4.9c.26-.28 0-.83-.37-.8H18.4v-2.7c0-3.15.4-3.62-1.25-3.66z' fill='#{hex-color($action-button-color)}' stroke-width='0'/><path d='M7.78 19.66c-.24.02-.44.25-.44.5v2.46h-.06c-1.08 0-1.86-.03-2.4-.03-1.64 0-1.25.43-1.25 3.65v4.47c0 4.26-.56 3.62 3.65 3.62H8.5l-1.3-1.06c-.1-.08-.18-.2-.2-.3-.02-.17.06-.35.2-.45l1.33-1.1H7.28c-.44 0-.72-.3-.72-.7v-4.48c0-.44.28-.72.72-.72h.06v2.5c0 .38.54.63.82.38l4.9-3.93c.25-.18.25-.6 0-.78l-4.9-3.92c-.1-.1-.24-.14-.38-.12zm9.34 2.93c-.54-.02-1.3.02-2.4.02h-1.25l1.3 1.07c.1.07.18.2.2.33.02.16-.06.3-.2.4l-1.33 1.1h1.28c.42 0 .72.28.72.72v4.47c0 .42-.3.72-.72.72h-.1v-2.47c0-.3-.3-.53-.6-.47-.07 0-.14.05-.2.1l-4.9 3.93c-.26.18-.26.6 0 .78l4.9 3.92c.27.25.82 0 .8-.38v-2.5h.1c4.27 0 3.65.67 3.65-3.62v-4.47c0-3.15.4-3.62-1.25-3.66zM10.34 38.66c-.24.02-.44.25-.43.5v2.47H7.3c-1.08 0-1.86-.04-2.4-.04-1.64 0-1.25.43-1.25 3.65v4.47c0 3.66-.23 3.7 2.34 3.66l-1.34-1.1c-.1-.08-.18-.2-.2-.3 0-.17.07-.35.2-.45l1.96-1.6c-.03-.06-.04-.13-.04-.2v-4.48c0-.44.28-.72.72-.72H9.9v2.5c0 .36.5.6.8.38l4.93-3.93c.24-.18.24-.6 0-.78l-4.94-3.92c-.1-.08-.23-.13-.36-.12zm5.63 2.93l1.34 1.1c.1.07.18.2.2.33.02.16-.03.3-.16.4l-1.96 1.6c.02.07.06.13.06.22v4.47c0 .42-.3.72-.72.72h-2.66v-2.47c0-.3-.3-.53-.6-.47-.06.02-.12.05-.18.1l-4.94 3.93c-.24.18-.24.6 0 .78l4.94 3.92c.28.22.78-.02.78-.38v-2.5h2.66c4.27 0 3.65.67 3.65-3.62v-4.47c0-3.66.34-3.7-2.4-3.66zM13.06 57.66c-.23.03-.4.26-.4.5v2.47H7.28c-1.08 0-1.86-.04-2.4-.04-1.64 0-1.25.43-1.25 3.65v4.87l2.93-2.37v-2.5c0-.44.28-.72.72-.72h5.38v2.5c0 .36.5.6.78.38l4.94-3.93c.24-.18.24-.6 0-.78l-4.94-3.92c-.1-.1-.24-.14-.38-.12zm5.3 6.15l-2.92 2.4v2.52c0 .42-.3.72-.72.72h-5.4v-2.47c0-.3-.32-.53-.6-.47-.07.02-.13.05-.2.1L3.6 70.52c-.25.18-.25.6 0 .78l4.93 3.92c.28.22.78-.02.78-.38v-2.5h5.42c4.27 0 3.65.67 3.65-3.62v-4.47-.44zM19.25 78.8c-.1.03-.2.1-.28.17l-.9.9c-.44-.3-1.36-.25-3.35-.25H7.28c-1.08 0-1.86-.03-2.4-.03-1.64 0-1.25.43-1.25 3.65v.7l2.93.3v-1c0-.44.28-.72.72-.72h7.44c.2 0 .37.08.5.2l-1.8 1.8c-.25.26-.08.76.27.8l6.27.7c.28.03.56-.25.53-.53l-.7-6.25c0-.27-.3-.48-.55-.44zm-17.2 6.1c-.2.07-.36.3-.33.54l.7 6.25c.02.36.58.55.83.27l.8-.8c.02 0 .04-.02.04 0 .46.24 1.37.17 3.18.17h7.44c4.27 0 3.65.67 3.65-3.62v-.75l-2.93-.3v1.05c0 .42-.3.72-.72.72H7.28c-.15 0-.3-.03-.4-.1L8.8 86.4c.3-.24.1-.8-.27-.84l-6.28-.65h-.2zM4.88 98.6c-1.33 0-1.34.48-1.3 2.3l1.14-1.37c.08-.1.22-.17.34-.2.16 0 .34.08.44.2l1.66 2.03c.04 0 .07-.03.12-.03h7.44c.34 0 .57.2.65.5h-2.43c-.34.05-.53.52-.3.78l3.92 4.95c.18.24.6.24.78 0l3.94-4.94c.22-.27-.02-.76-.37-.77H18.4c.02-3.9.6-3.4-3.66-3.4H7.28c-1.08 0-1.86-.04-2.4-.04zm.15 2.46c-.1.03-.2.1-.28.2l-3.94 4.9c-.2.28.03.77.4.78H3.6c-.02 3.94-.45 3.4 3.66 3.4h7.44c3.65 0 3.74.3 3.7-2.25l-1.1 1.34c-.1.1-.2.17-.32.2-.16 0-.34-.08-.44-.2l-1.65-2.03c-.06.02-.1.04-.18.04H7.28c-.35 0-.57-.2-.66-.5h2.44c.37 0 .63-.5.4-.78l-3.96-4.9c-.1-.15-.3-.23-.47-.2zM4.88 117.6c-1.16 0-1.3.3-1.3 1.56l1.14-1.38c.08-.1.22-.14.34-.16.16 0 .34.04.44.16l2.22 2.75h7c.42 0 .72.28.72.72v.53h-2.6c-.3.1-.43.54-.2.78l3.92 4.9c.18.25.6.25.78 0l3.94-4.9c.22-.28-.02-.77-.37-.78H18.4v-.53c0-4.2.72-3.63-3.66-3.63H7.28c-1.08 0-1.86-.03-2.4-.03zm.1 1.74c-.1.03-.17.1-.23.16L.8 124.44c-.2.28.03.77.4.78H3.6v.5c0 4.26-.55 3.62 3.66 3.62h7.44c1.03 0 1.74.02 2.28 0-.16.02-.34-.03-.44-.15l-2.22-2.76H7.28c-.44 0-.72-.3-.72-.72v-.5h2.5c.37.02.63-.5.4-.78L5.5 119.5c-.12-.15-.34-.22-.53-.16zm12.02 10c1.2-.02 1.4-.25 1.4-1.53l-1.1 1.36c-.07.1-.17.17-.3.18zM5.94 136.6l2.37 2.93h6.42c.42 0 .72.28.72.72v1.25h-2.6c-.3.1-.43.54-.2.78l3.92 4.9c.18.25.6.25.78 0l3.94-4.9c.22-.28-.02-.77-.37-.78H18.4v-1.25c0-4.2.72-3.63-3.66-3.63H7.28c-.6 0-.92-.02-1.34-.03zm-1.72.06c-.4.08-.54.3-.6.75l.6-.74zm.84.93c-.12 0-.24.08-.3.18l-3.95 4.9c-.24.3 0 .83.4.82H3.6v1.22c0 4.26-.55 3.62 3.66 3.62h7.44c.63 0 .97.02 1.4.03l-2.37-2.93H7.28c-.44 0-.72-.3-.72-.72v-1.22h2.5c.4.04.67-.53.4-.8l-3.96-4.92c-.1-.13-.27-.2-.44-.2zm13.28 10.03l-.56.7c.36-.07.5-.3.56-.7zM17.13 155.6c-.55-.02-1.32.03-2.4.03h-8.2l2.38 2.9h5.82c.42 0 .72.28.72.72v1.97H12.9c-.32.06-.48.52-.28.78l3.94 4.94c.2.23.6.22.78-.03l3.94-4.9c.22-.28-.02-.77-.37-.78H18.4v-1.97c0-3.15.4-3.62-1.25-3.66zm-12.1.28c-.1.02-.2.1-.28.18l-3.94 4.9c-.2.3.03.78.4.8H3.6v1.96c0 4.26-.55 3.62 3.66 3.62h8.24l-2.36-2.9H7.28c-.44 0-.72-.3-.72-.72v-1.97h2.5c.37.02.63-.5.4-.78l-3.96-4.9c-.1-.15-.3-.22-.47-.2zM5.13 174.5c-.15 0-.3.07-.38.2L.8 179.6c-.24.27 0 .82.4.8H3.6v2.32c0 4.26-.55 3.62 3.66 3.62h7.94l-2.35-2.9h-5.6c-.43 0-.7-.3-.7-.72v-2.3h2.5c.38.03.66-.54.4-.83l-3.97-4.9c-.1-.13-.23-.2-.38-.2zm12 .1c-.55-.02-1.32.03-2.4.03H6.83l2.35 2.9h5.52c.42 0 .72.28.72.72v2.34h-2.6c-.3.1-.43.53-.2.78l3.92 4.9c.18.24.6.24.78 0l3.94-4.9c.22-.3-.02-.78-.37-.8H18.4v-2.33c0-3.15.4-3.62-1.25-3.66zM4.97 193.16c-.1.03-.17.1-.22.18l-3.94 4.9c-.2.3.03.78.4.8H3.6v2.68c0 4.26-.55 3.62 3.66 3.62h7.66l-2.3-2.84c-.03-.02-.03-.04-.05-.06H7.27c-.44 0-.72-.3-.72-.72v-2.7h2.5c.37.03.63-.48.4-.77l-3.96-4.9c-.12-.17-.34-.25-.53-.2zm12.16.43c-.55-.02-1.32.03-2.4.03H7.1l2.32 2.84.03.06h5.25c.42 0 .72.28.72.72v2.7h-2.5c-.36.02-.56.54-.3.8l3.92 4.9c.18.25.6.25.78 0l3.94-4.9c.26-.28 0-.83-.37-.8H18.4v-2.7c0-3.15.4-3.62-1.25-3.66z' fill='#{hex-color($highlight-text-color)}' stroke-width='0'/></svg>");
103

app/javascript/styles/mastodon/components.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5363,9 +5363,11 @@ noscript {
53635363
overflow: hidden;
53645364
margin: 20px -10px -20px;
53655365
border-bottom: 0;
5366+
border-top: 0;
53665367

53675368
dl {
5368-
border-top: 1px solid lighten($ui-base-color, 8%);
5369+
border-top: 1px solid lighten($ui-base-color, 4%);
5370+
border-bottom: 0;
53695371
display: flex;
53705372
}
53715373

@@ -5392,6 +5394,11 @@ noscript {
53925394
flex: 1 1 auto;
53935395
color: $primary-text-color;
53945396
background: $ui-base-color;
5397+
5398+
&.verified {
5399+
border: 1px solid rgba($valid-value-color, 0.5);
5400+
background: rgba($valid-value-color, 0.25);
5401+
}
53955402
}
53965403
}
53975404

app/javascript/styles/mastodon/containers.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,14 @@
718718
a {
719719
color: lighten($ui-highlight-color, 8%);
720720
}
721+
722+
dl:first-child .verified {
723+
border-radius: 0 4px 0 0;
724+
}
725+
726+
.verified a {
727+
color: $valid-value-color;
728+
}
721729
}
722730

723731
.account__header__content {

0 commit comments

Comments
 (0)