Skip to content
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

Add magic link to open patches in user's mail client #578

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions patchwork/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ class EmailForm(forms.Form):
class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ['items_per_page', 'show_ids']
labels = {'show_ids': 'Show Patch IDs:'}
fields = ['items_per_page', 'show_ids', 'mid_scheme']
labels = {'show_ids': 'Show Patch IDs:',
'mid_scheme': 'Message URL scheme'}


def _get_delegate_qs(project, instance=None):
Expand Down
22 changes: 22 additions & 0 deletions patchwork/migrations/0047_userprofile_mid_scheme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.2.7 on 2024-01-11 04:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('patchwork', '0046_patch_comment_events'),
]

operations = [
migrations.AddField(
model_name='userprofile',
name='mid_scheme',
field=models.CharField(
blank=True,
help_text='URL scheme to use when opening message IDs',
max_length=255,
),
),
]
1 change: 1 addition & 0 deletions patchwork/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class UserProfile(models.Model):
default=False,
help_text='Show click-to-copy patch IDs in the list view',
)
mid_scheme = models.CharField(max_length=255, blank=True, help_text="URL scheme to use when opening message IDs")

@property
def name(self):
Expand Down
3 changes: 3 additions & 0 deletions patchwork/templates/patchwork/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ <h1>{{ submission.name }}</h1>
(<a href="{{ submission.list_archive_url }}">mailing list archive</a>)
{% endif %}
<span class="btn-link btn-copy glyphicon glyphicon-copy" data-clipboard-text="{{ submission.url_msgid }}" title="Copy to Clipboard"></span>
{% if user.is_authenticated and user.profile.mid_scheme %}
<a href="{{user.profile.mid_scheme}}:<{{submission.url_msgid}}>" title="Open Message"><span class="btn-link glyphicon glyphicon-new-window"></span></a>
{% endif %}
</td>
</tr>
{% if submission.state %}
Expand Down
Loading