Skip to content

Commit

Permalink
Remove bug_support option
Browse files Browse the repository at this point in the history
Route bug_suppoert selection to moderation tool
  • Loading branch information
akatsoulas committed Dec 5, 2024
1 parent 1916951 commit de2aea2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 16 deletions.
3 changes: 0 additions & 3 deletions kitsune/flagit/jinja2/flagit/queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ <h3 class="sumo-card-heading"><br>{{ _('Update Status:') }}</h3>
{% elif object.reason == "abuse" %}
<option value="1">{{ _('Addressed abusive content.') }}</option>
<option value="2">{{ _('No abuse detected.') }}</option>
{% elif object.reason == "bug_support" %}
<option value="1">{{ _('Request moved.') }}</option>
<option value="2">{{ _('Request is appropriately placed.') }}</option>
{% elif object.reason == "language" %}
<option value="1">{{ _('Corrected language.') }}</option>
<option value="2">{{ _('Language is appropriate.') }}</option>
Expand Down
27 changes: 27 additions & 0 deletions kitsune/flagit/migrations/0004_alter_flaggedobject_reason.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.16 on 2024-12-04 06:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("flagit", "0003_alter_flaggedobject_reason"),
]

operations = [
migrations.AlterField(
model_name="flaggedobject",
name="reason",
field=models.CharField(
choices=[
("spam", "Spam or other unrelated content"),
("language", "Inappropriate language/dialog"),
("abuse", "Abusive content"),
("other", "Other (please specify)"),
],
default="spam",
max_length=64,
),
),
]
2 changes: 0 additions & 2 deletions kitsune/flagit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ class FlaggedObject(ModelBase):

REASON_SPAM = "spam"
REASON_LANGUAGE = "language"
REASON_BUG_SUPPORT = "bug_support"
REASON_ABUSE = "abuse"
REASON_CONTENT_MODERATION = "content_moderation"
REASON_OTHER = "other"
REASONS = (
(REASON_SPAM, _lazy("Spam or other unrelated content")),
(REASON_LANGUAGE, _lazy("Inappropriate language/dialog")),
(REASON_BUG_SUPPORT, _lazy("Misplaced bug report or support request")),
(REASON_ABUSE, _lazy("Abusive content")),
(REASON_OTHER, _lazy("Other (please specify)")),
)
Expand Down
12 changes: 9 additions & 3 deletions kitsune/flagit/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,25 @@ def flag(request, content_type=None, model=None, object_id=None, **kwargs):
notes = request.POST.get("other", "")
next = request.POST.get("next")

FlaggedObject.objects.filter(
moderation_flag = FlaggedObject.objects.filter(
content_type=content_type,
object_id=object_id,
reason=FlaggedObject.REASON_CONTENT_MODERATION,
status=FlaggedObject.FLAG_PENDING,
).delete()
)
# Check that this user hasn't already flagged the object
_flagged, created = FlaggedObject.objects.get_or_create(
content_type=content_type,
object_id=object_id,
creator=request.user,
defaults={"content_object": content_object, "reason": reason, "notes": notes},
)
if reason == FlaggedObject.REASON_CONTENT_MODERATION:
moderation_flag.update(status=FlaggedObject.FLAG_PENDING)
# If the object is flagged again as pending, treat it as new flag
created = True
else:
moderation_flag.delete()

msg = (
_("You already flagged this content.")
if not created
Expand Down
2 changes: 1 addition & 1 deletion kitsune/questions/jinja2/questions/question_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h2 class="sumo-callout-heading summary {% if product %}no-product-heading{% end
<span class="icon-button" data-has-dropdown>more options</span>
<ul class="mzp-c-menu-list-list">
{% if user.is_authenticated and question.allows_flag(user) %}
<li class="mzp-c-menu-list-item">{{ flag_form(url('questions.flag', question.id), question.id) }}</li>
<li class="mzp-c-menu-list-item">{{ flag_form(url('questions.flag', question.id), question.id, content_moderation=True) }}</li>
{% endif %}
<li class="mzp-c-menu-list-item"><a class="quoted-reply" href="#question-reply" data-content-id="question-{{ question.id }}">{{ _('Quote') }}</a></li>
</ul>
Expand Down
13 changes: 6 additions & 7 deletions kitsune/wiki/jinja2/wiki/includes/flag_form.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro flag_form(post_target, identifier, bug_support=True) %}
{% macro flag_form(post_target, identifier, content_moderation=False) %}
<a href="javascript:;" data-sumo-modal="report-abuse-{{ identifier }}">{{ _('Report Abuse') }}</a>
<section id="report-abuse-{{ identifier }}" class="mzp-u-modal-content">
<h2 class="sumo-page-subheading">{{ _('Report this') }}</h2>
Expand All @@ -12,11 +12,11 @@ <h2 class="sumo-page-subheading">{{ _('Report this') }}</h2>
<input type="radio" name="reason" id="id_{{ post_target|slugify}}_language" value="language" />
<label for="id_{{ post_target|slugify}}_language">{{ _('Inappropriate language/dialog') }}</label>
</div>
{% if bug_support %}
<div class="field radio is-condensed">
<input type="radio" name="reason" value="bug_support" id="id_{{ post_target|slugify}}_bug_support" />
<label for="id_{{ post_target|slugify}}_bug_support">{{ _('Misplaced bug report or support request') }}</label>
</div>
{% if content_moderation %}
<div class="field radio is-condensed">
<input type="radio" name="reason" value="content_moderation" id="id_{{ post_target|slugify}}_content_moderation" />
<label for="id_{{ post_target|slugify}}_content_moderation">{{ _('Misplaced bug report or support request') }}</label>
</div>
{% endif %}
<div class="field radio is-condensed">
<input type="radio" id="id_{{ post_target|slugify}}_abuse" name="reason" value="abuse" />
Expand All @@ -34,7 +34,6 @@ <h2 class="sumo-page-subheading">{{ _('Report this') }}</h2>
<button class="sumo-button primary-button" type="submit">{{ _('Submit') }}</button>
</div>
</form>

<span class="message"></span>
</section>
{% endmacro %}

0 comments on commit de2aea2

Please sign in to comment.