[odrs-web] Remove the pubic Taboo endpoint as it's a liability
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web] Remove the pubic Taboo endpoint as it's a liability
- Date: Wed, 16 Mar 2022 16:54:01 +0000 (UTC)
commit f5a3947ab4067c51b6fc23383bd0f9750df40155
Author: Richard Hughes <richard hughsie com>
Date: Wed Mar 16 16:50:10 2022 +0000
Remove the pubic Taboo endpoint as it's a liability
app_data/odrs/tests/odrs_test.py | 15 ---------------
app_data/odrs/views_api.py | 19 +------------------
2 files changed, 1 insertion(+), 33 deletions(-)
---
diff --git a/app_data/odrs/tests/odrs_test.py b/app_data/odrs/tests/odrs_test.py
index 1180f32..0cafe39 100644
--- a/app_data/odrs/tests/odrs_test.py
+++ b/app_data/odrs/tests/odrs_test.py
@@ -301,21 +301,6 @@ class OdrsTest(unittest.TestCase):
rv = self.app.get('/admin/taboo/1/delete', follow_redirects=True)
assert b'No taboo with ID' in rv.data, rv.data
- def test_api_taboo(self):
-
- # unauth
- rv = self.app.get('/1.0/reviews/api/taboo/all')
- assert b'{}' in rv.data, rv.data
-
- self.login()
- rv = self._admin_taboo_add()
- assert b'Added taboo' in rv.data, rv.data
- self.logout()
-
- # unauth
- rv = self.app.get('/1.0/reviews/api/taboo/all')
- assert b'inkscape' in rv.data, rv.data
-
def test_api_submit_when_banned(self):
# submit abusive review
diff --git a/app_data/odrs/views_api.py b/app_data/odrs/views_api.py
index d3c6e16..1e3a8cf 100644
--- a/app_data/odrs/views_api.py
+++ b/app_data/odrs/views_api.py
@@ -11,8 +11,6 @@ import json
import math
import datetime
-from collections import defaultdict
-
from sqlalchemy.dialects.mysql import insert
from sqlalchemy.exc import IntegrityError
@@ -20,7 +18,7 @@ from flask import request, Response
from odrs import app, db, csrf
-from .models import Review, User, Vote, Analytic, Taboo, Component
+from .models import Review, User, Vote, Analytic, Component
from .models import _vote_exists
from .util import json_success, json_error, _locale_is_compatible, _eventlog_add, _get_user_key,
_get_datestr_from_dt
from .util import _sanitised_version, _sanitised_summary, _sanitised_description, _get_rating_for_component
@@ -492,21 +490,6 @@ def api_rating_for_id(app_id):
status=200, \
mimetype='application/json')
-@app.route('/1.0/reviews/api/taboo/all')
-def api_taboo_all():
- """
- Get all registered forbidden words.
- """
- items = defaultdict(list)
- for taboo in db.session.query(Taboo).\
- order_by(Taboo.locale.asc()).\
- order_by(Taboo.value.asc()).all():
- items[taboo.locale].append(taboo.asdict())
- dat = json.dumps(items, sort_keys=True, indent=4, separators=(',', ': '))
- return Response(response=dat,
- status=200, \
- mimetype='application/json')
-
@app.route('/1.0/reviews/api/ratings')
def api_ratings():
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]