diff options
author | 2018-05-15 20:17:53 +0100 | |
---|---|---|
committer | 2018-05-15 20:17:53 +0100 | |
commit | 10ddcbea3732b1c066458aea533480f2bb399ef5 (patch) | |
tree | ef721816385f4e049bd3271f7824bbfbe85285d7 | |
parent | Main site redirects should be 302s (diff) |
Add snowflake index on oauth_data and use it for deletions
We were using id previously, but that was no longer the correct key
-rw-r--r-- | pysite/migrations/tables/oauth_data/__init__.py | 0 | ||||
-rw-r--r-- | pysite/migrations/tables/oauth_data/v1.py | 3 | ||||
-rw-r--r-- | pysite/views/api/bot/user.py | 4 | ||||
-rw-r--r-- | templates/main/navigation.html | 16 |
4 files changed, 16 insertions, 7 deletions
diff --git a/pysite/migrations/tables/oauth_data/__init__.py b/pysite/migrations/tables/oauth_data/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/pysite/migrations/tables/oauth_data/__init__.py diff --git a/pysite/migrations/tables/oauth_data/v1.py b/pysite/migrations/tables/oauth_data/v1.py new file mode 100644 index 00000000..8448d8e5 --- /dev/null +++ b/pysite/migrations/tables/oauth_data/v1.py @@ -0,0 +1,3 @@ +def run(db, table, table_obj): + db.run(db.query(table).index_create("snowflake")) + db.run(db.query(table).index_wait("snowflake")) diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py index 077991f5..58963682 100644 --- a/pysite/views/api/bot/user.py +++ b/pysite/views/api/bot/user.py @@ -52,7 +52,7 @@ class UserView(APIView, DBMixin): all_oauth_data = self.db.run(self.db.query(self.oauth_table_name), coerce=list) for item in all_oauth_data: - if item["id"] not in user_ids: + if item["snowflake"] not in user_ids: self.db.delete(self.oauth_table_name, item["id"], durability="soft") oauth_deletions += 1 @@ -94,7 +94,7 @@ class UserView(APIView, DBMixin): oauth_deletions = self.db.run( self.db.query(self.oauth_table_name) - .get_all(*user_ids) + .get_all(*user_ids, index="snowflake") .delete() ).get("deleted", 0) diff --git a/templates/main/navigation.html b/templates/main/navigation.html index a615468e..8333fd18 100644 --- a/templates/main/navigation.html +++ b/templates/main/navigation.html @@ -48,19 +48,19 @@ <li class="uk-nav-header"><a href="{{ url_for('main.info.index') }}">Information</a></li> {% endif %} - {% if current_page == "info/jams" %} + {% if current_page == "info.jams" %} <li class="uk-active"><a href="{{ url_for('main.info.jams') }}">Code Jams</a></li> {% else %} <li><a href="{{ url_for('main.info.jams') }}">Code Jams</a></li> {% endif %} - {% if current_page == "info/help" %} + {% if current_page == "info.help" %} <li class="uk-active"><a href="{{ url_for('main.info.help') }}">Getting Help</a></li> {% else %} <li><a href="{{ url_for('main.info.help') }}">Getting Help</a></li> {% endif %} - {% if current_page == "info/resources" %} + {% if current_page == "info.resources" %} <li class="uk-active"><a href="{{ url_for('main.info.resources') }}">Resources</a></li> {% else %} <li><a href="{{ url_for('main.info.resources') }}">Resources</a></li> @@ -72,19 +72,25 @@ <li class="uk-nav-header"><a href="{{ url_for('main.about.index') }}">About</a></li> {% endif %} - {% if current_page == "about/partners" %} + {% if current_page == "about.partners" %} <li class="uk-active"><a href="{{ url_for('main.about.partners') }}">Partners</a></li> {% else %} <li><a href="{{ url_for('main.about.partners') }}">Partners</a></li> {% endif %} - {% if current_page == "about/rules" %} + {% if current_page == "about.rules" %} <li class="uk-active"><a href="{{ url_for('main.about.rules') }}">Server Rules</a></li> {% else %} <li><a href="{{ url_for('main.about.rules') }}">Server Rules</a></li> {% endif %} <li class="uk-nav-divider"></li> + + {% if current_page.startswith("about.privacy") %} + <li class="uk-active"><a href="{{ url_for('main.about.privacy') }}">Privacy</a></li> + {% else %} + <li><a href="{{ url_for('main.about.privacy') }}">Privacy</a></li> + {% endif %} </ul> </div> </li> |