From c3a657223f495be9d06757201c95e282756ceec7 Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 11 Jan 2019 08:29:17 +0100 Subject: Hide CWed content in notifications and fix sensitive images without CWs (#9778) Fixes #9634 --- app/javascript/mastodon/service_worker/web_push_notifications.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/service_worker/web_push_notifications.js b/app/javascript/mastodon/service_worker/web_push_notifications.js index 80a4fb329..1ab0dc0fa 100644 --- a/app/javascript/mastodon/service_worker/web_push_notifications.js +++ b/app/javascript/mastodon/service_worker/web_push_notifications.js @@ -92,11 +92,14 @@ const handlePush = (event) => { options.image = notification.status && notification.status.media_attachments.length > 0 && notification.status.media_attachments[0].preview_url || undefined; options.data = { access_token, preferred_locale, id: notification.status ? notification.status.id : notification.account.id, url: notification.status ? `/web/statuses/${notification.status.id}` : `/web/accounts/${notification.account.id}` }; - if (notification.status && notification.status.sensitive) { + if (notification.status && notification.status.spoiler_text || notification.status.sensitive) { options.data.hiddenBody = htmlToPlainText(notification.status.content); options.data.hiddenImage = notification.status.media_attachments.length > 0 && notification.status.media_attachments[0].preview_url; - options.body = notification.status.spoiler_text; + if (notification.status.spoiler_text) { + options.body = notification.status.spoiler_text; + } + options.image = undefined; options.actions = [actionExpand(preferred_locale)]; } else if (notification.type === 'mention') { -- cgit From 11832460431bb6b3196daf17656c2cc76e8ae63d Mon Sep 17 00:00:00 2001 From: Mateusz Bugowski <23140767+mbugowski@users.noreply.github.com> Date: Fri, 11 Jan 2019 08:30:19 +0100 Subject: change height on narrow view to take 100% of screen (#9781) * change height on narrow view to take 100% of screen * add empty line before @media --- app/javascript/styles/mastodon/about.scss | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app') diff --git a/app/javascript/styles/mastodon/about.scss b/app/javascript/styles/mastodon/about.scss index dc456be3e..4023b34d8 100644 --- a/app/javascript/styles/mastodon/about.scss +++ b/app/javascript/styles/mastodon/about.scss @@ -1041,6 +1041,10 @@ $small-breakpoint: 960px; .scrollable { height: 400px; + + @media screen and (max-width: $column-breakpoint) { + height: 90vh; + } } p { -- cgit From 9ee9cb549b58a33a81a9da318cbdc26ed2e47788 Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Fri, 11 Jan 2019 19:15:44 +0900 Subject: Adjust admin UI right panel size (#9768) * Adjust admin UI right panel size * Fix typo --- app/javascript/styles/mastodon/admin.scss | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index 375c655f5..177f8145f 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -1,4 +1,6 @@ $no-columns-breakpoint: 600px; +$sidebar-width: 240px; +$content-width: 840px; .admin-wrapper { display: flex; @@ -6,7 +8,7 @@ $no-columns-breakpoint: 600px; height: 100%; .sidebar-wrapper { - flex: 1; + flex: 1 1 $sidebar-width; height: 100%; background: $ui-base-color; display: flex; @@ -14,7 +16,7 @@ $no-columns-breakpoint: 600px; } .sidebar { - width: 240px; + width: $sidebar-width; height: 100%; padding: 0; overflow-y: auto; @@ -95,12 +97,12 @@ $no-columns-breakpoint: 600px; } .content-wrapper { - flex: 2; + flex: 2 1 $content-width; overflow: auto; } .content { - max-width: 700px; + max-width: $content-width; padding: 20px 15px; padding-top: 60px; padding-left: 25px; -- cgit From 4fb94c758e3bf2e1c0525e9075c2d5dedc14c666 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 13 Jan 2019 10:23:54 +0100 Subject: Add attachment list fallback to public pages (#9780) * Add attachment list fallback to public pages Fixes #6714 * Refactor attachments lists --- app/helpers/application_helper.rb | 8 ++++++-- app/javascript/packs/public.js | 6 ++++++ app/views/stream_entries/_attachment_list.html.haml | 8 ++++++++ app/views/stream_entries/_detailed_status.html.haml | 6 ++++-- app/views/stream_entries/_simple_status.html.haml | 6 ++++-- 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 app/views/stream_entries/_attachment_list.html.haml (limited to 'app') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c33975cac..5097a0953 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -69,8 +69,12 @@ module ApplicationHelper tag(:meta, content: content, property: property) end - def react_component(name, props = {}) - content_tag(:div, nil, data: { component: name.to_s.camelcase, props: Oj.dump(props) }) + def react_component(name, props = {}, &block) + if block.nil? + content_tag(:div, nil, data: { component: name.to_s.camelcase, props: Oj.dump(props) }) + else + content_tag(:div, data: { component: name.to_s.camelcase, props: Oj.dump(props) }, &block) + end end def body_classes diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index a9a3d738a..a86dc7831 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -83,6 +83,12 @@ function main() { if (reactComponents.length > 0) { import(/* webpackChunkName: "containers/media_container" */ '../mastodon/containers/media_container') .then(({ default: MediaContainer }) => { + [].forEach.call(reactComponents, (component) => { + [].forEach.call(component.children, (child) => { + component.removeChild(child); + }); + }); + const content = document.createElement('div'); ReactDOM.render(, content); diff --git a/app/views/stream_entries/_attachment_list.html.haml b/app/views/stream_entries/_attachment_list.html.haml new file mode 100644 index 000000000..d9706f47b --- /dev/null +++ b/app/views/stream_entries/_attachment_list.html.haml @@ -0,0 +1,8 @@ +.attachment-list + .attachment-list__icon + = fa_icon 'link' + %ul.attachment-list__list + - attachments.each do |media| + %li + - url = media.remote_url.presence || media.file.url + = link_to File.basename(url), url, title: media.description diff --git a/app/views/stream_entries/_detailed_status.html.haml b/app/views/stream_entries/_detailed_status.html.haml index 41d4714b9..872a02ea4 100644 --- a/app/views/stream_entries/_detailed_status.html.haml +++ b/app/views/stream_entries/_detailed_status.html.haml @@ -25,9 +25,11 @@ - if !status.media_attachments.empty? - if status.media_attachments.first.video? - video = status.media_attachments.first - = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 670, height: 380, detailed: true, inline: true, alt: video.description + = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 670, height: 380, detailed: true, inline: true, alt: video.description do + = render partial: 'stream_entries/attachment_list', locals: { attachments: status.media_attachments } - else - = react_component :media_gallery, height: 380, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, standalone: true, 'autoPlayGif': current_account&.user&.setting_auto_play_gif || autoplay, 'reduceMotion': current_account&.user&.setting_reduce_motion, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } + = react_component :media_gallery, height: 380, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, standalone: true, 'autoPlayGif': current_account&.user&.setting_auto_play_gif || autoplay, 'reduceMotion': current_account&.user&.setting_reduce_motion, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } do + = render partial: 'stream_entries/attachment_list', locals: { attachments: status.media_attachments } - elsif status.preview_card = react_component :card, 'maxDescription': 160, card: ActiveModelSerializers::SerializableResource.new(status.preview_card, serializer: REST::PreviewCardSerializer).as_json diff --git a/app/views/stream_entries/_simple_status.html.haml b/app/views/stream_entries/_simple_status.html.haml index 89a6fe048..60baa298e 100644 --- a/app/views/stream_entries/_simple_status.html.haml +++ b/app/views/stream_entries/_simple_status.html.haml @@ -29,9 +29,11 @@ - if !status.media_attachments.empty? - if status.media_attachments.first.video? - video = status.media_attachments.first - = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 610, height: 343, inline: true, alt: video.description + = react_component :video, src: video.file.url(:original), preview: video.file.url(:small), sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, width: 610, height: 343, inline: true, alt: video.description do + = render partial: 'stream_entries/attachment_list', locals: { attachments: status.media_attachments } - else - = react_component :media_gallery, height: 343, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, 'autoPlayGif': current_account&.user&.setting_auto_play_gif || autoplay, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } + = react_component :media_gallery, height: 343, sensitive: !current_account&.user&.show_all_media? && status.sensitive? || current_account&.user&.hide_all_media?, 'autoPlayGif': current_account&.user&.setting_auto_play_gif || autoplay, media: status.media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json } do + = render partial: 'stream_entries/attachment_list', locals: { attachments: status.media_attachments } - elsif status.preview_card = react_component :card, 'maxDescription': 160, card: ActiveModelSerializers::SerializableResource.new(status.preview_card, serializer: REST::PreviewCardSerializer).as_json -- cgit From 278ff1318fd9772f3663e7540b9ece020c73a953 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 13 Jan 2019 14:42:50 +0100 Subject: [Glitch] Add attachment list fallback to public pages Port JS changes from 4fb94c758e3bf2e1c0525e9075c2d5dedc14c666 to glitch-soc --- app/javascript/flavours/glitch/packs/public.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app') diff --git a/app/javascript/flavours/glitch/packs/public.js b/app/javascript/flavours/glitch/packs/public.js index 342c5265e..56012ba78 100644 --- a/app/javascript/flavours/glitch/packs/public.js +++ b/app/javascript/flavours/glitch/packs/public.js @@ -61,6 +61,12 @@ function main() { if (reactComponents.length > 0) { import(/* webpackChunkName: "containers/media_container" */ 'flavours/glitch/containers/media_container') .then(({ default: MediaContainer }) => { + [].forEach.call(reactComponents, (component) => { + [].forEach.call(component.children, (child) => { + component.removeChild(child); + }); + }); + const content = document.createElement('div'); ReactDOM.render(, content); -- cgit From 2c5f0f12aca01a91c2e67061c0e676fbd4963139 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 13 Jan 2019 20:40:46 +0100 Subject: [Glitch] change height on narrow view to take 100% of screen Port 11832460431bb6b3196daf17656c2cc76e8ae63d to glitch-soc --- app/javascript/flavours/glitch/styles/about.scss | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app') diff --git a/app/javascript/flavours/glitch/styles/about.scss b/app/javascript/flavours/glitch/styles/about.scss index f676a8c77..da50581fb 100644 --- a/app/javascript/flavours/glitch/styles/about.scss +++ b/app/javascript/flavours/glitch/styles/about.scss @@ -1044,6 +1044,10 @@ $small-breakpoint: 960px; .scrollable { height: 400px; + + @media screen and (max-width: $column-breakpoint) { + height: 90vh; + } } p { -- cgit From 4cec7a77c37e23117323a4ed8f609939ab50b4d6 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 13 Jan 2019 20:41:38 +0100 Subject: [Glitch] Adjust admin UI right panel size Port 9ee9cb549b58a33a81a9da318cbdc26ed2e47788 to glitch-soc --- app/javascript/flavours/glitch/styles/admin.scss | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/javascript/flavours/glitch/styles/admin.scss b/app/javascript/flavours/glitch/styles/admin.scss index e7124a2c0..4e969601b 100644 --- a/app/javascript/flavours/glitch/styles/admin.scss +++ b/app/javascript/flavours/glitch/styles/admin.scss @@ -1,4 +1,6 @@ $no-columns-breakpoint: 600px; +$sidebar-width: 240px; +$content-width: 840px; .admin-wrapper { display: flex; @@ -6,7 +8,7 @@ $no-columns-breakpoint: 600px; height: 100%; .sidebar-wrapper { - flex: 1; + flex: 1 1 $sidebar-width; height: 100%; background: $ui-base-color; display: flex; @@ -14,7 +16,7 @@ $no-columns-breakpoint: 600px; } .sidebar { - width: 240px; + width: $sidebar-width; height: 100%; padding: 0; overflow-y: auto; @@ -95,12 +97,12 @@ $no-columns-breakpoint: 600px; } .content-wrapper { - flex: 2; + flex: 2 1 $content-width; overflow: auto; } .content { - max-width: 700px; + max-width: $content-width; padding: 20px 15px; padding-top: 60px; padding-left: 25px; -- cgit