Only ask to send edit link if email has been set up

This commit is contained in:
Yohan Boniface 2023-05-31 17:20:22 +02:00
parent 8f52d34bb2
commit e0760ca403
3 changed files with 17 additions and 9 deletions

View file

@ -115,6 +115,7 @@ INSTALLED_APPS = (
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
FROM_EMAIL = None
# =============================================================================
# Calculation of directories relative to the project module location

View file

@ -1342,7 +1342,11 @@ L.U.Map.include({
alert.duration = Infinity
this.options.umap_id = data.id
this.permissions.setOptions(data.permissions)
if (data.permissions && data.permissions.anonymous_edit_url) {
if (
data.permissions &&
data.permissions.anonymous_edit_url &&
this.options.urls.map_send_edit_link
) {
alert.actions = [
{
label: L._('Send me the link'),

View file

@ -99,8 +99,7 @@ i18n_urls += decorated_patterns(
name="map_star",
),
)
i18n_urls += decorated_patterns(
[map_permissions_check, never_cache],
map_urls = [
re_path(
r"^map/(?P<map_id>[\d]+)/update/settings/$",
views.MapUpdate.as_view(),
@ -111,11 +110,6 @@ i18n_urls += decorated_patterns(
views.UpdateMapPermissions.as_view(),
name="map_update_permissions",
),
re_path(
r"^map/(?P<map_id>[\d]+)/send-edit-link/$",
views.SendEditLink.as_view(),
name="map_send_edit_link",
),
re_path(
r"^map/(?P<map_id>[\d]+)/update/owner/$",
views.AttachAnonymousMap.as_view(),
@ -146,7 +140,16 @@ i18n_urls += decorated_patterns(
views.DataLayerDelete.as_view(),
name="datalayer_delete",
),
]
if settings.FROM_EMAIL:
map_urls.append(
re_path(
r"^map/(?P<map_id>[\d]+)/send-edit-link/$",
views.SendEditLink.as_view(),
name="map_send_edit_link",
)
)
i18n_urls += decorated_patterns([map_permissions_check, never_cache], *map_urls)
urlpatterns += i18n_patterns(
re_path(r"^$", views.home, name="home"),
re_path(