FEATURE: add Unseen view (PR #13977)

This view is the same as Latest except it hides the topics you have fully read. Based on this plugin of @davidtaylorhq Simple Unread List Plugin (discourse-simple-unread) - plugin - Discourse Meta.


      user.first_seen_at = 10.minutes.ago

This is a really clean PR, thank you. I made an extremely trivial suggestion to correct the grammar of the minutes method.

      user.first_seen_at = 10.minutes.ago
      user.first_seen_at = 10.minutes.ago

Does this need to be declared on self when it’s only being used in the same class and nowhere else?

There are several other filters next to this one:

  • self.new_filter
  • self.unread_filter
  • self.tracked_filter

Some of them are in use outside of the class. Looks like it’s better to stick to the same pattern here, even though we don’t use unseen_filter somewhere else yet.

even though we don’t use unseen_filter somewhere else yet.

In this case, I think it’ll be better if we keep the method private since there is no need for it to be public. If we need it to be public in the future, we can easily make it so.

  context '#list_unseen' do

Generally, our codebase follows Better Specs. Testing Guidelines for Developers. in describing methods which we’re testing.

      create_topic_with_three_posts(bumped_at: 15.minutes.ago)

Minor code style nitpick. In our codebase, we tend not to leave out brackets in general.

You can use the create_post helper defined for our specs to create a whisper post. That way, we don’t need to manually update Topic#highest_staff_post_number here.

Based on our internal discussion, we’ve decided to not display a count for this view.

IMO in this specific case sticking to the pattern is better, because it makes code more consistent (even taking into account that some plugin can start using it, and we’ll need to support backward compatibility).

But ok, making it private will work, so I’ve changed it.

I’ve fixed it, thank you!