Merge branch 'enhancements' into 'main'
Various enhancements Closes #1085 See merge request framasoft/mobilizon!1213
This commit is contained in:
commit
95062df343
|
@ -31,15 +31,11 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="mb-2 line-clamp-3" dir="auto" v-html="group.summary" />
|
||||||
class="content mb-2 line-clamp-3"
|
|
||||||
dir="auto"
|
|
||||||
v-html="group.summary"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<inline-address
|
<inline-address
|
||||||
class="has-text-grey-dark"
|
class="has-text-grey-dark"
|
||||||
v-if="group.physicalAddress"
|
v-if="group.physicalAddress && addressFullName(group.physicalAddress)"
|
||||||
:physicalAddress="group.physicalAddress"
|
:physicalAddress="group.physicalAddress"
|
||||||
/>
|
/>
|
||||||
<p class="has-text-grey-dark">
|
<p class="has-text-grey-dark">
|
||||||
|
@ -65,6 +61,7 @@ import { displayName, IGroup, usernameWithDomain } from "@/types/actor";
|
||||||
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
import LazyImageWrapper from "@/components/Image/LazyImageWrapper.vue";
|
||||||
import RouteName from "../../router/name";
|
import RouteName from "../../router/name";
|
||||||
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
||||||
|
import { addressFullName } from "@/types/address.model";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
|
@ -80,6 +77,8 @@ export default class GroupCard extends Vue {
|
||||||
usernameWithDomain = usernameWithDomain;
|
usernameWithDomain = usernameWithDomain;
|
||||||
|
|
||||||
displayName = displayName;
|
displayName = displayName;
|
||||||
|
|
||||||
|
addressFullName = addressFullName;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -65,80 +65,93 @@ export class Address implements IAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
get poiInfos(): IPoiInfo {
|
get poiInfos(): IPoiInfo {
|
||||||
/* generate name corresponding to poi type */
|
return addressToPoiInfos(this);
|
||||||
let name = "";
|
|
||||||
let alternativeName = "";
|
|
||||||
let poiIcon: IPOIIcon = poiIcons.default;
|
|
||||||
// Google Maps doesn't have a type
|
|
||||||
if (this.type == null && this.description === this.street) {
|
|
||||||
this.type = "house";
|
|
||||||
}
|
|
||||||
switch (this.type) {
|
|
||||||
case "house":
|
|
||||||
name = this.description;
|
|
||||||
alternativeName = [this.postalCode, this.locality, this.country]
|
|
||||||
.filter((zone) => zone)
|
|
||||||
.join(", ");
|
|
||||||
poiIcon = poiIcons.defaultAddress;
|
|
||||||
break;
|
|
||||||
case "street":
|
|
||||||
case "secondary":
|
|
||||||
name = this.description;
|
|
||||||
alternativeName = [this.postalCode, this.locality, this.country]
|
|
||||||
.filter((zone) => zone)
|
|
||||||
.join(", ");
|
|
||||||
poiIcon = poiIcons.defaultStreet;
|
|
||||||
break;
|
|
||||||
case "zone":
|
|
||||||
case "city":
|
|
||||||
case "administrative":
|
|
||||||
name = this.postalCode
|
|
||||||
? `${this.description} (${this.postalCode})`
|
|
||||||
: this.description;
|
|
||||||
alternativeName = [this.region, this.country]
|
|
||||||
.filter((zone) => zone)
|
|
||||||
.join(", ");
|
|
||||||
poiIcon = poiIcons.defaultAdministrative;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// POI
|
|
||||||
name = this.description;
|
|
||||||
alternativeName = "";
|
|
||||||
if (this.street && this.street.trim()) {
|
|
||||||
alternativeName = `${this.street}`;
|
|
||||||
if (this.locality) {
|
|
||||||
alternativeName += ` (${this.locality})`;
|
|
||||||
}
|
|
||||||
} else if (this.locality && this.locality.trim()) {
|
|
||||||
alternativeName = `${this.locality}, ${this.region}, ${this.country}`;
|
|
||||||
} else if (this.region && this.region.trim()) {
|
|
||||||
alternativeName = `${this.region}, ${this.country}`;
|
|
||||||
} else if (this.country && this.country.trim()) {
|
|
||||||
alternativeName = this.country;
|
|
||||||
}
|
|
||||||
poiIcon = this.iconForPOI;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return { name, alternativeName, poiIcon };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get fullName(): string {
|
get fullName(): string {
|
||||||
const { name, alternativeName } = this.poiInfos;
|
return addressFullName(this);
|
||||||
if (name && alternativeName) {
|
|
||||||
return `${name}, ${alternativeName}`;
|
|
||||||
}
|
|
||||||
if (name) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get iconForPOI(): IPOIIcon {
|
get iconForPOI(): IPOIIcon {
|
||||||
if (this.type == null) {
|
return iconForAddress(this);
|
||||||
return poiIcons.default;
|
|
||||||
}
|
|
||||||
const type = this.type.split(":").pop() || "";
|
|
||||||
if (poiIcons[type]) return poiIcons[type];
|
|
||||||
return poiIcons.default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addressToPoiInfos(address: IAddress): IPoiInfo {
|
||||||
|
/* generate name corresponding to poi type */
|
||||||
|
let name = "";
|
||||||
|
let alternativeName = "";
|
||||||
|
let poiIcon: IPOIIcon = poiIcons.default;
|
||||||
|
let addressType = address.type;
|
||||||
|
// Google Maps doesn't have a type
|
||||||
|
if (address.type == null && address.description === address.street) {
|
||||||
|
addressType = "house";
|
||||||
|
}
|
||||||
|
switch (addressType) {
|
||||||
|
case "house":
|
||||||
|
name = address.description;
|
||||||
|
alternativeName = [address.postalCode, address.locality, address.country]
|
||||||
|
.filter((zone) => zone)
|
||||||
|
.join(", ");
|
||||||
|
poiIcon = poiIcons.defaultAddress;
|
||||||
|
break;
|
||||||
|
case "street":
|
||||||
|
case "secondary":
|
||||||
|
name = address.description;
|
||||||
|
alternativeName = [address.postalCode, address.locality, address.country]
|
||||||
|
.filter((zone) => zone)
|
||||||
|
.join(", ");
|
||||||
|
poiIcon = poiIcons.defaultStreet;
|
||||||
|
break;
|
||||||
|
case "zone":
|
||||||
|
case "city":
|
||||||
|
case "administrative":
|
||||||
|
name = address.postalCode
|
||||||
|
? `${address.description} (${address.postalCode})`
|
||||||
|
: address.description;
|
||||||
|
alternativeName = [address.region, address.country]
|
||||||
|
.filter((zone) => zone)
|
||||||
|
.join(", ");
|
||||||
|
poiIcon = poiIcons.defaultAdministrative;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// POI
|
||||||
|
name = address.description;
|
||||||
|
alternativeName = "";
|
||||||
|
if (address.street && address.street.trim()) {
|
||||||
|
alternativeName = `${address.street}`;
|
||||||
|
if (address.locality) {
|
||||||
|
alternativeName += ` (${address.locality})`;
|
||||||
|
}
|
||||||
|
} else if (address.locality && address.locality.trim()) {
|
||||||
|
alternativeName = `${address.locality}, ${address.region}, ${address.country}`;
|
||||||
|
} else if (address.region && address.region.trim()) {
|
||||||
|
alternativeName = `${address.region}, ${address.country}`;
|
||||||
|
} else if (address.country && address.country.trim()) {
|
||||||
|
alternativeName = address.country;
|
||||||
|
}
|
||||||
|
poiIcon = iconForAddress(address);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return { name, alternativeName, poiIcon };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function iconForAddress(address: IAddress): IPOIIcon {
|
||||||
|
if (address.type == null) {
|
||||||
|
return poiIcons.default;
|
||||||
|
}
|
||||||
|
const type = address.type.split(":").pop() || "";
|
||||||
|
if (poiIcons[type]) return poiIcons[type];
|
||||||
|
return poiIcons.default;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addressFullName(address: IAddress): string {
|
||||||
|
const { name, alternativeName } = addressToPoiInfos(address);
|
||||||
|
if (name && alternativeName) {
|
||||||
|
return `${name}, ${alternativeName}`;
|
||||||
|
}
|
||||||
|
if (name) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -558,9 +558,10 @@
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div class="address-wrapper">
|
<div class="address-wrapper">
|
||||||
<span v-if="!physicalAddress">{{
|
<span
|
||||||
$t("No address defined")
|
v-if="!physicalAddress || !addressFullName(physicalAddress)"
|
||||||
}}</span>
|
>{{ $t("No address defined") }}</span
|
||||||
|
>
|
||||||
<div class="address" v-if="physicalAddress">
|
<div class="address" v-if="physicalAddress">
|
||||||
<div>
|
<div>
|
||||||
<address dir="auto">
|
<address dir="auto">
|
||||||
|
@ -739,7 +740,7 @@ import DiscussionListItem from "@/components/Discussion/DiscussionListItem.vue";
|
||||||
import MultiPostListItem from "@/components/Post/MultiPostListItem.vue";
|
import MultiPostListItem from "@/components/Post/MultiPostListItem.vue";
|
||||||
import ResourceItem from "@/components/Resource/ResourceItem.vue";
|
import ResourceItem from "@/components/Resource/ResourceItem.vue";
|
||||||
import FolderItem from "@/components/Resource/FolderItem.vue";
|
import FolderItem from "@/components/Resource/FolderItem.vue";
|
||||||
import { Address } from "@/types/address.model";
|
import { Address, addressFullName } from "@/types/address.model";
|
||||||
import Invitations from "@/components/Group/Invitations.vue";
|
import Invitations from "@/components/Group/Invitations.vue";
|
||||||
import addMinutes from "date-fns/addMinutes";
|
import addMinutes from "date-fns/addMinutes";
|
||||||
import { CONFIG } from "@/graphql/config";
|
import { CONFIG } from "@/graphql/config";
|
||||||
|
@ -820,6 +821,8 @@ export default class Group extends mixins(GroupMixin) {
|
||||||
|
|
||||||
displayName = displayName;
|
displayName = displayName;
|
||||||
|
|
||||||
|
addressFullName = addressFullName;
|
||||||
|
|
||||||
PostVisibility = PostVisibility;
|
PostVisibility = PostVisibility;
|
||||||
|
|
||||||
Openness = Openness;
|
Openness = Openness;
|
||||||
|
|
|
@ -23,7 +23,7 @@ defmodule Mobilizon.Service.Workers.SendActivityRecapWorker do
|
||||||
Repo.transaction(fn ->
|
Repo.transaction(fn ->
|
||||||
Users.stream_users_for_recap()
|
Users.stream_users_for_recap()
|
||||||
|> Enum.to_list()
|
|> Enum.to_list()
|
||||||
|> Repo.preload([:settings])
|
|> Repo.preload([:settings, :activity_settings])
|
||||||
|> Enum.filter(&filter_elegible_users/1)
|
|> Enum.filter(&filter_elegible_users/1)
|
||||||
|> Enum.map(fn %User{} = user ->
|
|> Enum.map(fn %User{} = user ->
|
||||||
%{
|
%{
|
||||||
|
|
|
@ -11,7 +11,8 @@ defmodule Mobilizon.Web.RequestContext do
|
||||||
method: conn.method,
|
method: conn.method,
|
||||||
headers: %{
|
headers: %{
|
||||||
"User-Agent": conn |> Plug.Conn.get_req_header("user-agent") |> List.first(),
|
"User-Agent": conn |> Plug.Conn.get_req_header("user-agent") |> List.first(),
|
||||||
Referer: conn |> Plug.Conn.get_req_header("referer") |> List.first()
|
Referer: conn |> Plug.Conn.get_req_header("referer") |> List.first(),
|
||||||
|
"Accept-Language": conn |> Plug.Conn.get_req_header("accept-language") |> List.first()
|
||||||
},
|
},
|
||||||
query_string: conn.query_string,
|
query_string: conn.query_string,
|
||||||
env: %{
|
env: %{
|
||||||
|
|
Loading…
Reference in a new issue