From 729ef5f01ac5c5aed27a016e40334efb594df725 Mon Sep 17 00:00:00 2001 From: Allen Lee Date: Wed, 22 May 2024 00:24:07 -0700 Subject: [PATCH 1/3] content: add youtube channel to landing page --- django/home/jinja2/home/index.jinja | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/django/home/jinja2/home/index.jinja b/django/home/jinja2/home/index.jinja index 1b8e43f0a..ef5e6dcc9 100644 --- a/django/home/jinja2/home/index.jinja +++ b/django/home/jinja2/home/index.jinja @@ -65,10 +65,13 @@

Publish your Code

- Preserve the digital - artifacts used to derive a publishable finding in an open digital repository that supports - discovery and good practices for software citation, + Preserve the digital artifacts and context used to derive a published research finding in an open digital repository that supports + FAIR practices for Research Software, software citation, reproducibility, and reuse. +
@@ -78,11 +81,10 @@
@@ -93,8 +95,6 @@
Upcoming conferences, workshops, and events of interest for the computational modeling community. - CoMSES also organizes and hosts an annual Virtual - Conference every October with a mix of community submitted and invited video presentations.
From fadf50587e10a4af623dfd3e1a75ba18e248ebb4 Mon Sep 17 00:00:00 2001 From: Allen Lee Date: Wed, 22 May 2024 11:15:15 -0700 Subject: [PATCH 2/3] fix: keep index.Indexed on the concrete classes to be indexed in ES causes errors in general site search otherwise as wagtail search expects a core.ModeratedContent model instead of the actual Job/Event/Codebase etc. models --- base.yml | 2 +- django/core/mixins.py | 2 +- django/core/models.py | 20 +++++++++++++++++--- django/library/models.py | 2 +- staging.yml | 2 +- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/base.yml b/base.yml index b706ee179..9708e9c7a 100644 --- a/base.yml +++ b/base.yml @@ -50,7 +50,7 @@ services: POSTGRES_PASSWORD_FILE: /run/secrets/db_password vite: build: frontend - image: comses/comsesnet-vite + image: comses/vite volumes: - /code/node_modules - ./docker/shared:/shared diff --git a/django/core/mixins.py b/django/core/mixins.py index 9bb16fb3c..f93a23c43 100644 --- a/django/core/mixins.py +++ b/django/core/mixins.py @@ -280,7 +280,7 @@ def handle_spam_detection(self, serializer: serializers.Serializer): def _record_spam(self, instance, spam_context: dict): content_type = ContentType.objects.get_for_model(type(instance)) - # SpamContent updates the content instance on save + # SpamModeration updates the content instance on save spam_moderation, created = SpamModeration.objects.get_or_create( content_type=content_type, object_id=instance.pk, diff --git a/django/core/models.py b/django/core/models.py index 0920ea752..97b2e5696 100644 --- a/django/core/models.py +++ b/django/core/models.py @@ -138,8 +138,13 @@ def update_related_object(self): related_object.is_marked_spam = self.status != self.Status.NOT_SPAM related_object.save() + def __str__(self): + return ( + f"SpamModeration: {self.status} - {self.reviewer} - {self.content_object}" + ) + -class ModeratedContent(index.Indexed, models.Model): +class ModeratedContent(models.Model): spam_moderation = models.ForeignKey( SpamModeration, null=True, blank=True, on_delete=models.SET_NULL ) @@ -152,6 +157,15 @@ class ModeratedContent(index.Indexed, models.Model): ), ) + def mark_spam(self, status=SpamModeration.Status.SPAM, **kwargs): + content_type = ContentType.objects.get_for_model(type(self)) + self.spam_moderation, created = SpamModeration.objects.get_or_create( + status=status, + object_id=self.pk, + content_type=content_type, + **kwargs, + ) + class Meta: abstract = True @@ -634,7 +648,7 @@ def public(self): @add_to_comses_permission_whitelist -class Event(ModeratedContent, ClusterableModel): +class Event(index.Indexed, ModeratedContent, ClusterableModel): title = models.CharField(max_length=300) date_created = models.DateTimeField(default=timezone.now) last_modified = models.DateTimeField(auto_now=True) @@ -767,7 +781,7 @@ def latest_for_feed(self, number=10): @add_to_comses_permission_whitelist -class Job(ModeratedContent, ClusterableModel): +class Job(index.Indexed, ModeratedContent, ClusterableModel): title = models.CharField(max_length=300, help_text=_("Job posting title")) date_created = models.DateTimeField(default=timezone.now) application_deadline = models.DateField( diff --git a/django/library/models.py b/django/library/models.py index f81f4ad96..72bdcc8ab 100644 --- a/django/library/models.py +++ b/django/library/models.py @@ -499,7 +499,7 @@ def get_all_release_programming_languages(self, codebase): @add_to_comses_permission_whitelist -class Codebase(ModeratedContent, ClusterableModel): +class Codebase(index.Indexed, ModeratedContent, ClusterableModel): """ Metadata applicable across a set of CodebaseReleases """ diff --git a/staging.yml b/staging.yml index 8e2292ecd..3c43a7055 100644 --- a/staging.yml +++ b/staging.yml @@ -34,7 +34,7 @@ services: - esdata2:/usr/share/elasticsearch/data vite: build: frontend - image: comses/comsesnet-vite:${RELEASE_VERSION} + image: comses/vite:${RELEASE_VERSION} command: ["npm", "run", "build"] environment: NODE_ENV: "production" From a1dfcc394463bb0e17e5b6abfe2073ff9dc1dbd7 Mon Sep 17 00:00:00 2001 From: Allen Lee Date: Wed, 22 May 2024 11:16:43 -0700 Subject: [PATCH 3/3] content: add link to youtube channel on landing page minor text reorganization, probably still too many links in text --- django/home/jinja2/home/index.jinja | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/django/home/jinja2/home/index.jinja b/django/home/jinja2/home/index.jinja index ef5e6dcc9..d85d7b287 100644 --- a/django/home/jinja2/home/index.jinja +++ b/django/home/jinja2/home/index.jinja @@ -65,13 +65,9 @@

Publish your Code

- Preserve the digital artifacts and context used to derive a published research finding in an open digital repository that supports - FAIR practices for Research Software, software citation, - reproducibility, and reuse. -
    -
  • Advertise and link to computational models that meet baseline standards for accessibility and reuse with an Open Code Badge
  • -
  • Promote good practices for developing, documenting, and publishing computational models
  • -
+ Preserve the digital artifacts and context used to derive a published research finding in an open digital repository that supports FAIR practices for Research Software, software citation, reproducibility, and reuse. +

+ Promote good practices for developing, documenting, and publishing computational models.
@@ -81,20 +77,24 @@
- Upcoming Events -

Upcoming Events

+ Community Events and Jobs +

Community Events and Jobs

- Upcoming conferences, workshops, and events of interest for the computational modeling community. + Upcoming conferences, workshops, training opportunities, schools, and events of broad interest for + the computational modeling community as well as an open jobs board + for computational modelers in academia and industry.