You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a reader on a Superdesk Publisher website, I would like to be able to follow my favourite authors on that website.
Possible solutions/implementations
From a templating standpoint we would need the following for it to work.
Submit a post request to connect an Author with the current app.user.
List articles based on the authors that a user follows.
Let's start with the first point. Submit a POST request to a (new) Controller.
Form template
I propose that we, in templates, use forms to POST to a new "follow_author" endpoint. Similar to what we already do for user login. The receiving controller would connect the author from the form with the currently logged in user.
It might look something like this:
{% ifapp.user %}
<formaction="{{ path('follow_author') }}"method="POST">
<inputtype="hidden"name="_author"value="{{ author.id }}" />
<inputtype="submit"value="Follow author" />
</form>
{% else %}
<buttontype="button"disabled>Follow Author</button>
(You must login to follow an author)
{% endif %}
List followed articles
The listing of articles might look different based on what implementation we choose for the backend. I see two primary alternatives.
Alternative A – new loader
The simplest solution of the two alternatives. A new loader that can load the followed articles. Perhaps from a new table swp_user_author that holds the many-to-many relationship between a user and its subscribed authors.
A more flexible and robust solution might be to create a new type of content list. A FollowList. Similar to the current ContentList templating-wise. It could possibly also be cached similarly to content lists.
An added benefit to a generic FollowList is that it isn't bound to only follow authors. In the future, a user could possibly follow keywords, routes or genres.
@kottkrig the second solution sounds good, but not sure if you would have to extend it by adding user to it and if that won't affect existing content lists. If not, I would go for it, otherwise let's stick to alternative 1.
As a reader on a Superdesk Publisher website, I would like to be able to follow my favourite authors on that website.
Possible solutions/implementations
From a templating standpoint we would need the following for it to work.
app.user
.Let's start with the first point. Submit a POST request to a (new) Controller.
Form template
I propose that we, in templates, use forms to POST to a new "follow_author" endpoint. Similar to what we already do for user login. The receiving controller would connect the author from the form with the currently logged in user.
It might look something like this:
List followed articles
The listing of articles might look different based on what implementation we choose for the backend. I see two primary alternatives.
Alternative A – new loader
The simplest solution of the two alternatives. A new loader that can load the followed articles. Perhaps from a new table
swp_user_author
that holds the many-to-many relationship between a user and its subscribed authors.In twig it could look something like this:
Alternative B – new type of content list
A more flexible and robust solution might be to create a new type of content list. A
FollowList
. Similar to the currentContentList
templating-wise. It could possibly also be cached similarly to content lists.An added benefit to a generic
FollowList
is that it isn't bound to only follow authors. In the future, a user could possibly follow keywords, routes or genres.The text was updated successfully, but these errors were encountered: