FIX: Remember sort and topic-search when switching users (#98)

FIX: Remember sort and topic-search when switching users (#98)

diff --git a/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6 b/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6
index b072921..6bcfadd 100644
--- a/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6
+++ b/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6
@@ -14,6 +14,21 @@ export default Controller.extend({
   filterName: "",
   filter: "",
 
+  @discourseComputed("router.currentRoute.queryParams.order")
+  order(order) {
+    return order || "";
+  },
+
+  @discourseComputed("router.currentRoute.queryParams.ascending")
+  ascending(ascending) {
+    return ascending || false;
+  },
+
+  @discourseComputed("router.currentRoute.queryParams.q")
+  q(q) {
+    return q || "";
+  },
+
   @discourseComputed("site.mobileView")
   isDesktop(mobileView) {
     return !mobileView;
diff --git a/assets/javascripts/discourse/templates/components/group-assigned-filter.hbs b/assets/javascripts/discourse/templates/components/group-assigned-filter.hbs
index a90e6b9..0abbca5 100644
--- a/assets/javascripts/discourse/templates/components/group-assigned-filter.hbs
+++ b/assets/javascripts/discourse/templates/components/group-assigned-filter.hbs
@@ -1,5 +1,5 @@
 {{#if show-avatar}}
-  {{#link-to "group.assigned.show" filter.username_lower}}
+  {{#link-to "group.assigned.show" filter.username_lower (query-params order=order ascending=ascending q=q)}}
     <div class="assign-image">
       <a href={{filter.userPath}} data-user-card={{filter.username}}>{{avatar filter imageSize="large"}}</a>
     </div>
@@ -14,7 +14,7 @@
     </div>
   {{/link-to}}
 {{else}}
-  {{#link-to "group.assigned.show" filter}}
+  {{#link-to "group.assigned.show" filter (query-params order=order ascending=ascending q=q)}}
     <div class="assign-everyone">
       {{i18n 'discourse_assign.group_everyone'}}
     </div>
diff --git a/assets/javascripts/discourse/templates/group/assigned.hbs b/assets/javascripts/discourse/templates/group/assigned.hbs
index e8b68e5..255ff11 100644
--- a/assets/javascripts/discourse/templates/group/assigned.hbs
+++ b/assets/javascripts/discourse/templates/group/assigned.hbs
@@ -12,9 +12,22 @@
       </div>
     {{/if}}
     {{#load-more selector=".activity-nav li" action=(action "loadMore")}}
-      {{group-assigned-filter show-avatar=false filter="everyone" routeType=route_type assignmentCount=group.assignment_count}}
+      {{group-assigned-filter
+        show-avatar=false
+        filter="everyone"
+        routeType=route_type
+        assignmentCount=group.assignment_count
+        q=q
+        ascending=ascending
+        order=order}}
       {{#each members as |member|}}
-        {{group-assigned-filter show-avatar=true filter=member routeType=route_type}}
+        {{group-assigned-filter
+          show-avatar=true
+          filter=member
+          routeType=route_type
+          q=q
+          ascending=ascending
+          order=order}}
       {{/each}}
       {{conditional-loading-spinner condition=loading}}
     {{/load-more}}

GitHub sha: 141ef6a8

This commit appears in #98 which was merged by davidtaylorhq.