Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/prod/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DJANGO_SETTINGS_MODULE="hypha.settings.production"
SECRET_KEY="changeme"

PRIMARY_HOST="https://test.hypha.app"
WAGTAILADMIN_BASE_URL="https://test.hypha.app"
EMAIL_HOST="hypha.app"

EMAIL_SUBJECT_PREFIX="[Hypha] "
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/deployment/development/stand-alone.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Hypha supports configuration via either a `local.py` or a `.env` file:

```bash title="./.env"
ALLOWED_HOSTS=hypha.test
BASE_URL=http://hypha.test
WAGTAILADMIN_BASE_URL=http://hypha.test
SECRET_KEY=<put-in-long-random-string>
DATABASE_URL=postgres://localhost/hypha
```
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/deployment/production/stand-alone.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Here is a list of settings that can be set as environment variables or in a `hyp
```text
SECRET_KEY: [KEY]
DJANGO_SETTINGS_MODULE: hypha.settings.production
PRIMARY_HOST: www.example.org
WAGTAILADMIN_BASE_URL: https://apply.example.org
EMAIL_HOST: example.org
ORG_EMAIL: hello@example.org
ORG_GUIDE_URL: https://guide.example.org/
Expand Down
6 changes: 5 additions & 1 deletion hypha/apply/activity/adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ def process_send(
debug_message = _("{adapter}: {message}").format(
adapter=self.adapter_type, message=message
)
messages.add_message(request, messages.DEBUG, debug_message)
# Fails silently as notifications sent outside the
# request cycle have no message storage to write to.
messages.add_message(
request, messages.DEBUG, debug_message, fail_silently=True
)

def create_logs(self, message, recipient, *events):
from ..models import Message
Expand Down
7 changes: 3 additions & 4 deletions hypha/apply/activity/adapters/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ def slack_links(self, links, sources):
def extra_kwargs(self, message_type, **kwargs):
source = kwargs["source"]
sources = kwargs["sources"]
request = kwargs["request"]
related = kwargs["related"]
link = link_to(source, request)
link_related = link_to(related, request)
links = {source.id: link_to(source, request) for source in sources}
link = link_to(source)
link_related = link_to(related)
links = {source.id: link_to(source) for source in sources}
return {
"link": link,
"link_related": link_related,
Expand Down
5 changes: 3 additions & 2 deletions hypha/apply/activity/adapters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
FINANCE_GROUP_NAME,
STAFF_GROUP_NAME,
)
from hypha.core.utils import get_base_url


def link_to(target, request):
def link_to(target):
if target and hasattr(target, "get_absolute_url"):
return request.scheme + "://" + request.get_host() + target.get_absolute_url()
return get_base_url() + target.get_absolute_url()


def group_reviewers(reviewers):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}

{# fmt:off #}
{% block pre_salutation %}{% for co_applicant in source.co_applicants.all %}{% if recipient == co_applicant.user.email %}
Expand All @@ -11,9 +11,9 @@
{% block salutation %}{% blocktrans with name=source.user.get_full_name|default:"applicant" %}Dear {{ name }},{% endblocktrans %}{% endblock %}

{# fmt:off #}
{% block more_info %}{% if source.submission %}{% trans "View your project here" %}{% else %}{% trans "View your submission here" %}{% endif %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% block more_info %}{% if source.submission %}{% trans "View your project here" %}{% else %}{% trans "View your submission here" %}{% endif %}: {% base_url %}{{ source.get_absolute_url }}

{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{% if source.submission %}{% url 'funds:submissions:comments' pk=source.submission.pk %}{% else %}{% url 'funds:submissions:comments' pk=source.pk %}{% endif %}
{% trans "If you have any questions, please submit them here" %}: {% base_url %}{% if source.submission %}{% url 'funds:submissions:comments' pk=source.submission.pk %}{% else %}{% url 'funds:submissions:comments' pk=source.pk %}{% endif %}

{% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}

{% block content %}{# fmt:off #}
{% trans "Project documents are ready to be assigned for approval." %}

{% trans "Title" %}: {{ source.title_text_display }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Link" %}: {% base_url %}{% url 'apply:projects:approval' pk=source.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "messages/email/applicant_base.html" %}

{% load i18n %}
{% load i18n util_tags %}

{% block content %}{# fmt:off #}
{% blocktrans with title=source.title %}You have been assigned as an Applicant to submission "{{ title }}".{% endblocktrans %}
{% endblock %}

{% block more_info %}
{% trans "Link to your submission" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}#communications
{% trans "Link to your submission" %}: {% base_url %}{{ source.get_absolute_url }}
{% trans "If you have any questions, please submit them here" %}: {% base_url %}{{ source.get_absolute_url }}#communications

{% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% trans "Dear Reviewer," %}{% endblock %}

{% block content %}{# fmt:off #}
{% trans "New applications have been added to your review list." %}
{% for submission in sources %}
{% trans "Title" %}: {{ submission.title_text_display }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ submission.get_absolute_url }}
{% trans "Link" %}: {% base_url %}{{ submission.get_absolute_url }}
{% endfor %}

{% endblock %}{# fmt:on #}
4 changes: 2 additions & 2 deletions hypha/apply/activity/templates/messages/email/comment.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "messages/email/applicant_base.html" %}

{% load i18n activity_tags %}
{% load i18n activity_tags util_tags %}
{% block salutation %}{% trans "Dear" %} {{ recipient }},{% endblock %}

{% block content %}{# fmt:off #}
Expand All @@ -9,7 +9,7 @@
{% display_name_for_email user as display_user %}
{% blocktrans with title=source.title user=comment.user %}There has been a new comment on "{{ title }}" by {{ display_user }}.{% endblocktrans %}

{% trans "Read the full comment here" %}: {{ request.scheme }}://{{ request.get_host }}{{ comment.get_absolute_url }}
{% trans "Read the full comment here" %}: {% base_url %}{{ comment.get_absolute_url }}
{% endblock %}

{% block more_info %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}

{% block salutation %}{% trans "Hey there," %}{% endblock %}

Expand All @@ -9,5 +9,5 @@
{% endblock %}

{% block more_info %}
{% trans "View it here" %}: {{ request.scheme }}://{{ request.get_host }}{{ comment.get_absolute_url }}
{% endblock %}
{% trans "View it here" %}: {% base_url %}{{ comment.get_absolute_url }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}

{% block salutation %}
{% if request.user != source.user %}
Expand All @@ -13,7 +13,7 @@
{% trans "A new contract has been added to your Project" %}:

{% trans "Title" %}: {{ source.title_text_display }}
{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "Link" %}: {% base_url %}{{ source.get_absolute_url }}

{% if contract.is_signed %}
{% trans "This contract has already been signed and there is no action for you to take." %}
Expand All @@ -25,8 +25,8 @@

{% block more_info %}
{% if request.user != source.user %}
{% trans "View your project here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'funds:submissions:comments' pk=source.submission.pk %}
{% trans "View your project here" %}: {% base_url %}{{ source.get_absolute_url }}
{% trans "If you have any questions, please submit them here" %}: {% base_url %}{% url 'funds:submissions:comments' pk=source.submission.pk %}

{% trans "See our guide for more information" %}: {{ ORG_GUIDE_URL }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% extends "messages/email/applicant_base.html" %}
{% load nh3_tags i18n %}
{% load nh3_tags i18n util_tags %}

{% block content %}{# fmt:off #}
{% trans "Your application has been reviewed and the outcome is" %}: {{ determination.clean_outcome }}

{{ determination.message|nh3|striptags }}

{% trans "Read the full determination here" %}: {{ request.scheme }}://{{ request.get_host }}{{ determination.get_absolute_url }}
{% trans "Read the full determination here" %}: {% base_url %}{{ determination.get_absolute_url }}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "messages/email/base.html" %}
{% load i18n activity_tags %}
{% load i18n activity_tags util_tags %}

{% block salutation %}{% if invited_user %}{% blocktrans with name=invited_user.get_display_name %}Dear {{ name }},{% endblocktrans %}{% else %}{% blocktrans with name=related.invited_user_email|email_name %}Dear {{ name }},{% endblocktrans %}{% endif %}{% endblock %}

Expand All @@ -10,6 +10,6 @@
{% else %}
{% blocktrans %}Click on link if you want to accept it.{% endblocktrans %}

{% trans "Link" %}: {{ request.scheme }}://{{ request.get_host }}{{ accept_link }}
{% trans "Link" %}: {% base_url %}{{ accept_link }}
{% endif %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "messages/email/applicant_base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block content %}{# fmt:off #}
{% blocktrans %}We’ve reviewed your Concept note and think it could be a good fit for {{ ORG_SHORT_NAME }} funding. We would like to invite you to submit a Proposal with more details about your project. You will receive a second email linking to a determination message with detailed feedback.{% endblocktrans %}

{% blocktrans %}Please review our Proposal Guide at {{ ORG_GUIDE_URL }} to learn more about the information we’d like to see. In the proposal please also address the feedback we provided in the concept note determination.{% endblocktrans %}{% endblock %}

{% block more_info %}
{% trans "Here is the link to start creating your proposal" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "If you have any questions, please submit them here" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'funds:submissions:comments' pk=source.pk %}
{% trans "Here is the link to start creating your proposal" %}: {% base_url %}{{ source.get_absolute_url }}
{% trans "If you have any questions, please submit them here" %}: {% base_url %}{% url 'funds:submissions:comments' pk=source.pk %}

{% blocktrans %}The system will allow you to save a draft of your proposal as you work on it. When you feel it is ready for our review, please click the “Submit” button and we’ll know to take a look at it. We’ll reply to you with feedback on your Proposal as quickly as possible.{% endblocktrans %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}
{% block content %}{# fmt:off #}
{% blocktrans with title=source.title_text_display %}An invoice on project "{{title}}" is waiting for your approval.{% endblocktrans %}

{% trans "View the invoice here" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }}
{% trans "View the invoice here" %}: {% base_url %}{{ invoice.get_absolute_url }}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}
{% block content %}{# fmt:off #}
{% blocktrans with title=source.title_text_display %}A new invoice has been submitted for project "{{title}}".{% endblocktrans %}

{% trans "View the invoice here" %}: {{ request.scheme }}://{{ request.get_host }}{{ related.get_absolute_url }}
{% trans "View the invoice here" %}: {% base_url %}{{ related.get_absolute_url }}

{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "messages/email/applicant_base.html" %}

{% load i18n invoice_tools %}
{% load i18n invoice_tools util_tags %}

{% block content %}{# fmt:off #}
{% display_invoice_status_for_user source.user invoice as invoice_status %}
Expand All @@ -9,9 +9,9 @@
{% blocktrans with status=invoice_status %}It's status is now "{{ status }}".{% endblocktrans %}

{% if invoice.comment %}
{% trans "A staff member left a comment that can be read here" %}: {{ request.scheme }}://{{ request.get_host }}{{ comment_url }}
{% trans "A staff member left a comment that can be read here" %}: {% base_url %}{{ comment_url }}
{% endif %}

{% trans "View your invoice here" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }}
{% trans "View your invoice here" %}: {% base_url %}{{ invoice.get_absolute_url }}

{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "messages/email/base.html" %}

{% load i18n invoice_tools %}
{% load i18n invoice_tools util_tags %}

{% block content %}{# fmt:off #}
{% display_invoice_status_for_user user invoice as invoice_status %}
Expand All @@ -9,9 +9,9 @@
{% blocktrans with status=invoice_status %}It's status is now "{{ status }}".{% endblocktrans %}

{% if invoice.comment %}
{% trans "A comment was left that can be read here" %}: {{ request.scheme }}://{{ request.get_host }}{{ comment_url }}
{% trans "A comment was left that can be read here" %}: {% base_url %}{{ comment_url }}
{% endif %}

{% trans "View the invoice here" %}: {{ request.scheme }}://{{ request.get_host }}{{ invoice.get_absolute_url }}
{% trans "View the invoice here" %}: {% base_url %}{{ invoice.get_absolute_url }}

{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% extends "messages/email/applicant_base.html" %}

{% load i18n invoice_tools %}
{% load i18n invoice_tools util_tags %}
{% block content %}{# fmt:off #}

{% blocktrans with title=source.title_text_display %}An {{ ORG_SHORT_NAME }} staff member has updated an invoice on your project "{{ title }}".{% endblocktrans %}

{% trans "View the invoice here:" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "View the invoice here:" %}: {% base_url %}{{ source.get_absolute_url }}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}

{% block content %}{# fmt:off #}
{% blocktrans with title=source.title_text_display %}The {{ title }} project is awaiting your review.{% endblocktrans %}

{% trans "View the project here" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "View the project here" %}: {% base_url %}{% url 'apply:projects:approval' pk=source.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}

{% block content %}{# fmt:off #}
{% blocktrans with title=source.title_text_display %}The project "{{title}}" is awaiting final approval.{% endblocktrans %}

{% trans "Approve the project here" %}: {{ request.scheme }}://{{ request.get_host }}{% url 'apply:projects:approval' pk=source.pk %}
{% trans "Approve the project here" %}: {% base_url %}{% url 'apply:projects:approval' pk=source.pk %}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}

{% block content %}{# fmt:off #}
{% blocktrans with title=source.title_text_display %}The project forms for "{{ title }}" was rejected by project form reviewers, please update it accordingly and resubmit it to the reviewers. {% endblocktrans %}

{% if comment_url %}
{% trans "A comment was left that can be viewed here" %}: {{ request.scheme }}://{{ request.get_host }}{{ comment_url }}
{% trans "A comment was left that can be viewed here" %}: {% base_url %}{{ comment_url }}
{% endif %}

{% trans "View the project here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "View the project here" %}: {% base_url %}{{ source.get_absolute_url }}
{% endblock %}{# fmt:on #}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends "messages/email/base.html" %}

{% load i18n %}
{% load i18n util_tags %}
{% block salutation %}{% endblock %}

{% block content %}{# fmt:off #}
{% blocktrans with title=source.title_text_display%}The project "{{ title }}" is waiting for contract.{% endblocktrans %}

{% trans "View the project here" %}: {{ request.scheme }}://{{ request.get_host }}{{ source.get_absolute_url }}
{% trans "View the project here" %}: {% base_url %}{{ source.get_absolute_url }}

{% blocktrans with lead=source.lead email=source.lead.email %}Please contact {{ lead }} - {{ email }} if you have any questions.{% endblocktrans %}
{% endblock %}{# fmt:on #}
Loading