mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2025-01-17 00:24:05 +01:00
Merge remote-tracking branch 'upstream/main' into develop
This commit is contained in:
commit
27fdb81b65
13 changed files with 78 additions and 17 deletions
|
@ -228,7 +228,7 @@ class Status extends ImmutablePureComponent {
|
||||||
// - The user has decided to collapse all notifications ('muted'
|
// - The user has decided to collapse all notifications ('muted'
|
||||||
// statuses).
|
// statuses).
|
||||||
// - The user has decided to collapse long statuses and the status is
|
// - The user has decided to collapse long statuses and the status is
|
||||||
// over 400px (without media, or 650px with).
|
// over the user set value (default 400 without media, or 610px with).
|
||||||
// - The status is a reply and the user has decided to collapse all
|
// - The status is a reply and the user has decided to collapse all
|
||||||
// replies.
|
// replies.
|
||||||
// - The status contains media and the user has decided to collapse all
|
// - The status contains media and the user has decided to collapse all
|
||||||
|
@ -255,10 +255,15 @@ class Status extends ImmutablePureComponent {
|
||||||
// as it could cause surprising changes when receiving notifications
|
// as it could cause surprising changes when receiving notifications
|
||||||
if (settings.getIn(['content_warnings', 'shared_state']) && status.get('spoiler_text').length && !status.get('hidden')) return;
|
if (settings.getIn(['content_warnings', 'shared_state']) && status.get('spoiler_text').length && !status.get('hidden')) return;
|
||||||
|
|
||||||
|
let autoCollapseHeight = parseInt(autoCollapseSettings.get('height'));
|
||||||
|
if (status.get('media_attachments').size && !muted) {
|
||||||
|
autoCollapseHeight += 210;
|
||||||
|
}
|
||||||
|
|
||||||
if (collapse ||
|
if (collapse ||
|
||||||
autoCollapseSettings.get('all') ||
|
autoCollapseSettings.get('all') ||
|
||||||
(autoCollapseSettings.get('notifications') && muted) ||
|
(autoCollapseSettings.get('notifications') && muted) ||
|
||||||
(autoCollapseSettings.get('lengthy') && node.clientHeight > ((status.get('media_attachments').size && !muted) ? 650 : 400)) ||
|
(autoCollapseSettings.get('lengthy') && node.clientHeight > autoCollapseHeight) ||
|
||||||
(autoCollapseSettings.get('reblogs') && prepend === 'reblogged_by') ||
|
(autoCollapseSettings.get('reblogs') && prepend === 'reblogged_by') ||
|
||||||
(autoCollapseSettings.get('replies') && status.get('in_reply_to_id', null) !== null) ||
|
(autoCollapseSettings.get('replies') && status.get('in_reply_to_id', null) !== null) ||
|
||||||
(autoCollapseSettings.get('media') && !(status.get('spoiler_text').length) && status.get('media_attachments').size > 0)
|
(autoCollapseSettings.get('media') && !(status.get('spoiler_text').length) && status.get('media_attachments').size > 0)
|
||||||
|
|
|
@ -321,6 +321,11 @@ class Header extends ImmutablePureComponent {
|
||||||
badge = null;
|
badge = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let role = null;
|
||||||
|
if (account.getIn(['roles', 0])) {
|
||||||
|
role = (<div key='role' className={`account-role user-role-${account.getIn(['roles', 0, 'id'])}`}>{account.getIn(['roles', 0, 'name'])}</div>);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames('account__header', { inactive: !!account.get('moved') })} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
<div className={classNames('account__header', { inactive: !!account.get('moved') })} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
||||||
{!(suspended || hidden || account.get('moved')) && account.getIn(['relationship', 'requested_by']) && <FollowRequestNoteContainer account={account} />}
|
{!(suspended || hidden || account.get('moved')) && account.getIn(['relationship', 'requested_by']) && <FollowRequestNoteContainer account={account} />}
|
||||||
|
@ -337,6 +342,7 @@ class Header extends ImmutablePureComponent {
|
||||||
<div className='account__header__tabs'>
|
<div className='account__header__tabs'>
|
||||||
<a className='avatar' href={account.get('avatar')} rel='noopener noreferrer' target='_blank' onClick={this.handleAvatarClick}>
|
<a className='avatar' href={account.get('avatar')} rel='noopener noreferrer' target='_blank' onClick={this.handleAvatarClick}>
|
||||||
<Avatar account={suspended || hidden ? undefined : account} size={90} />
|
<Avatar account={suspended || hidden ? undefined : account} size={90} />
|
||||||
|
{role}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{!suspended && (
|
{!suspended && (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
||||||
|
|
||||||
// Our imports
|
// Our imports
|
||||||
import { expandSpoilers, disableSwiping } from 'flavours/glitch/initial_state';
|
import { expandSpoilers } from 'flavours/glitch/initial_state';
|
||||||
import { preferenceLink } from 'flavours/glitch/utils/backend_links';
|
import { preferenceLink } from 'flavours/glitch/utils/backend_links';
|
||||||
import LocalSettingsPageItem from './item';
|
import LocalSettingsPageItem from './item';
|
||||||
import DeprecatedLocalSettingsPageItem from './deprecated_item';
|
import DeprecatedLocalSettingsPageItem from './deprecated_item';
|
||||||
|
@ -406,6 +406,18 @@ class LocalSettingsPage extends React.PureComponent {
|
||||||
>
|
>
|
||||||
<FormattedMessage id='settings.auto_collapse_media' defaultMessage='Toots with media' />
|
<FormattedMessage id='settings.auto_collapse_media' defaultMessage='Toots with media' />
|
||||||
</LocalSettingsPageItem>
|
</LocalSettingsPageItem>
|
||||||
|
<LocalSettingsPageItem
|
||||||
|
settings={settings}
|
||||||
|
item={['collapsed', 'auto', 'height']}
|
||||||
|
id='mastodon-settings--collapsed-auto-height'
|
||||||
|
placeholder='400'
|
||||||
|
onChange={onChange}
|
||||||
|
dependsOn={[['collapsed', 'enabled']]}
|
||||||
|
dependsOnNot={[['collapsed', 'auto', 'all']]}
|
||||||
|
inputProps={{type: 'number', min: '200', max: '999'}}
|
||||||
|
>
|
||||||
|
<FormattedMessage id='settings.auto_collapse_height' defaultMessage='Height (in pixels) for a toot to be considered lengthy' />
|
||||||
|
</LocalSettingsPageItem>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h2><FormattedMessage id='settings.image_backgrounds' defaultMessage='Image backgrounds' /></h2>
|
<h2><FormattedMessage id='settings.image_backgrounds' defaultMessage='Image backgrounds' /></h2>
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default class LocalSettingsPageItem extends React.PureComponent {
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
item: PropTypes.array.isRequired,
|
item: PropTypes.array.isRequired,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
|
inputProps: PropTypes.object,
|
||||||
options: PropTypes.arrayOf(PropTypes.shape({
|
options: PropTypes.arrayOf(PropTypes.shape({
|
||||||
value: PropTypes.string.isRequired,
|
value: PropTypes.string.isRequired,
|
||||||
message: PropTypes.string.isRequired,
|
message: PropTypes.string.isRequired,
|
||||||
|
@ -34,7 +35,7 @@ export default class LocalSettingsPageItem extends React.PureComponent {
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { handleChange } = this;
|
const { handleChange } = this;
|
||||||
const { settings, item, id, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props;
|
const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props;
|
||||||
let enabled = !disabled;
|
let enabled = !disabled;
|
||||||
|
|
||||||
if (dependsOn) {
|
if (dependsOn) {
|
||||||
|
@ -54,14 +55,17 @@ export default class LocalSettingsPageItem extends React.PureComponent {
|
||||||
let optionId = `${id}--${opt.value}`;
|
let optionId = `${id}--${opt.value}`;
|
||||||
return (
|
return (
|
||||||
<label htmlFor={optionId}>
|
<label htmlFor={optionId}>
|
||||||
<input type='radio'
|
<input
|
||||||
|
type='radio'
|
||||||
name={id}
|
name={id}
|
||||||
id={optionId}
|
id={optionId}
|
||||||
|
key={optionId}
|
||||||
value={opt.value}
|
value={opt.value}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
checked={ currentValue === opt.value }
|
checked={currentValue === opt.value}
|
||||||
disabled={!enabled}
|
disabled={!enabled}
|
||||||
|
{...inputProps}
|
||||||
/>
|
/>
|
||||||
{opt.message}
|
{opt.message}
|
||||||
{opt.hint && <span className='hint'>{opt.hint}</span>}
|
{opt.hint && <span className='hint'>{opt.hint}</span>}
|
||||||
|
@ -89,6 +93,7 @@ export default class LocalSettingsPageItem extends React.PureComponent {
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
disabled={!enabled}
|
disabled={!enabled}
|
||||||
|
{...inputProps}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</label>
|
</label>
|
||||||
|
@ -103,7 +108,8 @@ export default class LocalSettingsPageItem extends React.PureComponent {
|
||||||
checked={settings.getIn(item)}
|
checked={settings.getIn(item)}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
disabled={!enabled}
|
disabled={!enabled}
|
||||||
/>
|
{...inputProps}
|
||||||
|
/>
|
||||||
{children}
|
{children}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
"settings.auto_collapse_all": "Everything",
|
"settings.auto_collapse_all": "Everything",
|
||||||
"settings.auto_collapse_lengthy": "Lengthy toots",
|
"settings.auto_collapse_lengthy": "Lengthy toots",
|
||||||
"settings.auto_collapse_media": "Toots with media",
|
"settings.auto_collapse_media": "Toots with media",
|
||||||
|
"settings.auto_collapse_height": "Height (in pixels) for a toot to be considered lengthy",
|
||||||
"settings.auto_collapse_notifications": "Notifications",
|
"settings.auto_collapse_notifications": "Notifications",
|
||||||
"settings.auto_collapse_reblogs": "Boosts",
|
"settings.auto_collapse_reblogs": "Boosts",
|
||||||
"settings.auto_collapse_replies": "Replies",
|
"settings.auto_collapse_replies": "Replies",
|
||||||
|
|
|
@ -37,6 +37,7 @@ const initialState = ImmutableMap({
|
||||||
reblogs : false,
|
reblogs : false,
|
||||||
replies : false,
|
replies : false,
|
||||||
media : false,
|
media : false,
|
||||||
|
height : 400,
|
||||||
}),
|
}),
|
||||||
backgrounds : ImmutableMap({
|
backgrounds : ImmutableMap({
|
||||||
user_backgrounds : false,
|
user_backgrounds : false,
|
||||||
|
|
|
@ -214,7 +214,7 @@
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--user-role-accent, $ui-secondary-color);
|
color: $ui-secondary-color;
|
||||||
background-color: var(--user-role-background, rgba($ui-secondary-color, 0.1));
|
background-color: var(--user-role-background, rgba($ui-secondary-color, 0.1));
|
||||||
border: 1px solid var(--user-role-border, rgba($ui-secondary-color, 0.5));
|
border: 1px solid var(--user-role-border, rgba($ui-secondary-color, 0.5));
|
||||||
|
|
||||||
|
|
|
@ -537,14 +537,22 @@
|
||||||
|
|
||||||
&__tabs {
|
&__tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-end;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 7px 10px;
|
padding: 7px 10px;
|
||||||
margin-top: -55px;
|
margin-top: -81px;
|
||||||
gap: 8px;
|
height: 130px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-left: -2px; // aligns the pfp with content below
|
margin-left: -2px; // aligns the pfp with content below
|
||||||
|
|
||||||
|
.account-role {
|
||||||
|
margin: 0 2px;
|
||||||
|
padding: 4px 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-width: 90px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
&__buttons {
|
&__buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -110,6 +110,10 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mastodon-settings--collapsed-auto-height {
|
||||||
|
width: calc(4ch + 20px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.glitch.local-settings__page__item.string,
|
.glitch.local-settings__page__item.string,
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Status < ApplicationRecord
|
||||||
:tags,
|
:tags,
|
||||||
:preview_cards,
|
:preview_cards,
|
||||||
:preloadable_poll,
|
:preloadable_poll,
|
||||||
account: [:account_stat, :user],
|
account: [:account_stat, user: :role],
|
||||||
active_mentions: { account: :account_stat },
|
active_mentions: { account: :account_stat },
|
||||||
reblog: [
|
reblog: [
|
||||||
:application,
|
:application,
|
||||||
|
@ -133,7 +133,7 @@ class Status < ApplicationRecord
|
||||||
:conversation,
|
:conversation,
|
||||||
:status_stat,
|
:status_stat,
|
||||||
:preloadable_poll,
|
:preloadable_poll,
|
||||||
account: [:account_stat, :user],
|
account: [:account_stat, user: :role],
|
||||||
active_mentions: { account: :account_stat },
|
active_mentions: { account: :account_stat },
|
||||||
],
|
],
|
||||||
thread: { account: :account_stat }
|
thread: { account: :account_stat }
|
||||||
|
|
|
@ -26,6 +26,16 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class RoleSerializer < ActiveModel::Serializer
|
||||||
|
attributes :id, :name, :color
|
||||||
|
|
||||||
|
def id
|
||||||
|
object.id.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
has_many :roles, serializer: RoleSerializer, if: :local?
|
||||||
|
|
||||||
class FieldSerializer < ActiveModel::Serializer
|
class FieldSerializer < ActiveModel::Serializer
|
||||||
include FormattingHelper
|
include FormattingHelper
|
||||||
|
|
||||||
|
@ -118,6 +128,14 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
object.silenced?
|
object.silenced?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def roles
|
||||||
|
if object.suspended?
|
||||||
|
[]
|
||||||
|
else
|
||||||
|
[object.user.role].compact.filter { |role| role.highlighted? }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def noindex
|
def noindex
|
||||||
object.user_prefers_noindex?
|
object.user_prefers_noindex?
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
def suffix_version
|
def suffix_version
|
||||||
'+1.1.8'
|
'+1.1.9'
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_a
|
def to_a
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Fabricator(:user_role) do
|
Fabricator(:user_role) do
|
||||||
name "MyString"
|
name "MyString"
|
||||||
color "MyString"
|
color ""
|
||||||
permissions ""
|
permissions 0
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue