-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[front] feat: add pages Top Videos, For You and Search (#1984)
- Loading branch information
1 parent
801ef15
commit fa3fb06
Showing
67 changed files
with
2,497 additions
and
1,157 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Generated by Django 4.2.14 on 2024-07-17 12:44 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def copy_setting(user, from_key, to_key): | ||
try: | ||
value = user.settings["videos"][from_key] | ||
except KeyError: | ||
return False | ||
|
||
user.settings["videos"][to_key] = value | ||
return True | ||
|
||
|
||
def migrate_reco_settings_forward(apps, schema_editor): | ||
User = apps.get_model("core", "User") | ||
for user in User.objects.iterator(): | ||
if "videos" not in user.settings: | ||
continue | ||
|
||
# We don't migrate the default_unsafe setting, because we think many | ||
# users would appreciate the default configuration of the feed For you. | ||
copied = map( | ||
copy_setting, | ||
[user] * 5, | ||
[ | ||
"recommendations__default_date", | ||
"recommendations__default_languages", | ||
"recommendations__default_exclude_compared_entities", | ||
"recommendations__default_languages", | ||
], | ||
[ | ||
"feed_foryou__date", | ||
"feed_foryou__languages", | ||
"feed_foryou__exclude_compared_entities", | ||
"feed_topitems__languages", | ||
], | ||
) | ||
|
||
if any(list(copied)): | ||
user.save(update_fields=["settings"]) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("core", "0015_use_unlogged_cache_table"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
code=migrate_reco_settings_forward, reverse_code=migrations.RunPython.noop | ||
), | ||
] |
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
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.