Skip to content

DISCUSSIONS

quantumm edited this page May 11, 2019 · 5 revisions

Discussions between users are managed with the help of two main classes : PublicDiscussion and PrivateDiscussion. Those two classes inherit from an abstract class AbstractDiscussion that contains the common methods and arguments of those two (like $title, $posts, $unreaders ...)

The discussions are filled with posts (Post class).

Public discussions

Anyone (even not logged) can read the public discussions.

They are divided in 4 types :

  • Global discussions : accessible through the global room. Their matter is completely free.
  • Theme discussions : discussions associated to a particular theme. Accessible through any theme view.
  • Proposal discussions : discussions associated to a particular proposal. Accessible through any proposal view.
  • Article discussions : discussions associated to a particular article. Accessible through any article view.

The $type argument of a public discussion permits to discriminate between them.

A public discussion has also a $followers argument that registers the users who follow the discussion. If a user follows a public discussion he can access it directly through his account.

All the actions on a public discussion are in the PublicDiscussionController.

Creation

Any logged user can create a public discussion. It can do it through the general forum, a theme view, a proposal view or an article view. It will create the corresponding public discussion type.

It uses the EditDiscussionType form which asks only for the title of the discussion.

The unicity of the title is not checked: some different discussions can have the same title.

Modification

?? Once it has been created, only the administrator can edit the discussion.

The edition of a discussion is also done with the EditDiscussionType form (modification of the title).

Any logged user can choose to follow any public discussion. In this case the discussion will appear in the followed discussion tab of his profile. It will be noticed if there is any new comment on the followed discussion. Those aspects are managed by the PublicDiscussionVoter.

Any logged user can post in a public discussion. Note that he can post an empty comment.

Administration

The administrator can displace any public discussion to any other place and change its type. He can for exemple move a global discussion to a theme discussion.

The administrator can lock any public discussion. In this case no user can post in the discussion anymore.

The administrator can move or delete (removal from the database) any post in a public discussion.

The administrator can delete any public discussion (removal from the database).

View

All the public discussion share the layout Discussion/layout_public_discussion, which inherits from the global layout.

Private discussions

The PrivateDiscussion class has an $admin and some $members. Only the members can read a private discussion (the admin should always be in the members).

All the actions on a private discussion are in the PrivateDiscussionController.

The security of the private discussion is managed with the PrivateDiscussionVoter.

Creation

Any logged user can create a private discussion with other chosen users. This can be done through his personal profile.

The AddPrivateDiscussionType form manages the creation of a private discussion. This form has a field for the title of the discussion and an other one to choose among the other users (the members).

The creator of the private discussion is by defaut its administrator (PrivateDiscussion.admin).

The unicity of the title is not checked: some different discussions can have the same title.

Modification

The non-admin members can access the discussion through their personal profile (message tab).

It is signaled when there has been some new posts (the members are then placed in PrivateDiscussion.unreaders). The discussion is highlighted.

They can read the discussion and post.

They can get out of the discussion.

Administration

The administration of the discussion is done by the administrator of the discussion.

He can edit the discussion (change its title). This is managed by the EditDiscussionType form (notice that this form is common for the edition of the public discussions).

He can lock/unlock the discussion. In this case the members cannot post in it.

He can add a member to the discussion. Notice that this functionnality disappears if all the users of the application are in the discusssion.

He can remove a member from the discussion.

He can delegate his role to another member of the discussion (change administrator). This opens a SelectUserType form.

He can suppress the discussion from the database.

View

All the private discussions share the layout Discussion/layout_private_discussion, which inherits from the global layout.