Merge branch 'bug/fixes' into 'master'

More bug fixes

Closes #313 et #277

See merge request framasoft/mobilizon!323
This commit is contained in:
Thomas Citharel 2019-11-19 18:25:30 +01:00
commit c4832a32fb
5 changed files with 31 additions and 15 deletions

View File

@ -0,0 +1,4 @@
<svg version="1.1" viewBox="0 0 65.131 65.131" xmlns="http://www.w3.org/2000/svg">
<path d="m28.214 64.754c-6.9441-0.80647-14.478-4.7044-19.429-10.053-8.1024-8.7516-10.823-21.337-7.0178-32.463 3.8465-11.248 12.917-19.153 24.746-21.569 7.2561-1.4817 14.813-0.27619 21.622 3.4495 7.517 4.1126 12.568 10.251 15.291 18.582 5.5678 17.038-4.1941 35.667-21.417 40.87-4.6929 1.4178-8.7675 1.7673-13.795 1.1834zm0.43913-17.263c2.0058-2.7986 3.7663-5.0883 3.9123-5.0883 0.14591 0 1.9109 2.2959 3.9221 5.102 2.0112 2.8061 3.827 5.0577 4.0349 5.0035 0.90081-0.23467 8.2871-5.9034 8.1633-6.265-0.07527-0.21984-1.7555-2.6427-3.7338-5.3842-1.9783-2.7414-3.552-5.0223-3.497-5.0686 0.05497-0.04629 2.8095-0.97845 6.1211-2.0715 3.3117-1.093 6.0224-2.1432 6.0239-2.3338 0.0073-0.92502-2.9094-9.4312-3.283-9.5746-0.23567-0.09043-2.9906 0.68953-6.1221 1.7332-3.1315 1.0437-5.8046 1.8977-5.9404 1.8977-0.13575 0-0.28828-2.9385-0.33895-6.53l-0.09213-6.53h-10.516l-0.09213 6.53c-0.05067 3.5915-0.20809 6.53-0.34982 6.53s-2.9544-0.90204-6.2504-2.0045l-5.9927-2.0045-1.5444 4.6339c-0.8494 2.5487-1.5444 4.866-1.5444 5.1496 0 0.36743 1.7311 1.087 6.0212 2.503 3.3117 1.093 6.0662 2.0252 6.1211 2.0715 0.05497 0.04629-1.5187 2.3272-3.497 5.0686-1.9783 2.7415-3.6605 5.1643-3.7382 5.3842-0.14163 0.40073 7.4833 6.2827 8.1896 6.3175 0.20673 0.01021 2.017-2.2712 4.0228-5.0698z" stroke-width=".33922"/>
<path d="m23.631 51.953c-2.348-1.5418-6.9154-5.1737-7.0535-5.6088-0.06717-0.21164 0.45125-0.99318 3.3654-5.0734 2.269-3.177 3.7767-5.3581 3.7767-5.4637 0-0.03748-1.6061-0.60338-3.5691-1.2576-6.1342-2.0442-8.3916-2.9087-8.5288-3.2663-0.03264-0.08506 0.09511-0.68598 0.28388-1.3354 0.643-2.212 2.7038-8.4123 2.7959-8.4123 0.05052 0 2.6821 0.85982 5.848 1.9107 3.1659 1.0509 5.897 1.9222 6.0692 1.9362 0.3089 0.02514 0.31402 0.01925 0.38295-0.44107 0.09851-0.65784 0.26289-5.0029 0.2633-6.9599 1.87e-4 -0.90267 0.02801-2.5298 0.06184-3.6158l0.0615-1.9746h10.392l0.06492 4.4556c0.06287 4.3148 0.18835 7.8236 0.29865 8.3513 0.0295 0.14113 0.11236 0.2566 0.18412 0.2566 0.07176 0 1.6955-0.50861 3.6084-1.1303 4.5213-1.4693 6.2537-2.0038 7.3969-2.2822 0.87349-0.21269 0.94061-0.21704 1.0505-0.06806 0.45169 0.61222 3.3677 9.2365 3.1792 9.4025-0.33681 0.29628-2.492 1.1048-6.9823 2.6194-5.3005 1.7879-5.1321 1.7279-5.1321 1.8283 0 0.13754 0.95042 1.522 3.5468 5.1666 1.3162 1.8475 2.6802 3.7905 3.0311 4.3176l0.63804 0.95842-0.27216 0.28519c-1.1112 1.1644-7.3886 5.8693-7.8309 5.8693-0.22379 0-1.2647-1.2321-2.9284-3.4663-0.90374-1.2137-2.264-3.0402-3.0228-4.059-0.75878-1.0188-1.529-2.0203-1.7116-2.2256l-0.33201-0.37324-0.32674 0.37324c-0.43918 0.50169-2.226 2.867-3.8064 5.0388-2.1662 2.9767-3.6326 4.8055-3.8532 4.8055-0.05161 0-0.4788-0.25278-0.94931-0.56173z" fill="#fff" stroke-width=".093311"/>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -184,11 +184,17 @@
</small> </small>
<div> <div>
<!-- <b-icon icon="mastodon" size="is-large" type="is-primary" />--> <!-- <b-icon icon="mastodon" size="is-large" type="is-primary" />-->
<a :href="facebookShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="facebook" size="is-large" type="is-primary" /></a>
<a :href="twitterShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="twitter" size="is-large" type="is-primary" /></a> <a :href="twitterShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="twitter" size="is-large" type="is-primary" /></a>
<a :href="facebookShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="facebook" size="is-large" type="is-primary" /></a>
<a :href="linkedInShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="linkedin" size="is-large" type="is-primary" /></a>
<a :href="diasporaShareUrl" class="diaspora" target="_blank" rel="nofollow noopener">
<span data-v-5e15e80a="" class="icon has-text-primary is-large">
<img svg-inline src="../../assets/diaspora-icon.svg" alt="diaspora-logo" />
</span>
</a>
<a :href="emailShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="email" size="is-large" type="is-primary" /></a> <a :href="emailShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="email" size="is-large" type="is-primary" /></a>
<!-- TODO: mailto: links are not used anymore, we should provide a popup to redact a message instead --> <!-- TODO: mailto: links are not used anymore, we should provide a popup to redact a message instead -->
<a :href="linkedInShareUrl" target="_blank" rel="nofollow noopener"><b-icon icon="linkedin" size="is-large" type="is-primary" /></a>
</div> </div>
</div> </div>
<hr /> <hr />
@ -591,6 +597,10 @@ export default class Event extends EventMixin {
return `mailto:?to=&body=${this.event.url}${encodeURIComponent('\n\n')}${this.textDescription}&subject=${this.event.title}`; return `mailto:?to=&body=${this.event.url}${encodeURIComponent('\n\n')}${this.textDescription}&subject=${this.event.title}`;
} }
get diasporaShareUrl(): string {
return `https://share.diasporafoundation.org/?title=${encodeURIComponent(this.event.title)}&url=${encodeURIComponent(this.event.url)}`;
}
get textDescription(): string { get textDescription(): string {
const meta = document.querySelector("meta[property='og:description']"); const meta = document.querySelector("meta[property='og:description']");
if (!meta) return ''; if (!meta) return '';
@ -899,6 +909,11 @@ export default class Event extends EventMixin {
.share { .share {
border-bottom: solid 1px #111; border-bottom: solid 1px #111;
.diaspora span svg {
height: 2rem;
width: 2rem;
}
.columns { .columns {
& > * { & > * {

View File

@ -13,7 +13,7 @@ defmodule MobilizonWeb.Email do
args args
|> new_email() |> new_email()
|> from(Config.instance_email_from()) |> from({Config.instance_name(), Config.instance_email_from()})
|> put_header("Reply-To", Config.instance_email_reply_to()) |> put_header("Reply-To", Config.instance_email_reply_to())
|> assign(:instance, instance) |> assign(:instance, instance)
|> put_html_layout({MobilizonWeb.EmailView, "email.html"}) |> put_html_layout({MobilizonWeb.EmailView, "email.html"})

View File

@ -15,13 +15,13 @@ defmodule MobilizonWeb.Resolvers.Config do
geolix = Geolix.lookup(ip) geolix = Geolix.lookup(ip)
country_code = country_code =
case geolix.city do case Map.get(geolix, :city) do
%{country: %Country{iso_code: country_code}} -> String.downcase(country_code) %{country: %Country{iso_code: country_code}} -> String.downcase(country_code)
_ -> nil _ -> nil
end end
location = location =
case geolix.city do case Map.get(geolix, :city) do
%{location: %Location{} = location} -> Map.from_struct(location) %{location: %Location{} = location} -> Map.from_struct(location)
_ -> nil _ -> nil
end end

View File

@ -15,7 +15,7 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Utils do
def fetch_tags(tags) when is_list(tags) do def fetch_tags(tags) when is_list(tags) do
Logger.debug("fetching tags") Logger.debug("fetching tags")
Enum.reduce(tags, [], &fetch_tag/2) tags |> Enum.flat_map(&fetch_tag/1) |> Enum.uniq() |> Enum.map(&existing_tag_or_data/1)
end end
@spec fetch_mentions([map()]) :: [map()] @spec fetch_mentions([map()]) :: [map()]
@ -64,23 +64,20 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Utils do
} }
end end
defp fetch_tag(tag, acc) when is_map(tag) do defp fetch_tag(tag) when is_map(tag) do
case tag["type"] do case tag["type"] do
"Hashtag" -> "Hashtag" ->
acc ++ [existing_tag_or_data(tag["name"])] [tag_without_hash(tag["name"])]
_err -> _err ->
acc []
end end
end end
defp fetch_tag(tag, acc) when is_bitstring(tag) do defp fetch_tag(tag) when is_bitstring(tag), do: [tag_without_hash(tag)]
acc ++ [existing_tag_or_data(tag)]
end
defp existing_tag_or_data("#" <> tag_title) do defp tag_without_hash("#" <> tag_title), do: tag_title
existing_tag_or_data(tag_title) defp tag_without_hash(tag_title), do: tag_title
end
defp existing_tag_or_data(tag_title) do defp existing_tag_or_data(tag_title) do
case Events.get_tag_by_title(tag_title) do case Events.get_tag_by_title(tag_title) do