Skip to content

Commit

Permalink
Merge branch 'comses:main' into smoke-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesSheelam authored May 27, 2024
2 parents f9c91a1 + a1dfcc3 commit a9ff290
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion django/core/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 17 additions & 3 deletions django/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
26 changes: 13 additions & 13 deletions django/home/jinja2/home/index.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@
<h3>Publish your Code</h3>
</a>
<div class='caption'>
Preserve the <a href='https://www.acm.org/publications/policies/artifact-review-badging'>digital
artifacts</a> used to derive a publishable finding in an open digital repository that supports
discovery and good practices for <a href='https://peerj.com/articles/cs-86/'>software citation</a>,
reproducibility, and reuse.
Preserve the <a href='https://www.acm.org/publications/policies/artifact-review-and-badging-current'>digital artifacts and context</a> used to derive a published research finding in an open digital repository that supports <a href='https://doi.org/10.15497/RDA00068'>FAIR practices for Research Software</a>, <a href='https://peerj.com/articles/cs-86/'>software citation</a>, reproducibility, and reuse.
<br/><br/>
<a href='{{ slugurl("guides-to-good-practice") }}'>Promote good practices</a> for developing, documenting, and publishing computational models.
</div>
</div>
<div class='col'>
Expand All @@ -78,23 +77,24 @@
</a>
<div class='caption'>
<ul class="mb-0">
<li>Subscribe to our <a href='https://www.youtube.com/user/CoMSESNet/playlists'>YouTube channel</a></li>
<li><a href='{{ slugurl("education") }}'>Educational resources</a></li>
<li><a href='{{ slugurl("standards") }}'>Computational modeling standards</a></li>
<li><a href='{{ slugurl("modeling-frameworks") }}'>Software frameworks</a> for agent based / computational modeling</li>
<li><a href='{{ slugurl("guides-to-good-practice") }}'>Guides to good practice</a> for developing, documenting, and archiving computational models</li>
<li>An <a href='{{ slugurl("open-code-badge") }}'>Open Code Badge</a> to mark computational models that meet baseline standards for accessibility and reuse</li>
<li><a href='{{ slugurl("standards") }}'>Standards for computational modeling</a></li>
<li><a href='{{ slugurl("modeling-frameworks") }}'>Software frameworks</a> for computational
modeling</li>
<li><a href='{{ slugurl("open-code-badge") }}'>Open Code Badge</a> for exemplar computational models</li>
</ul>
</div>
</div>
<div class='col'>
<a href='{{ url("core:event-list") }}'>
<img src='{{ static("images/icons/groups.png") }}' alt='Upcoming Events'>
<h3>Upcoming Events</h3>
<img src='{{ static("images/icons/groups.png") }}' alt='Community Events and Jobs'>
<h3>Community Events and Jobs</h3>
</a>
<div class='caption'>
Upcoming conferences, workshops, and events of interest for the computational modeling community.
CoMSES also organizes and <a href='{{ slugurl("conference") }}'>hosts an annual Virtual
Conference every October</a> with a mix of community submitted and invited video presentations.
Upcoming conferences, workshops, training opportunities, schools, and <a href='{{ url("core:event-list") }}'>events of broad interest</a> for
the computational modeling community as well as <a href='{{ url("core:job-list") }}'>an open jobs board
for computational modelers in academia and industry</a>.
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion django/library/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
2 changes: 1 addition & 1 deletion staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a9ff290

Please sign in to comment.