Skip to content

Commit

Permalink
Merge pull request #1 from glitch-soc/main
Browse files Browse the repository at this point in the history
pull main
  • Loading branch information
sneakers-the-rat authored Nov 29, 2022
2 parents 6517b7b + 1a7aa37 commit 7929b4d
Show file tree
Hide file tree
Showing 254 changed files with 17,680 additions and 6,748 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require:
- rubocop-rails

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.7
NewCops: disable
Exclude:
- 'spec/**/*'
Expand Down
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

source 'https://rubygems.org'
ruby '>= 2.6.0', '< 3.1.0'
ruby '>= 2.7.0', '< 3.1.0'

gem 'pkg-config', '~> 1.4'
gem 'rexml', '~> 3.2'
Expand All @@ -26,7 +26,7 @@ gem 'blurhash', '~> 0.1'

gem 'active_model_serializers', '~> 0.10'
gem 'addressable', '~> 2.8'
gem 'bootsnap', '~> 1.13.0', require: false
gem 'bootsnap', '~> 1.14.0', require: false
gem 'browser'
gem 'charlock_holmes', '~> 0.7.7'
gem 'chewy', '~> 7.2'
Expand Down Expand Up @@ -55,7 +55,7 @@ gem 'redis-namespace', '~> 1.9'
gem 'htmlentities', '~> 4.3'
gem 'http', '~> 5.1'
gem 'http_accept_language', '~> 2.1'
gem 'httplog', '~> 1.6.0'
gem 'httplog', '~> 1.6.2'
gem 'idn-ruby', require: 'idn'
gem 'kaminari', '~> 1.2'
gem 'link_header', '~> 0.0'
Expand Down Expand Up @@ -113,7 +113,7 @@ group :production, :test do
end

group :test do
gem 'capybara', '~> 3.37'
gem 'capybara', '~> 3.38'
gem 'climate_control', '~> 0.2'
gem 'faker', '~> 2.23'
gem 'microformats', '~> 4.4'
Expand All @@ -136,7 +136,7 @@ group :development do
gem 'memory_profiler'
gem 'rubocop', '~> 1.30', require: false
gem 'rubocop-rails', '~> 2.15', require: false
gem 'brakeman', '~> 5.3', require: false
gem 'brakeman', '~> 5.4', require: false
gem 'bundler-audit', '~> 0.9', require: false

gem 'capistrano', '~> 3.17'
Expand Down
24 changes: 12 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ GEM
debug_inspector (>= 0.0.1)
blurhash (0.1.6)
ffi (~> 1.14)
bootsnap (1.13.0)
bootsnap (1.14.0)
msgpack (~> 1.2)
brakeman (5.3.1)
brakeman (5.4.0)
browser (4.2.0)
brpoplpush-redis_script (0.1.2)
concurrent-ruby (~> 1.0, >= 1.0.5)
Expand Down Expand Up @@ -152,7 +152,7 @@ GEM
sshkit (~> 1.3)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
capybara (3.37.1)
capybara (3.38.0)
addressable
matrix
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -311,7 +311,7 @@ GEM
http-form_data (2.3.0)
http_accept_language (2.1.1)
httpclient (2.8.3)
httplog (1.6.0)
httplog (1.6.2)
rack (>= 2.0)
rainbow (>= 2.0.0)
i18n (1.12.0)
Expand All @@ -327,7 +327,7 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.4)
idn-ruby (0.1.5)
ipaddress (0.8.3)
jmespath (1.6.1)
json (2.6.2)
Expand Down Expand Up @@ -406,7 +406,7 @@ GEM
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.16.3)
msgpack (1.5.4)
msgpack (1.6.0)
multi_json (1.15.0)
multipart-post (2.1.1)
net-ldap (0.17.1)
Expand Down Expand Up @@ -457,7 +457,7 @@ GEM
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.4.4)
pg (1.4.5)
pghero (2.8.3)
activerecord (>= 5)
pkg-config (1.4.9)
Expand Down Expand Up @@ -545,7 +545,7 @@ GEM
redis (4.5.1)
redis-namespace (1.9.0)
redis (>= 4)
regexp_parser (2.5.0)
regexp_parser (2.6.0)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
Expand Down Expand Up @@ -741,16 +741,16 @@ DEPENDENCIES
better_errors (~> 2.9)
binding_of_caller (~> 1.0)
blurhash (~> 0.1)
bootsnap (~> 1.13.0)
brakeman (~> 5.3)
bootsnap (~> 1.14.0)
brakeman (~> 5.4)
browser
bullet (~> 7.0)
bundler-audit (~> 0.9)
capistrano (~> 3.17)
capistrano-rails (~> 1.6)
capistrano-rbenv (~> 2.2)
capistrano-yarn (~> 2.0)
capybara (~> 3.37)
capybara (~> 3.38)
charlock_holmes (~> 0.7.7)
chewy (~> 7.2)
climate_control (~> 0.2)
Expand Down Expand Up @@ -779,7 +779,7 @@ DEPENDENCIES
htmlentities (~> 4.3)
http (~> 5.1)
http_accept_language (~> 2.1)
httplog (~> 1.6.0)
httplog (~> 1.6.2)
i18n-tasks (~> 1.0)
idn-ruby
json-ld
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/components/media_gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
import { is } from 'immutable';
import IconButton from './icon_button';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { isIOS } from '../is_mobile';
import classNames from 'classnames';
import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
import { debounce } from 'lodash';
Expand Down Expand Up @@ -202,7 +201,7 @@ class Item extends React.PureComponent {
</a>
);
} else if (attachment.get('type') === 'gifv') {
const autoPlay = !isIOS() && this.getAutoPlay();
const autoPlay = this.getAutoPlay();

thumbnail = (
<div className={classNames('media-gallery__gifv', { autoplay: autoPlay })}>
Expand All @@ -216,6 +215,7 @@ class Item extends React.PureComponent {
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
autoPlay={autoPlay}
playsInline
loop
muted
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ class Header extends ImmutablePureComponent {
}
}

handleShare = () => {
const { account } = this.props;

navigator.share({
text: `${titleFromAccount(account)}\n${account.get('note_plain')}`,
url: account.get('url'),
}).catch((e) => {
if (e.name !== 'AbortError') console.error(e);
});
}

render () {
const { account, hidden, intl, domain } = this.props;
const { signedIn } = this.context.identity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Blurhash from 'flavours/glitch/components/blurhash';
import classNames from 'classnames';
import Icon from 'flavours/glitch/components/icon';
import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
import { isIOS } from 'flavours/glitch/is_mobile';
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
Expand Down Expand Up @@ -109,7 +108,8 @@ export default class MediaItem extends ImmutablePureComponent {
src={attachment.get('url')}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
autoPlay={!isIOS() && autoPlayGif}
autoPlay={autoPlayGif}
playsInline
loop
muted
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ const emptyList = ImmutableList();
const mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = false }) => {
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);

if (!accountId) {
if (accountId === null) {
return {
isLoading: false,
isAccount: false,
statusIds: emptyList,
};
} else if (!accountId) {
return {
isLoading: true,
statusIds: emptyList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';

export default class Trends extends ImmutablePureComponent {

Expand Down Expand Up @@ -36,7 +37,11 @@ export default class Trends extends ImmutablePureComponent {

return (
<div className='getting-started__trends'>
<h4><FormattedMessage id='trends.trending_now' defaultMessage='Trending now' /></h4>
<h4>
<Link to={'/explore/tags'}>
<FormattedMessage id='trends.trending_now' defaultMessage='Trending now' />
</Link>
</h4>

{trends.take(3).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/flavours/glitch/reducers/accounts_map.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ACCOUNT_IMPORT, ACCOUNTS_IMPORT } from '../actions/importer';
import { ACCOUNT_LOOKUP_FAIL } from '../actions/accounts';
import { Map as ImmutableMap } from 'immutable';

export const normalizeForLookup = str => str.toLowerCase();
Expand All @@ -7,6 +8,8 @@ const initialState = ImmutableMap();

export default function accountsMap(state = initialState, action) {
switch(action.type) {
case ACCOUNT_LOOKUP_FAIL:
return action.error?.response?.status === 404 ? state.set(normalizeForLookup(action.acct), null) : state;
case ACCOUNT_IMPORT:
return state.set(normalizeForLookup(action.account.acct), action.account.id);
case ACCOUNTS_IMPORT:
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ export default function compose(state = initialState, action) {
if (action.status.get('spoiler_text').length > 0) {
map.set('spoiler', true);
map.set('spoiler_text', action.status.get('spoiler_text'));

if (map.get('media_attachments').size >= 1) {
map.set('sensitive', true);
}
} else {
map.set('spoiler', false);
map.set('spoiler_text', '');
Expand Down
10 changes: 7 additions & 3 deletions app/javascript/flavours/glitch/styles/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1051,12 +1051,16 @@
margin-top: 10px;

h4 {
border-bottom: 1px solid lighten($ui-base-color, 8%);
padding: 10px;
font-size: 12px;
text-transform: uppercase;
color: $darker-text-color;
padding: 10px;
font-weight: 500;
border-bottom: 1px solid lighten($ui-base-color, 8%);

a {
color: $darker-text-color;
text-decoration: none;
}
}

@media screen and (max-height: 810px) {
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/components/media_gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
import { is } from 'immutable';
import IconButton from './icon_button';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { isIOS } from '../is_mobile';
import classNames from 'classnames';
import { autoPlayGif, cropImages, displayMedia, useBlurhash } from '../initial_state';
import { debounce } from 'lodash';
Expand Down Expand Up @@ -181,7 +180,7 @@ class Item extends React.PureComponent {
</a>
);
} else if (attachment.get('type') === 'gifv') {
const autoPlay = !isIOS() && this.getAutoPlay();
const autoPlay = this.getAutoPlay();

thumbnail = (
<div className={classNames('media-gallery__gifv', { autoplay: autoPlay })}>
Expand All @@ -195,6 +194,7 @@ class Item extends React.PureComponent {
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
autoPlay={autoPlay}
playsInline
loop
muted
/>
Expand Down
11 changes: 11 additions & 0 deletions app/javascript/mastodon/features/account/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ class Header extends ImmutablePureComponent {
}
}

handleShare = () => {
const { account } = this.props;

navigator.share({
text: `${titleFromAccount(account)}\n${account.get('note_plain')}`,
url: account.get('url'),
}).catch((e) => {
if (e.name !== 'AbortError') console.error(e);
});
}

render () {
const { account, hidden, intl, domain } = this.props;
const { signedIn } = this.context.identity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Blurhash from 'mastodon/components/blurhash';
import classNames from 'classnames';
import Icon from 'mastodon/components/icon';
import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state';
import { isIOS } from 'mastodon/is_mobile';
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
Expand Down Expand Up @@ -109,7 +108,8 @@ export default class MediaItem extends ImmutablePureComponent {
src={attachment.get('url')}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
autoPlay={!isIOS() && autoPlayGif}
autoPlay={autoPlayGif}
playsInline
loop
muted
/>
Expand Down
8 changes: 7 additions & 1 deletion app/javascript/mastodon/features/account_timeline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ const emptyList = ImmutableList();
const mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = false }) => {
const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);

if (!accountId) {
if (accountId === null) {
return {
isLoading: false,
isAccount: false,
statusIds: emptyList,
};
} else if (!accountId) {
return {
isLoading: true,
statusIds: emptyList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { ImmutableHashtag as Hashtag } from 'mastodon/components/hashtag';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';

export default class Trends extends ImmutablePureComponent {

Expand Down Expand Up @@ -36,7 +37,11 @@ export default class Trends extends ImmutablePureComponent {

return (
<div className='getting-started__trends'>
<h4><FormattedMessage id='trends.trending_now' defaultMessage='Trending now' /></h4>
<h4>
<Link to={'/explore/tags'}>
<FormattedMessage id='trends.trending_now' defaultMessage='Trending now' />
</Link>
</h4>

{trends.take(3).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
</div>
Expand Down
Loading

0 comments on commit 7929b4d

Please sign in to comment.