mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
commit
b514998dc1
@ -4,6 +4,24 @@ import 'packs/public-path';
|
|||||||
import { delegate } from '@rails/ujs';
|
import { delegate } from '@rails/ujs';
|
||||||
import ready from '../mastodon/ready';
|
import ready from '../mastodon/ready';
|
||||||
|
|
||||||
|
const setAnnouncementEndsAttributes = (target) => {
|
||||||
|
const valid = target?.value && target?.validity?.valid;
|
||||||
|
const element = document.querySelector('input[type="datetime-local"]#announcement_ends_at');
|
||||||
|
if (valid) {
|
||||||
|
element.classList.remove('optional');
|
||||||
|
element.required = true;
|
||||||
|
element.min = target.value;
|
||||||
|
} else {
|
||||||
|
element.classList.add('optional');
|
||||||
|
element.removeAttribute('required');
|
||||||
|
element.removeAttribute('min');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
delegate(document, 'input[type="datetime-local"]#announcement_starts_at', 'change', ({ target }) => {
|
||||||
|
setAnnouncementEndsAttributes(target);
|
||||||
|
});
|
||||||
|
|
||||||
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
|
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
|
||||||
|
|
||||||
const showSelectAll = () => {
|
const showSelectAll = () => {
|
||||||
@ -143,6 +161,20 @@ const onChangeRegistrationMode = (target) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const convertUTCDateTimeToLocal = (value) => {
|
||||||
|
const date = new Date(value + 'Z');
|
||||||
|
const twoChars = (x) => (x.toString().padStart(2, '0'));
|
||||||
|
return `${date.getFullYear()}-${twoChars(date.getMonth()+1)}-${twoChars(date.getDate())}T${twoChars(date.getHours())}:${twoChars(date.getMinutes())}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const convertLocalDatetimeToUTC = (value) => {
|
||||||
|
const re = /^([0-9]{4,})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})/;
|
||||||
|
const match = re.exec(value);
|
||||||
|
const date = new Date(match[1], match[2] - 1, match[3], match[4], match[5]);
|
||||||
|
const fullISO8601 = date.toISOString();
|
||||||
|
return fullISO8601.slice(0, fullISO8601.indexOf('T') + 6);
|
||||||
|
};
|
||||||
|
|
||||||
delegate(document, '#form_admin_settings_registrations_mode', 'change', ({ target }) => onChangeRegistrationMode(target));
|
delegate(document, '#form_admin_settings_registrations_mode', 'change', ({ target }) => onChangeRegistrationMode(target));
|
||||||
|
|
||||||
ready(() => {
|
ready(() => {
|
||||||
@ -170,4 +202,26 @@ ready(() => {
|
|||||||
e.target.href = url;
|
e.target.href = url;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[].forEach.call(document.querySelectorAll('input[type="datetime-local"]'), element => {
|
||||||
|
if (element.value) {
|
||||||
|
element.value = convertUTCDateTimeToLocal(element.value);
|
||||||
|
}
|
||||||
|
if (element.placeholder) {
|
||||||
|
element.placeholder = convertUTCDateTimeToLocal(element.placeholder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
delegate(document, 'form', 'submit', ({ target }) => {
|
||||||
|
[].forEach.call(target.querySelectorAll('input[type="datetime-local"]'), element => {
|
||||||
|
if (element.value && element.validity.valid) {
|
||||||
|
element.value = convertLocalDatetimeToUTC(element.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const announcementStartsAt = document.querySelector('input[type="datetime-local"]#announcement_starts_at');
|
||||||
|
if (announcementStartsAt) {
|
||||||
|
setAnnouncementEndsAttributes(announcementStartsAt);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -56,7 +56,6 @@ export const ImmutableHashtag = ({ hashtag }) => (
|
|||||||
href={hashtag.get('url')}
|
href={hashtag.get('url')}
|
||||||
to={`/tags/${hashtag.get('name')}`}
|
to={`/tags/${hashtag.get('name')}`}
|
||||||
people={hashtag.getIn(['history', 0, 'accounts']) * 1 + hashtag.getIn(['history', 1, 'accounts']) * 1}
|
people={hashtag.getIn(['history', 0, 'accounts']) * 1 + hashtag.getIn(['history', 1, 'accounts']) * 1}
|
||||||
uses={hashtag.getIn(['history', 0, 'uses']) * 1 + hashtag.getIn(['history', 1, 'uses']) * 1}
|
|
||||||
history={hashtag.get('history').reverse().map((day) => day.get('uses')).toArray()}
|
history={hashtag.get('history').reverse().map((day) => day.get('uses')).toArray()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@ import { domain } from 'mastodon/initial_state';
|
|||||||
import { fetchServer } from 'mastodon/actions/server';
|
import { fetchServer } from 'mastodon/actions/server';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
closed_registrations_message: state.getIn(['server', 'server', 'registrations', 'closed_registrations_message']),
|
message: state.getIn(['server', 'server', 'registrations', 'message']),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default @connect(mapStateToProps)
|
export default @connect(mapStateToProps)
|
||||||
@ -20,11 +20,11 @@ class ClosedRegistrationsModal extends ImmutablePureComponent {
|
|||||||
render () {
|
render () {
|
||||||
let closedRegistrationsMessage;
|
let closedRegistrationsMessage;
|
||||||
|
|
||||||
if (this.props.closed_registrations_message) {
|
if (this.props.message) {
|
||||||
closedRegistrationsMessage = (
|
closedRegistrationsMessage = (
|
||||||
<p
|
<p
|
||||||
className='prose'
|
className='prose'
|
||||||
dangerouslySetInnerHTML={{ __html: this.props.closed_registrations_message }}
|
dangerouslySetInnerHTML={{ __html: this.props.message }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -279,11 +279,12 @@
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
|
padding: 0 4px 0 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__counter {
|
&__counter {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 14px;
|
width: auto;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@ -7277,6 +7278,7 @@ noscript {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-bottom: 1px solid lighten($ui-base-color, 8%);
|
border-bottom: 1px solid lighten($ui-base-color, 8%);
|
||||||
|
gap: 15px;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
@ -7318,8 +7320,6 @@ noscript {
|
|||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding-right: 15px;
|
|
||||||
margin-left: 5px;
|
|
||||||
color: $secondary-text-color;
|
color: $secondary-text-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
@ -404,6 +404,7 @@ code {
|
|||||||
input[type="email"],
|
input[type="email"],
|
||||||
input[type="password"],
|
input[type="password"],
|
||||||
input[type="url"],
|
input[type="url"],
|
||||||
|
input[type="datetime-local"],
|
||||||
textarea {
|
textarea {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@ -444,7 +445,8 @@ code {
|
|||||||
input[type="text"],
|
input[type="text"],
|
||||||
input[type="number"],
|
input[type="number"],
|
||||||
input[type="email"],
|
input[type="email"],
|
||||||
input[type="password"] {
|
input[type="password"],
|
||||||
|
input[type="datetime-local"] {
|
||||||
&:focus:invalid:not(:placeholder-shown),
|
&:focus:invalid:not(:placeholder-shown),
|
||||||
&:required:invalid:not(:placeholder-shown) {
|
&:required:invalid:not(:placeholder-shown) {
|
||||||
border-color: lighten($error-red, 12%);
|
border-color: lighten($error-red, 12%);
|
||||||
@ -460,6 +462,7 @@ code {
|
|||||||
input[type="number"],
|
input[type="number"],
|
||||||
input[type="email"],
|
input[type="email"],
|
||||||
input[type="password"],
|
input[type="password"],
|
||||||
|
input[type="datetime-local"],
|
||||||
textarea,
|
textarea,
|
||||||
select {
|
select {
|
||||||
border-color: lighten($error-red, 12%);
|
border-color: lighten($error-red, 12%);
|
||||||
|
@ -31,7 +31,6 @@ class Announcement < ApplicationRecord
|
|||||||
validates :starts_at, presence: true, if: -> { ends_at.present? }
|
validates :starts_at, presence: true, if: -> { ends_at.present? }
|
||||||
validates :ends_at, presence: true, if: -> { starts_at.present? }
|
validates :ends_at, presence: true, if: -> { starts_at.present? }
|
||||||
|
|
||||||
before_validation :set_all_day
|
|
||||||
before_validation :set_published, on: :create
|
before_validation :set_published, on: :create
|
||||||
|
|
||||||
def to_log_human_identifier
|
def to_log_human_identifier
|
||||||
@ -89,10 +88,6 @@ class Announcement < ApplicationRecord
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_all_day
|
|
||||||
self.all_day = false if starts_at.blank? || ends_at.blank?
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_published
|
def set_published
|
||||||
return unless scheduled_at.blank? || scheduled_at.past?
|
return unless scheduled_at.blank? || scheduled_at.past?
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
= render 'shared/error_messages', object: @announcement
|
= render 'shared/error_messages', object: @announcement
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :starts_at, include_blank: true, wrapper: :with_block_label
|
= f.input :starts_at, include_blank: true, wrapper: :with_block_label, html5: true, input_html: { pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}){1,2}', placeholder: Time.now.strftime('%FT%R') }
|
||||||
= f.input :ends_at, include_blank: true, wrapper: :with_block_label
|
= f.input :ends_at, include_blank: true, wrapper: :with_block_label, html5: true, input_html: { pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}){1,2}', placeholder: Time.now.strftime('%FT%R') }
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :all_day, as: :boolean, wrapper: :with_label
|
= f.input :all_day, as: :boolean, wrapper: :with_label
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
= render 'shared/error_messages', object: @announcement
|
= render 'shared/error_messages', object: @announcement
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :starts_at, include_blank: true, wrapper: :with_block_label
|
= f.input :starts_at, include_blank: true, wrapper: :with_block_label, html5: true, input_html: { pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}){1,2}', placeholder: Time.now.strftime('%FT%R') }
|
||||||
= f.input :ends_at, include_blank: true, wrapper: :with_block_label
|
= f.input :ends_at, include_blank: true, wrapper: :with_block_label, html5: true, input_html: { pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}){1,2}', placeholder: Time.now.strftime('%FT%R') }
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :all_day, as: :boolean, wrapper: :with_label
|
= f.input :all_day, as: :boolean, wrapper: :with_label
|
||||||
@ -15,7 +15,7 @@
|
|||||||
= f.input :text, wrapper: :with_block_label
|
= f.input :text, wrapper: :with_block_label
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :scheduled_at, include_blank: true, wrapper: :with_block_label
|
= f.input :scheduled_at, include_blank: true, wrapper: :with_block_label, html5: true, input_html: { pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}){1,2}', placeholder: Time.now.strftime('%FT%R') }
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('.create'), type: :submit
|
= f.button :button, t('.create'), type: :submit
|
||||||
|
@ -24,6 +24,9 @@ data:
|
|||||||
{{- if .Values.mastodon.web_domain }}
|
{{- if .Values.mastodon.web_domain }}
|
||||||
WEB_DOMAIN: {{ .Values.mastodon.web_domain }}
|
WEB_DOMAIN: {{ .Values.mastodon.web_domain }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.mastodon.singleUserMode }}
|
||||||
|
SINGLE_USER_MODE: "true"
|
||||||
|
{{- end }}
|
||||||
# https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior
|
# https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior
|
||||||
MALLOC_ARENA_MAX: "2"
|
MALLOC_ARENA_MAX: "2"
|
||||||
NODE_ENV: "production"
|
NODE_ENV: "production"
|
||||||
|
@ -59,7 +59,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -76,7 +76,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -44,7 +44,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -62,7 +62,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -60,7 +60,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -61,7 +61,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -66,7 +66,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -60,7 +60,7 @@ spec:
|
|||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ template "mastodon.postgresql.secretName" . }}
|
name: {{ template "mastodon.postgresql.secretName" . }}
|
||||||
key: password
|
key: postgresql-password
|
||||||
- name: "REDIS_PASSWORD"
|
- name: "REDIS_PASSWORD"
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
@ -30,6 +30,8 @@ mastodon:
|
|||||||
# Use of WEB_DOMAIN requires careful consideration: https://docs.joinmastodon.org/admin/config/#federation
|
# Use of WEB_DOMAIN requires careful consideration: https://docs.joinmastodon.org/admin/config/#federation
|
||||||
# You must redirect the path LOCAL_DOMAIN/.well-known/ to WEB_DOMAIN/.well-known/ as described
|
# You must redirect the path LOCAL_DOMAIN/.well-known/ to WEB_DOMAIN/.well-known/ as described
|
||||||
# web_domain: mastodon.example.com
|
# web_domain: mastodon.example.com
|
||||||
|
# If set to true, the frontpage of your Mastodon server will always redirect to the first profile in the database and registrations will be disabled.
|
||||||
|
singleUserMode: false
|
||||||
persistence:
|
persistence:
|
||||||
assets:
|
assets:
|
||||||
# ReadWriteOnce is more widely supported than ReadWriteMany, but limits
|
# ReadWriteOnce is more widely supported than ReadWriteMany, but limits
|
||||||
|
Loading…
Reference in New Issue
Block a user