diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-09-10 13:16:22 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-09-10 13:17:07 -0400 |
commit | 6acf4ee60e3c07aea5bbd9e613335f0de1240d73 (patch) | |
tree | ff897644ee801d5faec2aba93f29a03866591083 /mediagoblin | |
parent | 25625107b6c7805b474ad7da976171991b259e58 (diff) | |
download | mediagoblin-6acf4ee60e3c07aea5bbd9e613335f0de1240d73.tar.lz mediagoblin-6acf4ee60e3c07aea5bbd9e613335f0de1240d73.tar.xz mediagoblin-6acf4ee60e3c07aea5bbd9e613335f0de1240d73.zip |
This should be my final code update before I am ready for review! Basically, in
this update I finished the search/sort function on the Reports Panel. I also
finished the Terms of Service and made the decision to remove the meta portion
of the site I had planned to create. I decided that the features involved were
just unnecessary at this point. I also dropped the User status column and added
a migration to establish default privileges (and create the privilege foundat-
-ions. I fixed a few small errors that were left over as well, in the implemen-
tation and in the tests. Next, I just need to await code review and work on the
documentation for these new features. I also need to supervise a new merge to
master.
===============================================================================
Dropped the vestigial 'status' column
===============================================================================
--\ mediagoblin/db/migrations.py
--\ mediagoblin/db/models.py
--| Also added in comments describing the current situation with the `is_admin`
| and `email_verified` columns, where they are 100% vestigial but cannot be
| dropped.
===============================================================================
Wrote necessary migrations to set up Privilege
foundations and give users the necessary privileges on an older
implementation of mediagoblin that is migrating into this update
===============================================================================
--\ mediagoblin/db/migrations.py
===============================================================================
Deleted the meta pages
===============================================================================
--\ Deleted mediagoblin/meta/__init__.py
--\ Deleted mediagoblin/meta/routing.py
--\ Deleted mediagoblin/meta/views.py
--\ Deleted mediagoblin/templates/mediagoblin/meta/code_of_conduct.html
--\ Deleted mediagoblin/templates/mediagoblin/meta/reports_details.html
--\ Deleted mediagoblin/templates/mediagoblin/meta/reports_panel.html
----------------------------------------------------------------
Moved the terms of service to /terms_of_service
----------------------------------------------------------------
--\ Moved mediagoblin/templates/mediagoblin/meta/terms_of_service.html
-> mediagoblin/templates/mediagoblin/terms_of_service.html
--| I decided that terms of service were really the only necessary part of my
| planned "meta" pages, so I moved it instead to its own singular page
--\ mediagoblin/routing.py
--\ mediagoblin/static/css/base.css
--\ mediagoblin/templates/mediagoblin/base.html
--\ mediagoblin/views.py
===============================================================================
Simplified & Finished the Reports Panel Searching
===============================================================================
--\ mediagoblin/moderation/forms.py
--\ mediagoblin/moderation/tools.py
--\ mediagoblin/moderation/views.py
--\ mediagoblin/templates/mediagoblin/moderation/report_panel.html
--\ mediagoblin/templates/mediagoblin/moderation/user.html
===============================================================================
Fixed Small Errors
===============================================================================
--\ mediagoblin/templates/mediagoblin/user_pages/user.html
--\ mediagoblin/tests/test_moderation.py
--\ mediagoblin/tests/tools.py
===============================================================================
Diffstat (limited to 'mediagoblin')
21 files changed, 185 insertions, 246 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 1c0a9291..984ef060 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -542,7 +542,7 @@ def create_moderation_tables(db): @RegisterMigration(16, MIGRATIONS) def update_user_privilege_columns(db): - metadata = MetaData(bind=db.bind) + # first, create the privileges which would be created by foundations default_privileges = Privilege.query.filter( Privilege.privilege_name !=u'admin').filter( Privilege.privilege_name !=u'moderator').filter( @@ -551,6 +551,7 @@ def update_user_privilege_columns(db): Privilege.privilege_name ==u'admin').first() active_privilege = Privilege.query.filter( Privilege.privilege_name ==u'active').first() + # then, assign them to the appropriate users for inactive_user in User.query.filter( User.status!=u'active').filter( User.is_admin==False).all(): @@ -569,3 +570,11 @@ def update_user_privilege_columns(db): admin_user.all_privileges = default_privileges + [ admin_privilege, active_privilege] admin_user.save() + + # and then drop the now vestigial status column + metadata = MetaData(bind=db.bind) + user_table = inspect_table(metadata, 'core__users') + status = user_table.columns['status'] + status.drop() + db.commit() + diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 5b77a85d..ce1de36b 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -63,13 +63,16 @@ class User(Base, UserMixin): # point. email = Column(Unicode, nullable=False) pw_hash = Column(Unicode) +#--column email_verified is VESTIGIAL with privileges and should not be used--- +#--should be dropped ASAP though a bug in sqlite3 prevents this atm------------ email_verified = Column(Boolean, default=False) created = Column(DateTime, nullable=False, default=datetime.datetime.now) - status = Column(Unicode, default=u"needs_email_verification", nullable=False) # Intented to be nullable=False, but migrations would not work for it # set to nullable=True implicitly. wants_comment_notification = Column(Boolean, default=True) license_preference = Column(Unicode) +#--column admin is VESTIGIAL with privileges and should not be used------------ +#--should be dropped ASAP though a bug in sqlite3 prevents this atm------------ is_admin = Column(Boolean, default=False, nullable=False) url = Column(Unicode) bio = Column(UnicodeText) # ?? diff --git a/mediagoblin/meta/__init__.py b/mediagoblin/meta/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/mediagoblin/meta/__init__.py +++ /dev/null diff --git a/mediagoblin/meta/routing.py b/mediagoblin/meta/routing.py deleted file mode 100644 index b74cb52d..00000000 --- a/mediagoblin/meta/routing.py +++ /dev/null @@ -1,27 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -meta_routes = [ - ('mediagoblin.meta.terms_of_service', - '/tos/', - 'mediagoblin.meta.views:terms_of_service'), - ('mediagoblin.meta.reports_panel', - '/reports/', - 'mediagoblin.meta.views:public_reports_panel'), - ('mediagoblin.meta.reports_detail', - '/reports/<int:report_id>', - 'mediagoblin.meta.views:public_reports_details') -] diff --git a/mediagoblin/meta/views.py b/mediagoblin/meta/views.py deleted file mode 100644 index 79940a22..00000000 --- a/mediagoblin/meta/views.py +++ /dev/null @@ -1,33 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -from mediagoblin.tools.response import render_to_response - - -def terms_of_service(request): - return render_to_response(request, - 'mediagoblin/meta/terms_of_service.html', - {}) - -def public_reports_panel(request): - return render_to_response(request, - 'mediagoblin/meta/reports_panel.html', - {}) - -def public_reports_details(request): - return render_to_response(request, - 'mediagoblin/meta/reports_details.html', - {}) diff --git a/mediagoblin/moderation/forms.py b/mediagoblin/moderation/forms.py index 7e225fb6..78e9fcdc 100644 --- a/mediagoblin/moderation/forms.py +++ b/mediagoblin/moderation/forms.py @@ -130,27 +130,12 @@ class ReportPanelSortingForm(wtforms.Form): This form is used for sorting and filtering through different reports in the mediagoblin.moderation.reports_panel view. - Parameters that start with 'active_' refer to a sort/filter for the active - reports. - Parameters that start with 'closed_' refer to a sort/filter for the closed - reports. """ active_p = wtforms.IntegerField( - _(u'Page'), - validators=[wtforms.validators.optional()]) - active_reported_user = wtforms.IntegerField( - _(u'Reported User'), - validators=[wtforms.validators.optional()]) - active_reporter = wtforms.IntegerField( - _(u'Reporter'), validators=[wtforms.validators.optional()]) closed_p = wtforms.IntegerField( - _(u'Page'), validators=[wtforms.validators.optional()]) - closed_reported_user = wtforms.IntegerField( - _(u'Reported User'), + reported_user = wtforms.IntegerField( validators=[wtforms.validators.optional()]) - closed_reporter = wtforms.IntegerField( - _(u'Reporter'), + reporter = wtforms.IntegerField( validators=[wtforms.validators.optional()]) - diff --git a/mediagoblin/moderation/tools.py b/mediagoblin/moderation/tools.py index 355ffa99..2d680c15 100644 --- a/mediagoblin/moderation/tools.py +++ b/mediagoblin/moderation/tools.py @@ -229,5 +229,21 @@ def unban_user(user_id): user_ban.first().delete() return True +def parse_report_panel_settings(form): + """ + This function parses the url arguments to which are used to filter reports + in the reports panel view. More filters can be added to make a usuable + search function. + + :returns A dictionary of sqlalchemy-usable filters. + """ + filters = {} + + if form.validate(): + filters['reported_user_id'] = form.reported_user.data + filters['reporter_id'] = form.reporter.data + filters = dict((k, v) + for k, v in filters.iteritems() if v) + return filters diff --git a/mediagoblin/moderation/views.py b/mediagoblin/moderation/views.py index f09f4c99..6a23ddd6 100644 --- a/mediagoblin/moderation/views.py +++ b/mediagoblin/moderation/views.py @@ -24,7 +24,9 @@ from mediagoblin.decorators import (require_admin_or_moderator_login, \ from mediagoblin.tools.response import render_to_response, redirect from mediagoblin.moderation import forms as moderation_forms from mediagoblin.moderation.tools import (take_punitive_actions, \ - take_away_privileges, give_privileges, ban_user, unban_user) + take_away_privileges, give_privileges, ban_user, unban_user, \ + parse_report_panel_settings) +from werkzeug.datastructures import ImmutableMultiDict from datetime import datetime from math import ceil @@ -92,37 +94,35 @@ def moderation_reports_panel(request): Show the global panel for monitoring reports filed against comments or media entries for this instance. ''' - - form = moderation_forms.ReportPanelSortingForm(request.args) - active_settings = {'start_page':1, 'filters':{}} - closed_settings = {'start_page':1, 'filters':{}} - if form.validate(): - active_settings['start_page'] = form.active_p.data or 1 - active_settings['filters']['reported_user_id'] = form.active_reported_user.data - active_settings['filters']['reporter_id'] = form.active_reporter.data - closed_settings['start_page'] = form.closed_p.data or 1 - closed_settings['filters']['reported_user_id'] = form.closed_reported_user.data - closed_settings['filters']['reporter_id'] = form.closed_reporter.data - - active_settings['filters']=dict((k, v) for k, v in active_settings['filters'].iteritems() if v) - closed_settings['filters']=dict((k, v) for k, v in closed_settings['filters'].iteritems() if v) - active_filter = [ - getattr(ReportBase,key)==val \ -for key,val in active_settings['filters'].viewitems()] - closed_filter = [ - getattr(ReportBase,key)==val \ -for key,val in active_settings['filters'].viewitems()] + filters = [] + active_settings, closed_settings = {'current_page':1}, {'current_page':1} + + if len(request.args) > 0: + form = moderation_forms.ReportPanelSortingForm(request.args) + if form.validate(): + filters = parse_report_panel_settings(form) + active_settings['current_page'] = form.active_p.data or 1 + closed_settings['current_page'] = form.closed_p.data or 1 + filters = [ + getattr(ReportBase,key)==val + for key,val in filters.viewitems()] all_active = ReportBase.query.filter( ReportBase.discriminator!="archived_report").filter( - *active_filter) + *filters) all_closed = ReportBase.query.filter( ReportBase.discriminator=="archived_report").filter( - *closed_filter) + *filters) + + # report_list and closed_report_list are the two lists of up to 10 + # items which are actually passed to the user in this request report_list = all_active.order_by( - ReportBase.created.desc()).offset((active_settings['start_page']-1)*10).limit(10) + ReportBase.created.desc()).offset( + (active_settings['current_page']-1)*10).limit(10) closed_report_list = all_closed.order_by( - ReportBase.created.desc()).offset((closed_settings['start_page']-1)*10).limit(10) + ReportBase.created.desc()).offset( + (closed_settings['current_page']-1)*10).limit(10) + active_settings['last_page'] = int(ceil(all_active.count()/10.)) closed_settings['last_page'] = int(ceil(all_closed.count()/10.)) # Render to response diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index a9809c44..c2c6d284 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -20,7 +20,6 @@ from mediagoblin.tools.routing import add_route, mount, url_map from mediagoblin.tools.pluginapi import PluginManager from mediagoblin.moderation.routing import moderation_routes from mediagoblin.auth.routing import auth_routes -from mediagoblin.meta.routing import meta_routes _log = logging.getLogger(__name__) @@ -28,9 +27,10 @@ _log = logging.getLogger(__name__) def get_url_map(): add_route('index', '/', 'mediagoblin.views:root_view') + add_route('terms_of_service','/terms_of_service', + 'mediagoblin.views:terms_of_service') mount('/auth', auth_routes) mount('/mod', moderation_routes) - mount('/meta', meta_routes) import mediagoblin.submit.routing import mediagoblin.user_pages.routing diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index d9610675..b9b806f9 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -156,6 +156,10 @@ a.logo { margin: 6px 8px 6px 0; } +.fine_print { + font-size: 0.8em; +} + .mediagoblin_content { width: 100%; padding-bottom: 74px; @@ -665,6 +669,10 @@ table td.user_without_privilege { #code_of_conduct_list li { margin:5px 0 15px 25px; } +#code_of_conduct_list strong{ + color:#fff; +} + .nested_sublist { margin: 5px 0 10px 25px; font-size:80%; diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 40cec5f7..938dac75 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -89,6 +89,12 @@ "javascript:;" {% endif %} >{% trans %}log out{% endtrans %}</a> + <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.collection') }}"> + {%- trans %}Create new collection{% endtrans -%} + </a> + <p class="fine_print"> + <a href="{{ request.urlgen('terms_of_service') }}">Terms of Service</a> + </p> {% endif %} {%- elif auth %} <a href= @@ -132,23 +138,28 @@ <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.start') }}"> {%- trans %}Add media{% endtrans -%} </a> - <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.collection') }}"> - {%- trans %}Create new collection{% endtrans -%} - </a> {% if request.user.has_privilege('admin','moderator') %} <p> <span class="dropdown_title">Moderation powers:</span> <a href="{{ request.urlgen('mediagoblin.moderation.media_panel') }}"> {%- trans %}Media processing panel{% endtrans -%} </a> + · <a href="{{ request.urlgen('mediagoblin.moderation.users') }}"> {%- trans %}User management panel{% endtrans -%} </a> + · <a href="{{ request.urlgen('mediagoblin.moderation.reports') }}"> {%- trans %}Report management panel{% endtrans -%} </a> </p> {% endif %} + <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.collection') }}"> + {%- trans %}Create new collection{% endtrans -%} + </a> + <p class="fine_print"> + <a href="{{ request.urlgen('terms_of_service') }}">Terms of Service</a> + </p> {% include 'mediagoblin/fragments/header_notifications.html' %} </div> {% endif %} diff --git a/mediagoblin/templates/mediagoblin/meta/code_of_conduct.html b/mediagoblin/templates/mediagoblin/meta/code_of_conduct.html deleted file mode 100644 index e8233ad3..00000000 --- a/mediagoblin/templates/mediagoblin/meta/code_of_conduct.html +++ /dev/null @@ -1,46 +0,0 @@ -{# -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -#} -{% extends "mediagoblin/base.html" %} - -{% block title %} - Code of Conduct -{% endblock %} - -{% block mediagoblin_content -%} -<h2>{% trans %}Code of Conduct for this Website{% endtrans %}</h2> - -{# Suggested layout for this page: -<ol id="code_of_conduct_list"> - <li> Item #1 </li> - <li> - Item #2 - <ol class="nested_sublist"> - <li>Sub-Item #1</li> - <li>Sub-Item #2</li> - <li> - Sub-Item #3 - <ol class="nested_sublist"> - <li>Sub-Subitem #1</li> - </ol> - </li> - </ol> - </li> - <li>Item #3 </li> -</ol> -#} -{% endblock -%} diff --git a/mediagoblin/templates/mediagoblin/meta/reports_details.html b/mediagoblin/templates/mediagoblin/meta/reports_details.html deleted file mode 100644 index 6fa5ae59..00000000 --- a/mediagoblin/templates/mediagoblin/meta/reports_details.html +++ /dev/null @@ -1,17 +0,0 @@ -{# -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -#} diff --git a/mediagoblin/templates/mediagoblin/meta/reports_panel.html b/mediagoblin/templates/mediagoblin/meta/reports_panel.html deleted file mode 100644 index 6fa5ae59..00000000 --- a/mediagoblin/templates/mediagoblin/meta/reports_panel.html +++ /dev/null @@ -1,17 +0,0 @@ -{# -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -#} diff --git a/mediagoblin/templates/mediagoblin/moderation/report_panel.html b/mediagoblin/templates/mediagoblin/moderation/report_panel.html index a72e2e77..988dd292 100644 --- a/mediagoblin/templates/mediagoblin/moderation/report_panel.html +++ b/mediagoblin/templates/mediagoblin/moderation/report_panel.html @@ -16,6 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. #} {% extends "mediagoblin/base.html" %} +{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block title -%} {% trans %}Report panel{% endtrans %} — {{ super() }} @@ -33,34 +34,40 @@ <h2>{% trans %}Active Reports Filed{% endtrans %}</h2> {% if not active_settings.last_page == 1 %} - {% if 'active_p='~active_settings.start_page in request.query_string %} + {% if 'active_p='~active_settings.current_page in request.query_string %} {% set query_string = request.query_string %}{% else %} {% set query_string = -'active_p='~active_settings.start_page~"&"+request.query_string %} +'active_p='~active_settings.current_page~"&"+request.query_string %} {% endif %} <div class="right_align"> - {% set first_vis = active_settings.start_page-3 %} - {% set last_vis = active_settings.start_page+3 %} - {% set curr_page = active_settings.start_page %} + {% set first_vis = active_settings.current_page-3 %} + {% set last_vis = active_settings.current_page+3 %} + {% set curr_page = active_settings.current_page %} {% if 1 == curr_page %}<b>1</b>{% else %} <a href ="?{{ query_string.replace( - 'active_p='~active_settings.start_page, + 'active_p='~active_settings.current_page, 'active_p='~1) }}"> - {{ 1 }}</a>{% endif %} + 1</a>{% endif %} {% if first_vis > 1 %}...{% endif %} {% for p in range(first_vis,last_vis+1) %} - {% if p > 1 and p < active_settings.last_page %} + {% if p > 1 and p < active_settings.last_page and +curr_page !=p %} <a href="?{{ query_string.replace( - 'active_p='~active_settings.start_page, + 'active_p='~active_settings.current_page, 'active_p='~p) }}"> {{ p }}</a> + {% elif p > 1 and p < active_settings.last_page %} + <b>{{ p }}</b> {% endif %} {% endfor %} {% if last_vis < active_settings.last_page %}...{% endif %} + {% if active_settings.last_page != curr_page %} <a href ="?{{ query_string.replace( - 'active_p='~active_settings.start_page, + 'active_p='~active_settings.current_page, 'active_p='~active_settings.last_page) }}"> {{ active_settings.last_page }}</a> + {% else %}<b>{{ active_settings.last_page }}</b> + {% endif %} </div> {% endif %} {% if report_list.count() %} @@ -115,32 +122,43 @@ {% endif %} <h2>{% trans %}Closed Reports{% endtrans %}</h2> {% if not closed_settings.last_page == 1 %} - {% if 'closed_p='~closed_settings.start_page in request.query_string %} + {% if 'closed_p='~closed_settings.current_page in request.query_string %} {% set query_string = request.query_string %}{% else %} {% set query_string = -'closed_p='~closed_settings.start_page~"&"+request.query_string %} +'closed_p='~closed_settings.current_page~"&"+request.query_string %} {% endif %} <div class="right_align"> - {% set first_vis = closed_settings.start_page-3 %} - {% set last_vis = closed_settings.start_page+3 %} + {% set first_vis = closed_settings.current_page-3 %} + {% set last_vis = closed_settings.current_page+3 %} + {% set curr_page = closed_settings.current_page %} + {% if not curr_page==1 %} <a href ="?{{ query_string.replace( - 'closed_p='~closed_settings.start_page, - 'closed_p='~1) }}"> - {{ 1 }}</a> + 'closed_p='~closed_settings.current_page, + 'closed_p='~1) }}">1</a> + {% else %} + <b>1 </b> + {% endif %} {% if first_vis > 1 %}...{% endif %} {% for p in range(first_vis,last_vis+1) %} - {% if p > 1 and p < closed_settings.last_page %} + {% if p > 1 and p < closed_settings.last_page and +curr_page !=p %} <a href="?{{ query_string.replace( - 'closed_p='~closed_settings.start_page, + 'closed_p='~closed_settings.current_page, 'closed_p='~p) }}"> {{ p }}</a> + + {% elif p > 1 and p < closed_settings.last_page %} + <b>{{ p }}</b> {% endif %} {% endfor %} {% if last_vis < closed_settings.last_page %}...{% endif %} - <a href ="?{{ query_string.replace( - 'closed_p='~closed_settings.start_page, + {% if curr_page != closed_settings.last_page %} + <a href ="?{{ query_string.replace( + 'closed_p='~closed_settings.current_page, 'closed_p='~closed_settings.last_page) }}"> - {{ closed_settings.last_page }}</a> + {{ closed_settings.last_page }}</a> + {% else %}<b>{{ closed_settings.last_page }}</b> + {% endif %} </div> {% endif %} {% if closed_report_list.count() %} @@ -178,4 +196,5 @@ {% else %} <p><em>{% trans %}No closed reports found.{% endtrans %}</em></p> {% endif %} + {% endblock %} diff --git a/mediagoblin/templates/mediagoblin/moderation/user.html b/mediagoblin/templates/mediagoblin/moderation/user.html index 17a08603..36ba42ac 100644 --- a/mediagoblin/templates/mediagoblin/moderation/user.html +++ b/mediagoblin/templates/mediagoblin/moderation/user.html @@ -38,7 +38,7 @@ <p>{% trans %}Sorry, no such user found.{% endtrans %}</p> {# User exists, but needs verification #} {% elif not user.has_privilege('active') %} - <div class="form_box"> + <div class="profile_sidebar empty_space"> <h1>{% trans %}Email verification needed{% endtrans %}</h1> <p> {% trans -%} @@ -47,12 +47,6 @@ {%- endtrans %} </p> - <p> - {% trans login_url=request.urlgen('mediagoblin.auth.login') -%} - If you are that person but you've lost your verification email, you can - <a href="{{ login_url }}">log in</a> and resend it. - {%- endtrans %} - </p> </div> {# Active(?) (or at least verified at some point) user, horray! #} @@ -130,8 +124,17 @@ {% else %} {%- trans %}No active reports filed on {% endtrans -%} {{ user.username }} {% endif %} - <a href="{{ request.urlgen('mediagoblin.moderation.reports') }}?active_reported_user={{user.id}}&closed_reported_user={{user.id}}" - class="right_align">{{ user.username }}'s report history</a> + <span class="right_align"> + <a href="{{ request.urlgen( + 'mediagoblin.moderation.reports') }}?reported_user={{user.id}}"> + {%- trans + username=user.username %}All reports on {{ username }}{% endtrans %}</a> + · + <a href="{{ request.urlgen( + 'mediagoblin.moderation.reports') }}?reporter={{user.id}}"> + {%- trans + username=user.username %}All reports that {{ username }} has filed{% endtrans %}</a> + </span> <span class=clear></span> <h2>{{ user.username }}'s Privileges</h2> <form method=POST action="{{ request.urlgen( diff --git a/mediagoblin/templates/mediagoblin/meta/terms_of_service.html b/mediagoblin/templates/mediagoblin/terms_of_service.html index b998d1c3..a9e8ebf2 100644 --- a/mediagoblin/templates/mediagoblin/meta/terms_of_service.html +++ b/mediagoblin/templates/mediagoblin/terms_of_service.html @@ -22,7 +22,10 @@ {% endblock %} {% block mediagoblin_content -%} -<h2>The gist</h2> +{# <h2>The gist</h2> +# This is where you might insert your own particular rules, unique to your +# own website. Or your own worded summary. +#} <h2>Terms of Service</h2> @@ -36,15 +39,22 @@ conditions contained herein and all other operating rules, policies that may be published from time to time on this Site by Operator (collectively, the “Agreement”). -Please read this Agreement carefully before accessing or using the Website. By accessing or using any part of the web site, you agree to become bound by the terms and conditions of this agreement. If you do not agree to all the terms and conditions of this agreement, then you may not access the Website or use any services. If these terms and conditions are considered an offer by Operator, acceptance is expressly limited to these terms. The Website is available only to individuals who are at least 13 years old. +Please read this Agreement carefully before accessing or using the Website. +By accessing or using any part of the web site, you agree to become bound by +the terms and conditions of this agreement. If you do not agree to all the +terms and conditions of this agreement, then you may not access the Website +or use any services. If these terms and conditions are considered an offer by +Operator, acceptance is expressly limited to these terms. The Website is +available only to individuals who are at least 13 years old. <ol id="code_of_conduct_list"> - <li><strong>Your {{ app_config['html_title'] }} Account and Site.</strong> If you create a - notice stream on the Website, you are responsible for maintaining the - security of your account and notice stream, and you are fully responsible - for all activities that occur under the account and any other actions taken - in connection with the notice stream. You must not describe or assign - keywords to your notice stream in a misleading or unlawful manner, + <li><strong>Your {{ app_config['html_title'] }} Account and Site.</strong> + If you create a notice stream on the Website, you are responsible for + maintaining the security of your account and notice stream, and you are + fully responsible for all activities that occur under the account and any + other actions taken in connection with the notice stream. You must not + describe or assign keywords to your notice stream in a misleading or + unlawful manner, including in a manner intended to trade on the name or reputation of others, and Operator may change or remove any description or keyword that it considers inappropriate or unlawful, or otherwise likely to cause @@ -54,9 +64,10 @@ Please read this Agreement carefully before accessing or using the Website. By a including any damages of any kind incurred as a result of such acts or omissions. </li> - <li><strong>Responsibility of Contributors.</strong> If you operate a notice stream, comment - on a notice stream, post material to the Website, post links on the - Website, or otherwise make (or allow any third party to make) material + <li><strong>Responsibility of Contributors.</strong> If you operate a notice + stream, comment on a notice stream, post material to the Website, post + links on the Website, or otherwise make + (or allow any third party to make) material available by means of the Website (any such material, “Content”), You are entirely responsible for the content of, and any harm resulting from, that Content. That is the case regardless of whether the Content in question @@ -126,7 +137,8 @@ Please read this Agreement carefully before accessing or using the Website. By a (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in Operator’s sole discretion. </li> - <li><strong>Responsibility of Website Visitors.</strong> Operator has not reviewed, and cannot + <li><strong>Responsibility of Website Visitors.</strong> Operator has not + reviewed, and cannot review, all of the material, including computer software, posted to the Website, and cannot therefore be responsible for that material’s content, use or effects. By operating the Website, Operator does not represent or @@ -145,7 +157,8 @@ Please read this Agreement carefully before accessing or using the Website. By a visitors of the Website, or from any downloading by those visitors of content there posted. </li> - <li><strong>Content Posted on Other Websites.</strong> We have not reviewed, and cannot + <li><strong>Content Posted on Other Websites.</strong> We have not reviewed, + and cannot review, all of the material, including computer software, made available through the websites and webpages to which {{ app_config['html_title'] }} links, and that link to {{ app_config['html_title'] }}. Operator does not @@ -158,7 +171,8 @@ Please read this Agreement carefully before accessing or using the Website. By a disclaims any responsibility for any harm resulting from your use of external websites and webpages. </li> - <li><strong>Copyright Infringement and DMCA Policy.</strong> As Operator asks others to + <li><strong>Copyright Infringement and DMCA Policy.</strong> As Operator asks + others to respect its intellectual property rights, it respects the intellectual property rights of others. If you believe that material located on or linked to by {{ app_config['html_title'] }} violates your copyright, you @@ -172,7 +186,8 @@ Please read this Agreement carefully before accessing or using the Website. By a the Website. In the case of such termination, Operator will have no obligation to provide a refund of any amounts previously paid to Operator. </li> - <li><strong>Intellectual Property.</strong> This Agreement does not transfer from Operator to + <li><strong>Intellectual Property.</strong> This Agreement does not transfer + from Operator to you any Operator or third party intellectual property, and all right, title and interest in and to such property will remain (as between the parties) solely with Operator. {{ app_config['html_title'] }}, the @@ -185,7 +200,8 @@ Please read this Agreement carefully before accessing or using the Website. By a Website grants you no right or license to reproduce or otherwise use any Operator or third-party trademarks. </li> - <li><strong>Changes.</strong> Operator reserves the right, at its sole discretion, to modify + <li><strong>Changes.</strong> Operator reserves the right, at its sole + discretion, to modify or replace any part of this Agreement. It is your responsibility to check this Agreement periodically for changes. Your continued use of or access to the Website following the posting of any changes to this Agreement @@ -194,7 +210,8 @@ Please read this Agreement carefully before accessing or using the Website. By a release of new tools and resources). Such new features and/or services shall be subject to the terms and conditions of this Agreement. </li> - <li><strong>Termination.</strong> Operator may terminate your access to all or any part of + <li><strong>Termination.</strong> Operator may terminate your access to all + or any part of the Website at any time, with or without cause, with or without notice, effective immediately. If you wish to terminate this Agreement or your {{ app_config['html_title'] }} account (if you have one), you may simply @@ -203,7 +220,8 @@ Please read this Agreement carefully before accessing or using the Website. By a including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of liability. </li> - <li><strong>Disclaimer of Warranties.</strong> The Website is provided “as is”. Operator and + <li><strong>Disclaimer of Warranties.</strong> The Website is provided + “as is”. Operator and its suppliers and licensors hereby disclaim all warranties of any kind, express or implied, including, without limitation, the warranties of merchantability, fitness for a particular purpose and non-infringement. @@ -213,7 +231,8 @@ Please read this Agreement carefully before accessing or using the Website. By a understand that you download from, or otherwise obtain content or services through, the Website at your own discretion and risk. </li> - <li><strong>Limitation of Liability.</strong> In no event will Operator, or its suppliers or + <li><strong>Limitation of Liability.</strong> In no event will Operator, or + its suppliers or licensors, be liable with respect to any subject matter of this agreement under any contract, negligence, strict liability or other legal or equitable theory for: (i) any special, incidental or consequential damages; @@ -225,7 +244,8 @@ Please read this Agreement carefully before accessing or using the Website. By a reasonable control. The foregoing shall not apply to the extent prohibited by applicable law. </li> - <li><strong>General Representation and Warranty.</strong> You represent and warrant that (i) + <li><strong>General Representation and Warranty.</strong> You represent and + warrant that (i) your use of the Website will be in strict accordance with the Operator Privacy Policy, with this Agreement and with all applicable laws and regulations (including without limitation any local laws or regulations in @@ -236,13 +256,15 @@ Please read this Agreement carefully before accessing or using the Website. By a infringe or misappropriate the intellectual property rights of any third party. </li> - <li><strong>Indemnification.</strong> You agree to indemnify and hold harmless Operator, its + <li><strong>Indemnification.</strong> You agree to indemnify and hold + harmless Operator, its contractors, and its licensors, and their respective directors, officers, employees and agents from and against any and all claims and expenses, including attorneys’ fees, arising out of your use of the Website, including but not limited to out of your violation this Agreement. </li> - <li><strong>Miscellaneous.</strong> This Agreement constitutes the entire agreement between + <li><strong>Miscellaneous.</strong> This Agreement constitutes the entire + agreement between Operator and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of Operator, or by the posting by Operator of a revised version. If any part diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html index d4ce764f..ab616ea8 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/user.html +++ b/mediagoblin/templates/mediagoblin/user_pages/user.html @@ -43,7 +43,7 @@ <p>{% trans %}Sorry, no such user found.{% endtrans %}</p> {# User exists, but needs verification #} - {% elif not user.status.has_privilege('active') %} + {% elif not user.has_privilege('active') %} {% if user == request.user %} {# this should only be visible when you are this user #} <div class="form_box"> diff --git a/mediagoblin/tests/test_moderation.py b/mediagoblin/tests/test_moderation.py index 6160ce3d..12bf5153 100644 --- a/mediagoblin/tests/test_moderation.py +++ b/mediagoblin/tests/test_moderation.py @@ -193,6 +193,7 @@ VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n', def testAllModerationViews(self): self.login(u'moderator') username = self.user.username + self.query_for_users() fixture_add_comment_report(reported_user=self.admin_user) response = self.test_app.get('/mod/reports/') assert response.status == "200 OK" @@ -232,4 +233,3 @@ VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n', assert response.status == "302 FOUND" user_banned = UserBan.query.filter(UserBan.user_id==user_id).first() assert user_banned is None - diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py index 1d035494..060dfda9 100644 --- a/mediagoblin/tests/tools.py +++ b/mediagoblin/tests/tools.py @@ -330,8 +330,7 @@ def fixture_add_comment_report(comment=None, reported_user=None, if report_content is None: report_content = \ - 'Auto-generated test report by user {0}'.format( - reporter) + 'Auto-generated test report' comment_report = CommentReport(comment=comment, reported_user = reported_user, diff --git a/mediagoblin/views.py b/mediagoblin/views.py index 595f2725..1d7be813 100644 --- a/mediagoblin/views.py +++ b/mediagoblin/views.py @@ -44,3 +44,7 @@ def simple_template_render(request): template_name = request.matchdict['template'] return render_to_response( request, template_name, {}) + +def terms_of_service(request): + return render_to_response(request, + 'mediagoblin/terms_of_service.html', {}) |