mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-16 01:09:55 +00:00
Allow users to set the trigger height for lengthy toot auto-collapse (#2070)
* Allow users to set the trigger height for lengthy toot autocollapse Add a field in the glitch-soc preferences to set the exact height in pixels of a "lengthy toot" where auto-collapse is triggered Originally authored by Dean Bassett (github.com/deanveloper) Squashed 3 commits from neatchee/mastodon and returned some values to project defaults: *ef665c1df5*0fce108d21*998f701a2b* Remove bad escape characters * Apply feedback from glitch-soc code review - move input width specification to CSS - adjust language for clarity * Update comments re: lengthy toot height * Fix inconsistent indentation * Use a calculated width that scales better with browser font instead of static 45px width
This commit is contained in:
@@ -224,7 +224,7 @@ class Status extends ImmutablePureComponent {
|
||||
// - The user has decided to collapse all notifications ('muted'
|
||||
// statuses).
|
||||
// - 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
|
||||
// replies.
|
||||
// - The status contains media and the user has decided to collapse all
|
||||
@@ -251,10 +251,15 @@ class Status extends ImmutablePureComponent {
|
||||
// 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;
|
||||
|
||||
let autoCollapseHeight = parseInt(autoCollapseSettings.get('height'));
|
||||
if (status.get('media_attachments').size && !muted) {
|
||||
autoCollapseHeight += 210;
|
||||
}
|
||||
|
||||
if (collapse ||
|
||||
autoCollapseSettings.get('all') ||
|
||||
(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('replies') && status.get('in_reply_to_id', null) !== null) ||
|
||||
(autoCollapseSettings.get('media') && !(status.get('spoiler_text').length) && status.get('media_attachments').size > 0)
|
||||
|
||||
Reference in New Issue
Block a user