-
Notifications
You must be signed in to change notification settings - Fork 3
Add custom label for percolate query subscriptions #1610
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
Changes from all commits
c9e39dc
07be562
fd4eefb
5025437
b30f09b
686dcf4
40551bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Generated by Django 4.2.16 on 2024-09-25 18:26 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("learning_resources_search", "0004_alter_percolatequery_source_type"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="percolatequery", | ||
| name="display_label", | ||
| field=models.CharField( | ||
| blank=True, | ||
| help_text="Friendly display label for the query", | ||
| max_length=255, | ||
| ), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,12 @@ class PercolateQuery(TimestampedModel): | |
| source_type = models.CharField( | ||
| max_length=255, choices=[(choice, choice) for choice in SOURCE_TYPES] | ||
| ) | ||
|
|
||
| display_label = models.CharField( | ||
| max_length=255, | ||
| blank=True, | ||
| help_text="Friendly display label for the query", | ||
| ) | ||
| users = models.ManyToManyField(User, related_name="percolate_queries") | ||
|
|
||
| def source_label(self): | ||
|
|
@@ -37,6 +43,8 @@ def source_label(self): | |
|
|
||
| def source_description(self): | ||
| channel = self.source_channel() | ||
| if self.display_label: | ||
| return self.display_label | ||
| if channel: | ||
| return channel.title | ||
| return self.original_url_params() | ||
|
Member
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.
Member
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. One thing I found a bit counterintuitive but is outside the scope of this PR: the
Contributor
Author
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. working on another pr for sending the emails I can see about changing this there. |
||
|
|
||

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.
Outside of this scope's PR changes, but should this function also take the
source_typeinto consideration?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.
potentially. - im currently working on another PR that involves sending actual emails for percolated searches so this might change there