Option to move accepted answer to the top

Hi @sam, thank you for such an amazing plugin.

I’m interested, would it be possible to move the post that is marked as “Solved” up to the top right after OP post, without touching the core of the Discourse? I mean with just tweaks within the plugin itself. I would appreciate if you could give me some hints how to achieve it.

I think it makes sense, for example when the post that solves the OP post it deep down. Users will not have to endlessly scroll to find it. There are SEO considerations too. I guess the post that is marked as Solved contains the most important and the most relevant information that we want to present to Google above all other content.

1 Like

Users do not need to endlessly scroll to find it.

They need only click the link
“Solved in post #_

5 Likes

Changing ordering of the stream is something we actively avoid, its a complex change of dubious benefit. It can confuse users to read stuff out-of-order and is very technically tricky to pull off efficiently.

One thing New Relic did was duplicate the content, which might be easier than re ordering the stream.

2 Likes

I previously suggested that the “X replies” field (& functionality) would be used on OP, since that’s a guaranteed free space and an interaction users are already trained on.

7 Likes

That is a very good idea, we should do that!

1 Like

I really like this idea. I’ve had a go at implementing it, adding options for “hide_posts_before_solution” and “hide_posts_after_solution”.

Currently, a thread might look something like this:

Screenshot

Enabling “hide_posts_before_solution” would make it look like this:

Screenshot

Also enabling “hide_posts_after_solution” would make it look like this:

Screenshot

I think this makes it much easier for people who come across the topic later to find the useful information quickly, while also keeping it nice and simple for people who want to read the whole thread.

This functionality requires some changes to Discourse’s core to add “custom filters” to TopicView. I’ve based this on the recent additions of custom filters to TopicQuery, so I hope I have gone about it in the right way. The pull request to core is here:
https://github.com/discourse/discourse/pull/4740

and the pull request to discourse-solved can be found here:
https://github.com/discourse/discourse-solved/pull/48

Wait what? We proposed duplicating the content, much like a quote:

Click the top bar of that quote, where it says “sam”, to see what I mean.

I don’t know that a custom view filter is the right choice here, just use our existing “click to expand quote” functionality.

3 Likes

Appreciate this, but I really do want stream duplication here, hiding before and after feels super cludgy.

Instead after the solved text we should optionally include an excerpt and allow users to expand that in-place.

Eg:

How do I ride a bicycle?
I would really like to ride a bike.

Solved by sam in post #4
“What you would do is sit on bike and then paddle [more]”

1 Like

Ah well, maybe I misunderstood @erlend_sh’s post & screenshot above - I thought this was what he was suggesting, and what @codinghorror agreed with :laughing:.

I get the argument for duplicating the answer rather than collapsing everything down. In the meantime I’ll stick what I’ve done in a separate plugin so I can use it in my community.

Aside from discourse-solved, I do think having functionality for custom filters on TopicView would be useful for plugins in future. Is adding that extensibility something you would consider?

I need a specific use case here before accepting this kind of change :slight_smile:

1 Like

One thing I’d like to do with it is create a plugin to make specific categories more useful as “knowledge-bases” - so you’d have the first post of every topic as a wiki post, and all other posts would be “hidden” unless the user particularly wanted to see the conversation.

So you’d end up with something like this, but without having to make the topics read-only/closed.

It also opens up the possibility of doing topic-summary type things using plugins, like what is described in this spec:

2 Likes

I would stick with the original request. Sorry, I saw the expansion arrow on @erlend_sh’s mockup and assumed it worked like a standard quote. But I think you are correct, Erlend had a different idea here, one that I don’t really agree with.

Again, let’s all practice with how it works on a regular quote… just click anywhere in the top bar (where it says “David Taylor”) to expand it:

That is how the accepted answer should expand on the first post. It is an implicit quote.

1 Like

I kind of disagree you should even allow people to clutter your “howto” or “faq” or whatever topics with discussion, this is not the right place for it.

They should reply as linked topics and then you would have a list of stuff that links to it which is quite clean. Anyway better open another topic on knowledge base, it is a bit off topic here.

3 Likes

Ok, let’s try this again :wink:

This is what I’ve got working, which I’m 99.9% (ok, maybe 70% :laughing: ) sure is what is described above:

Screenshot

Then you can click the header, and it expands to the full post:

Screenshot

A couple of questions/issues:

  1. Should we display solved by david in post #2 in the header, or should it look like other quotes and just say david along with an avatar. If the latter, how do we indicate it is indeed the answer.
  2. Currently, if you go and change the “solution” then it causes the page to jump around all over the place because the height of the first post is changing. This happens with the discourse-solved plugin right now, but it’s not really noticeable since it’s only 1 line of text. I’m not really sure of a solution for this… Either we don’t update it live (so you have to reload the topic to see the quote), or have some kind of placeholder when the topic isn’t solved.

A possible solution to point 2 could look like this:



But I’m not a massive fan of this idea…

Anyone have any better ideas?

(Work-in-progress is here)

2 Likes

This looks great!!

Solved by david is perfect, make sure it has the down chevron affordance so people know it is expandable.

Only if the solution is currently expanded in the first post, right? I think that’s sufficiently enough of an edge condition that we can ignore it for now.

Well, that depends how long the “un-expanded” quote is. Are you thinking of not expanding at all until it’s clicked?

I think “solved by David in post #2” is fine in the unexpanded state. No excerpt needed.

One quirk, clicking or tapping anywhere on the line should expand it – except if you click or tap on “David” or “Post #2” of course.

1 Like

No excerpt makes it significantly easier to implement :slight_smile:

So it looks like this:

It’s reusing the quote UI from the rest of discourse, so clicking/tapping works anywhere along the bar, except of course on the links david and post #2

https://github.com/discourse/discourse-solved/pull/49

4 Likes

Sure if this looks good @sam can you review tomorrow?

1 Like