Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog.md2
-rw-r--r--app/assets/stylesheets/mobile/header.scss18
-rw-r--r--app/views/layouts/_drawer.mobile.haml3
-rw-r--r--app/views/shared/_links.haml2
-rw-r--r--lib/diaspora/mentionable.rb10
-rw-r--r--lib/diaspora/message_renderer.rb5
-rw-r--r--spec/lib/diaspora/message_renderer_spec.rb10
7 files changed, 49 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md
index 350946272..c122d358f 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -53,6 +53,8 @@ We use yarn to install the frontend dependencies now, so you need to have that i
* Make inline code inside links show the link color [#8387](https://github.com/diaspora/diaspora/pull/8387)
* Fix fetching public posts on first account search was missing some data [#8390](https://github.com/diaspora/diaspora/pull/8390)
* Add redirect from mobile UI photo URLs to post when not using mobile UI [#8400](https://github.com/diaspora/diaspora/pull/8400)
+* Escape mentions before markdown parsing in mobile UI [#8398](https://github.com/diaspora/diaspora/pull/8398)
+* Cleanup duplicate pods in database [#8403](https://github.com/diaspora/diaspora/pull/8403)
## Features
* Add client-side cropping of profile image uploads [#7581](https://github.com/diaspora/diaspora/pull/7581)
diff --git a/app/assets/stylesheets/mobile/header.scss b/app/assets/stylesheets/mobile/header.scss
index 159e6a536..9e532921b 100644
--- a/app/assets/stylesheets/mobile/header.scss
+++ b/app/assets/stylesheets/mobile/header.scss
@@ -145,6 +145,9 @@ $mobile-navbar-height: 46px;
bottom: 0;
overflow: auto;
width: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
li {
font-size: 1.8rem;
@@ -195,6 +198,21 @@ $mobile-navbar-height: 46px;
margin: 0;
padding: 0;
}
+
+ .info-links {
+ li {
+ font-size: 1.2rem;
+ line-height: 1.2;
+ }
+
+ a {
+ padding: 8px 25px;
+ }
+
+ .switch-to-touch {
+ display: none;
+ }
+ }
}
#main-nav, #drawer {
diff --git a/app/views/layouts/_drawer.mobile.haml b/app/views/layouts/_drawer.mobile.haml
index 61b6045dc..5087bec2d 100644
--- a/app/views/layouts/_drawer.mobile.haml
+++ b/app/views/layouts/_drawer.mobile.haml
@@ -61,3 +61,6 @@
= t("admins.admin_bar.report")
%li= link_to t("layouts.application.switch_to_standard_mode"), toggle_mobile_path
%li= link_to t("layouts.header.logout"), destroy_user_session_path, method: :delete
+
+ %ul.info-links
+ = render "shared/links"
diff --git a/app/views/shared/_links.haml b/app/views/shared/_links.haml
index 6dc53c6e2..b724c0d25 100644
--- a/app/views/shared/_links.haml
+++ b/app/views/shared/_links.haml
@@ -4,8 +4,8 @@
source_url.to_s,
title: t("layouts.application.source_package")
%li= link_to t("layouts.application.statistics_link"), statistics_path
-%li= link_to t("layouts.application.switch_to_touch_optimized_mode"), toggle_mobile_path
- if AppConfig.settings.terms.enable?
%li= link_to t("_terms"), terms_path
- unless AppConfig.admins.podmin_email.nil?
%li= mail_to AppConfig.admins.podmin_email, t("_podmin_mail")
+%li.switch-to-touch= link_to t("layouts.application.switch_to_touch_optimized_mode"), toggle_mobile_path
diff --git a/lib/diaspora/mentionable.rb b/lib/diaspora/mentionable.rb
index 39dc7b085..41dcb79f7 100644
--- a/lib/diaspora/mentionable.rb
+++ b/lib/diaspora/mentionable.rb
@@ -71,6 +71,16 @@ module Diaspora::Mentionable
}
end
+ # Escapes special chars in mentions to not be parsed as markdown
+ #
+ # @param [String] text containing mentions
+ # @return [String] escaped message
+ def self.escape_for_markdown(msg_text)
+ msg_text.to_s.gsub(REGEX) {|match_str|
+ match_str.gsub("_", "\\_")
+ }
+ end
+
private_class_method def self.find_or_fetch_person_by_identifier(identifier)
Person.find_or_fetch_by_identifier(identifier) if Validation::Rule::DiasporaId.new.valid_value?(identifier)
rescue DiasporaFederation::Discovery::DiscoveryError
diff --git a/lib/diaspora/message_renderer.rb b/lib/diaspora/message_renderer.rb
index 7cb0df3fd..6981e7a20 100644
--- a/lib/diaspora/message_renderer.rb
+++ b/lib/diaspora/message_renderer.rb
@@ -71,6 +71,10 @@ module Diaspora
end
end
+ def escape_mentions_for_markdown
+ @message = Diaspora::Mentionable.escape_for_markdown(message)
+ end
+
def render_mentions
unless options[:disable_hovercards] || options[:mentioned_people].empty?
@message = Diaspora::Mentionable.format message, options[:mentioned_people]
@@ -210,6 +214,7 @@ module Diaspora
normalize
diaspora_links
camo_urls if AppConfig.privacy.camo.proxy_markdown_images?
+ escape_mentions_for_markdown
markdownify
render_mentions
render_tags
diff --git a/spec/lib/diaspora/message_renderer_spec.rb b/spec/lib/diaspora/message_renderer_spec.rb
index a9a12e85b..ca000890e 100644
--- a/spec/lib/diaspora/message_renderer_spec.rb
+++ b/spec/lib/diaspora/message_renderer_spec.rb
@@ -183,6 +183,16 @@ describe Diaspora::MessageRenderer do
).to match(/hovercard/)
end
+ it "does not parse mentions as markdown" do
+ new_person = FactoryBot.create(:person, diaspora_handle: "__underscore__@example.org")
+ expect(
+ message(
+ "Hey @{#{new_person.diaspora_handle}}!",
+ mentioned_people: [new_person]
+ ).markdownified
+ ).to match(%r{>#{new_person.name}</a>})
+ end
+
it 'should process text with both a hashtag and a link' do
expect(
message("Test #tag?\nhttps://joindiaspora.com\n").markdownified