UX: allows to see participants of passed events

UX: allows to see participants of passed events

diff --git a/app/controllers/discourse_calendar/invitees_controller.rb b/app/controllers/discourse_calendar/invitees_controller.rb
index 5b10f63..c7ed24a 100644
--- a/app/controllers/discourse_calendar/invitees_controller.rb
+++ b/app/controllers/discourse_calendar/invitees_controller.rb
@@ -12,7 +12,9 @@ module DiscourseCalendar
     end
 
     def index
-      post_event_invitees = PostEvent.find(params['post-event-id']).invitees
+      post_event = PostEvent.find(params['post-event-id'])
+
+      post_event_invitees = post_event.invitees
 
       if params[:filter]
         post_event_invitees = post_event_invitees
@@ -20,6 +22,10 @@ module DiscourseCalendar
           .where("LOWER(users.username) LIKE :filter", filter: "%#{params[:filter].downcase}%")
       end
 
+      if post_event.is_expired?
+        post_event_invitees = post_event_invitees.where(status: Invitee.statuses[:going])
+      end
+
       render json: ActiveModel::ArraySerializer.new(post_event_invitees.limit(10), each_serializer: InviteeSerializer).as_json
     end
 
diff --git a/app/serializers/discourse_calendar/post_event_serializer.rb b/app/serializers/discourse_calendar/post_event_serializer.rb
index a9cbe79..3388e9f 100644
--- a/app/serializers/discourse_calendar/post_event_serializer.rb
+++ b/app/serializers/discourse_calendar/post_event_serializer.rb
@@ -65,7 +65,7 @@ module DiscourseCalendar
       counts = object.invitees.group(:status).count
 
       # event creator is always going so we add one
-      going = (counts[Invitee.statuses[:going]] || 0) + 1
+      going = (counts[Invitee.statuses[:going]] || 0) + (object.is_expired? ? 0 : 1)
       interested = counts[Invitee.statuses[:interested]] || 0
       not_going = counts[Invitee.statuses[:not_going]] || 0
       unanswered = counts[nil] || 0
diff --git a/assets/javascripts/discourse/widgets/post-event-dates.js.es6 b/assets/javascripts/discourse/widgets/post-event-dates.js.es6
index b1c7d8e..1037dd4 100644
--- a/assets/javascripts/discourse/widgets/post-event-dates.js.es6
+++ b/assets/javascripts/discourse/widgets/post-event-dates.js.es6
@@ -1,16 +1,35 @@
-import hbs from "discourse/widgets/hbs-compiler";
+import RawHtml from "discourse/widgets/raw-html";
+import { iconNode } from "discourse-common/lib/icon-library";
+import { h } from "virtual-dom";
 import { createWidget } from "discourse/widgets/widget";
 
 export default createWidget("post-event-dates", {
   tagName: "section.post-event-dates",
 
-  template: hbs`
-    {{d-icon "clock"}}
-    <span class="date">{{{attrs.localDates}}}</span>
-    {{#if attrs.postEvent.is_expired}}
-      <span class="participants">
-        {{i18n "event.post_ui.participants" count=attrs.postEvent.stats.going}}
-      </span>
-    {{/if}}
-  `
+  html(attrs) {
+    const content = [
+      iconNode("clock"),
+      h("span.date", new RawHtml({ html: attrs.localDates }))
+    ];
+
+    if (attrs.postEvent.is_expired) {
+      let participants;
+      const label = I18n.t("event.post_ui.participants", {
+        count: attrs.postEvent.stats.going
+      });
+      if (attrs.postEvent.stats.going > 0) {
+        participants = this.attach("link", {
+          action: "showAllInvitees",
+          actionParam: attrs.postEvent.id,
+          contents: () => label
+        });
+      } else {
+        participants = label;
+      }
+
+      content.push(h("span.participants", participants));
+
+      return content;
+    }
+  }
 });
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index b2c22fa..44eb83c 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -32,6 +32,7 @@ en:
       post_ui:
         show_all: show all
         participants:
+          zero: "- no one participated."
           one: "- %{count} user participated."
           other: "- %{count} users participated."
         invite: invite

GitHub sha: 7668ec6a