Skip to content

Commit

Permalink
Embed modal mobile fix (#62)
Browse files Browse the repository at this point in the history
* Corrected modal-root__modal CSS width

max-width: 100vw on .modal-root__modal, reverted other unnecessary changes.

* Update components.scss
  • Loading branch information
DismalShadowX authored Oct 29, 2024
1 parent 258cfa1 commit 40cf533
Show file tree
Hide file tree
Showing 143 changed files with 1,451 additions and 486 deletions.
140 changes: 70 additions & 70 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,51 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.4.1)
actionpack (= 7.1.4.1)
activesupport (= 7.1.4.1)
actioncable (7.1.4.2)
actionpack (= 7.1.4.2)
activesupport (= 7.1.4.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.4.1)
actionpack (= 7.1.4.1)
activejob (= 7.1.4.1)
activerecord (= 7.1.4.1)
activestorage (= 7.1.4.1)
activesupport (= 7.1.4.1)
actionmailbox (7.1.4.2)
actionpack (= 7.1.4.2)
activejob (= 7.1.4.2)
activerecord (= 7.1.4.2)
activestorage (= 7.1.4.2)
activesupport (= 7.1.4.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.4.1)
actionpack (= 7.1.4.1)
actionview (= 7.1.4.1)
activejob (= 7.1.4.1)
activesupport (= 7.1.4.1)
actionmailer (7.1.4.2)
actionpack (= 7.1.4.2)
actionview (= 7.1.4.2)
activejob (= 7.1.4.2)
activesupport (= 7.1.4.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.4.1)
actionview (= 7.1.4.1)
activesupport (= 7.1.4.1)
actionpack (7.1.4.2)
actionview (= 7.1.4.2)
activesupport (= 7.1.4.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.4.1)
actionpack (= 7.1.4.1)
activerecord (= 7.1.4.1)
activestorage (= 7.1.4.1)
activesupport (= 7.1.4.1)
actiontext (7.1.4.2)
actionpack (= 7.1.4.2)
activerecord (= 7.1.4.2)
activestorage (= 7.1.4.2)
activesupport (= 7.1.4.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.4.1)
activesupport (= 7.1.4.1)
actionview (7.1.4.2)
activesupport (= 7.1.4.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
Expand All @@ -64,22 +64,22 @@ GEM
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.1.4.1)
activesupport (= 7.1.4.1)
activejob (7.1.4.2)
activesupport (= 7.1.4.2)
globalid (>= 0.3.6)
activemodel (7.1.4.1)
activesupport (= 7.1.4.1)
activerecord (7.1.4.1)
activemodel (= 7.1.4.1)
activesupport (= 7.1.4.1)
activemodel (7.1.4.2)
activesupport (= 7.1.4.2)
activerecord (7.1.4.2)
activemodel (= 7.1.4.2)
activesupport (= 7.1.4.2)
timeout (>= 0.4.0)
activestorage (7.1.4.1)
actionpack (= 7.1.4.1)
activejob (= 7.1.4.1)
activerecord (= 7.1.4.1)
activesupport (= 7.1.4.1)
activestorage (7.1.4.2)
actionpack (= 7.1.4.2)
activejob (= 7.1.4.2)
activerecord (= 7.1.4.2)
activesupport (= 7.1.4.2)
marcel (~> 1.0)
activesupport (7.1.4.1)
activesupport (7.1.4.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -100,8 +100,8 @@ GEM
attr_required (1.0.2)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.992.0)
aws-sdk-core (3.210.0)
aws-partitions (1.997.0)
aws-sdk-core (3.211.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
Expand All @@ -113,7 +113,7 @@ GEM
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.0)
aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2)
azure-storage-blob (2.0.3)
azure-storage-common (~> 2.0)
Expand Down Expand Up @@ -179,7 +179,7 @@ GEM
bigdecimal
rexml
crass (1.0.6)
css_parser (1.19.0)
css_parser (1.19.1)
addressable
csv (3.3.0)
database_cleaner-active_record (2.2.0)
Expand Down Expand Up @@ -231,7 +231,7 @@ GEM
erubi (1.13.0)
et-orbi (1.2.11)
tzinfo
excon (0.111.0)
excon (0.112.0)
fabrication (2.31.0)
faker (3.5.1)
i18n (>= 1.8.11, < 2)
Expand Down Expand Up @@ -262,7 +262,7 @@ GEM
faraday (~> 1.0)
fast_blank (1.0.1)
fastimage (2.3.1)
ffi (1.16.3)
ffi (1.17.0)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
Expand Down Expand Up @@ -351,7 +351,7 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jmespath (1.6.2)
json (2.7.2)
json (2.7.4)
json-canonicalization (1.0.0)
json-jwt (1.15.3.1)
activesupport (>= 4.2)
Expand Down Expand Up @@ -412,7 +412,7 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.22.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand All @@ -436,15 +436,15 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.25.1)
msgpack (1.7.2)
msgpack (1.7.3)
multi_json (1.15.0)
multipart-post (2.4.1)
mutex_m (0.2.0)
net-http (0.4.1)
uri
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.15)
net-imap (0.5.0)
date
net-protocol
net-ldap (0.19.0)
Expand Down Expand Up @@ -639,20 +639,20 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.4.1)
actioncable (= 7.1.4.1)
actionmailbox (= 7.1.4.1)
actionmailer (= 7.1.4.1)
actionpack (= 7.1.4.1)
actiontext (= 7.1.4.1)
actionview (= 7.1.4.1)
activejob (= 7.1.4.1)
activemodel (= 7.1.4.1)
activerecord (= 7.1.4.1)
activestorage (= 7.1.4.1)
activesupport (= 7.1.4.1)
rails (7.1.4.2)
actioncable (= 7.1.4.2)
actionmailbox (= 7.1.4.2)
actionmailer (= 7.1.4.2)
actionpack (= 7.1.4.2)
actiontext (= 7.1.4.2)
actionview (= 7.1.4.2)
activejob (= 7.1.4.2)
activemodel (= 7.1.4.2)
activerecord (= 7.1.4.2)
activestorage (= 7.1.4.2)
activesupport (= 7.1.4.2)
bundler (>= 1.15.0)
railties (= 7.1.4.1)
railties (= 7.1.4.2)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -667,9 +667,9 @@ GEM
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.1.4.1)
actionpack (= 7.1.4.1)
activesupport (= 7.1.4.1)
railties (7.1.4.2)
actionpack (= 7.1.4.2)
activesupport (= 7.1.4.2)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -699,9 +699,9 @@ GEM
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.8)
rexml (3.3.9)
rotp (6.3.0)
rouge (4.3.0)
rouge (4.4.0)
rpam2 (4.0.2)
rqrcode (2.2.0)
chunky_png (~> 1.0)
Expand All @@ -711,14 +711,14 @@ GEM
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-github (2.4.0)
rspec-core (~> 3.0)
rspec-mocks (3.13.1)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.0.1)
Expand Down Expand Up @@ -752,12 +752,12 @@ GEM
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.26.2)
rubocop-rails (2.27.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.1.0)
rubocop-rspec (3.2.0)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
Expand Down
18 changes: 16 additions & 2 deletions app/helpers/formatting_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ def extract_status_plain_text(status)
module_function :extract_status_plain_text

def status_content_format(status)
html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
MastodonOTELTracer.in_span('HtmlAwareFormatter rendering') do |span|
span.add_attributes(
'app.formatter.content.type' => 'status',
'app.formatter.content.origin' => status.local? ? 'local' : 'remote'
)

html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
end
end

def rss_status_content_format(status)
Expand All @@ -39,7 +46,14 @@ def rss_status_content_format(status)
end

def account_bio_format(account)
html_aware_format(account.note, account.local?)
MastodonOTELTracer.in_span('HtmlAwareFormatter rendering') do |span|
span.add_attributes(
'app.formatter.content.type' => 'account_bio',
'app.formatter.content.origin' => account.local? ? 'local' : 'remote'
)

html_aware_format(account.note, account.local?)
end
end

def account_field_value_format(field, with_rel_me: true)
Expand Down
12 changes: 9 additions & 3 deletions app/javascript/mastodon/components/poll.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ const makeEmojiMap = record => record.get('emojis').reduce((obj, emoji) => {
class Poll extends ImmutablePureComponent {
static propTypes = {
identity: identityContextPropShape,
poll: ImmutablePropTypes.map,
poll: ImmutablePropTypes.map.isRequired,
status: ImmutablePropTypes.map.isRequired,
lang: PropTypes.string,
intl: PropTypes.object.isRequired,
disabled: PropTypes.bool,
refresh: PropTypes.func,
onVote: PropTypes.func,
onInteractionModal: PropTypes.func,
};

state = {
Expand Down Expand Up @@ -117,7 +119,11 @@ class Poll extends ImmutablePureComponent {
return;
}

this.props.onVote(Object.keys(this.state.selected));
if (this.props.identity.signedIn) {
this.props.onVote(Object.keys(this.state.selected));
} else {
this.props.onInteractionModal('vote', this.props.status);
}
};

handleRefresh = () => {
Expand Down Expand Up @@ -232,7 +238,7 @@ class Poll extends ImmutablePureComponent {
</ul>

<div className='poll__footer'>
{!showResults && <button className='button button-secondary' disabled={disabled || !this.props.identity.signedIn} onClick={this.handleVote}><FormattedMessage id='poll.vote' defaultMessage='Vote' /></button>}
{!showResults && <button className='button button-secondary' disabled={disabled} onClick={this.handleVote}><FormattedMessage id='poll.vote' defaultMessage='Vote' /></button>}
{!showResults && <><button className='poll__link' onClick={this.handleReveal}><FormattedMessage id='poll.reveal' defaultMessage='See results' /></button> · </>}
{showResults && !this.props.disabled && <><button className='poll__link' onClick={this.handleRefresh}><FormattedMessage id='poll.refresh' defaultMessage='Refresh' /></button> · </>}
{votesCount}
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/status_content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class StatusContent extends PureComponent {
);

const poll = !!status.get('poll') && (
<PollContainer pollId={status.get('poll')} lang={language} />
<PollContainer pollId={status.get('poll')} status={status} lang={language} />
);

if (this.props.onClick) {
Expand Down
12 changes: 12 additions & 0 deletions app/javascript/mastodon/containers/poll_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { connect } from 'react-redux';

import { debounce } from 'lodash';

import { openModal } from 'mastodon/actions/modal';
import { fetchPoll, vote } from 'mastodon/actions/polls';
import Poll from 'mastodon/components/poll';

Expand All @@ -17,6 +18,17 @@ const mapDispatchToProps = (dispatch, { pollId }) => ({
onVote (choices) {
dispatch(vote(pollId, choices));
},

onInteractionModal (type, status) {
dispatch(openModal({
modalType: 'INTERACTION',
modalProps: {
type,
accountId: status.getIn(['account', 'id']),
url: status.get('uri'),
},
}));
}
});

const mapStateToProps = (state, { pollId }) => ({
Expand Down
Loading

0 comments on commit 40cf533

Please sign in to comment.