-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge application and project communication tabs #4349
Open
wes-otf
wants to merge
7
commits into
main
Choose a base branch
from
enhancement/merge-project-app-comms
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f5a9a0c
Moved project comments to the associated application
wes-otf b5ba384
Added comment count
wes-otf e6679a1
Inclusion of project activities and more accurately naming
wes-otf 3dce13e
Logic for applications w/o projects
wes-otf e9103e7
Removed residual unused activity code
wes-otf 911de36
Cleaned up logic
wes-otf ba80f5f
Simplified source filter logic, updated activity tag
wes-otf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
hypha/apply/projects/migrations/0097_move_project_comments_to_application.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.17 on 2025-01-07 17:57 | ||
|
||
from django.db import migrations | ||
from hypha.apply.activity.models import COMMENT | ||
|
||
|
||
def migrate_project_comments_to_application(apps, schema_editor): | ||
Activity = apps.get_model("activity", "Activity") | ||
ContentType = apps.get_model("contenttypes", "ContentType") | ||
Project = apps.get_model("application_projects", "Project") | ||
ApplicationSubmission = apps.get_model("funds", "ApplicationSubmission") | ||
project_type = ContentType.objects.get_for_model(Project) | ||
application_type = ContentType.objects.get_for_model(ApplicationSubmission) | ||
for comment in Activity.objects.filter( | ||
type=COMMENT, source_content_type=project_type | ||
): | ||
application = Project.objects.get(id=comment.source_object_id).submission | ||
comment.source_content_type = application_type | ||
comment.source_object_id = application.id | ||
comment.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("application_projects", "0096_remove_invoicedeliverable_deliverable_and_more"), | ||
] | ||
|
||
operations = [migrations.RunPython(migrate_project_comments_to_application)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{% extends "base-apply.html" %} | ||
|
||
{% load i18n contract_tools static wagtailcore_tags approval_tools invoice_tools project_tags %} | ||
{% load i18n static wagtailcore_tags approval_tools invoice_tools project_tags %} | ||
{% load heroicons %} | ||
|
||
{% block title %}{{ object.title }}{% endblock %} | ||
|
@@ -208,31 +208,19 @@ <h5>{% trans "Project form approvals" %}</h5> | |
<div class="feed"> | ||
{% if not object.is_archive %} | ||
<h4 class="m-0 sr-only">{% trans "Add communication" %}</h4> | ||
{% include "activity/include/comment_form.html" %} | ||
{% include "activity/include/comment_form.html" with action=object.submission.get_absolute_url %} | ||
{% endif %} | ||
|
||
<div | ||
class="comments" | ||
id="comment-feed" | ||
hx-get="{% url 'activity:partial-comments' 'project' object.id %}" | ||
hx-get="{% url 'activity:partial-comments' 'submission' object.submission.id %}" | ||
hx-trigger="intersect once" | ||
> | ||
<p>{% trans "Loading…" %}</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{# Tab 3 #} | ||
<div class="tabs__content" id="tab-3"> | ||
<div | ||
class="feed ms-3" | ||
hx-get="{% url 'apply:projects:partial-activities' object.id %}" | ||
hx-trigger="intersect once" | ||
> | ||
{% comment %} Loaded using the htmx via alpine's custom event "open-tab-3"{% endcomment %} | ||
<p>{% trans "Loading…" %}</p> | ||
</div> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can delete this part from |
||
</div> | ||
{% endblock content %} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works but feels a bit, un neat. You go to
projects/p:n/#communications
, submit the form and end up onsubmissions/s:n/#communications
. Not that normal users look at the address bar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice catch, I didn't even notice that was the case with the redirect. Do you think it should be handled in htmx so the redirect doesn't happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or does it make sense now to break out communications to its own view and url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a good idea, I can explore that a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another (more temporary) solution is to change up the
get_success_url
to resolve to the referrer URL:So swapping
hypha/hypha/apply/activity/views.py
Lines 156 to 157 in b643557
with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The redirect is not a big issue so I do not tink we need hack around it.
If creating a stand alone view/url is a bit big we can do it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to break the PRs up, I can take a stab at breaking it out into it's own view