Giter Club home page Giter Club logo

fairplaysocial's People

Contributors

allcontributors[bot] avatar dsm637 avatar efonsecab avatar samantatarun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fairplaysocial's Issues

Create the test class "MyPostClientService_Tests"

  • Create the test class "MyPostClientService_Tests", see "ApplicationUserClientService_Tests" to check how it is currently done.
  • Create a client test for the method CreateMyPostAsync in MyPostClientService class, the test method must be named "Test_CreateMyPostAsync_Allowed"
  • Create a client test for the method CreateMyPostAsync in MyPostClientService class, the test method must be named "Test_CreateMyPostAsync_NotAllowed"

Add ability to delete owned posts

Create a new page "MyAuthoredPosts"
The page must make use of the Feed component to show the list of authored posts.
Each post must have a button with a trash icon.
When clicked, it will require confirmation from the user "Are you sure you want to delete this post?"
If user indicates yes, the post will be deleted.

Create a new table named Group

Create a new table named Group, with the following columns

  • GroupId
  • OwnerApplicationUserId
  • Name
  • Description
  • TopicTag
  • IOriginatorInfo interface columns

Plan the Reputation System

Social Media platforms currently have big issues in keeping the veracity of posted information.
We want to design a Reputation System, to help reduce that issue.
The initial plan is to allow users to earn Reputation Points when sharing accurate and useful content.
Fake news, bots posts and similar items which negatively affect the platforms experience should greately reduce the Reputation Points.

Add pagination to the PostHistory modal

Currently, if there are too many items in the Post History modal, they fall out of the visible screen.
Implement pagination, similar to the Home Feed pagination.

image

Research best way to do ReShares of post

Currently, the platform offers an initial ReShare functionality, however, it's implementation may not be the best.
At the moment the Post table has a Self-Referencing Foreing Key, and is allowing to do ReShares of ReShares, this may result in performance problems when the platforms reaches millions of users since the ReShare hierarchy could grow exponentially, and since it is a Self-Referencing hierarchy, it may eventually be required to do recursive queries.

The alternative considered approach is to have a table like "PostReshare", which would be a flat table, with a Foreign Key to the Post table, this however, would mean that to retrieve posts and ReShares in the correct order, a more complex select would need to be created to merge the data of both the Post and PostReShare tables.

Please add your thoughts, ideas, and recommendations on the subject.

Fix home page icons not loading correctly

Sometime, when loading the home screen for a user role, the icons grid is rendered incorrectly, it happens randomly, and don't happen every single time.

Steps to reproduce

  • Login to the system with a user account. Create a nenw one if you don't have.
  • Wait for the home page to be displayed.
  • See the rendered icons.

Actual Result:
Sometime the icons show up as only one column.

Expected Result
When page maximized, icons grid should look like this
image

Research Pros and Cons of using ActivityPub

Currently, the platform is not adhering to official standards such as ActivityPub.
There are some concerns about adhering to decentralized technologies.
The software in the FairPlay category has as one of its core values to protect users, FairPlaySocial for instance will eventually block and deleted posts with disrespectful content or language, in case of adhering to decentralized standards, the platform will probably lose the control of which posts to delete, since people could have already shared them in other platforms/networks

Research the advantages and disadvantages of using ActivityPub

Improve the loading indicator

Currently, the loading indicator is implemented as an independent component, and is explicitly where it is required to be show, the current implementation however, makes it so that the html is rendering as a child of other components, so in smaller containers the indicator is not displayed over the whole screen, and only on the parent container.
We need to modify this behavior, so that the loading indicator overlay is always displayed over the whole screen, even over the header and footer.

We need to research the best way to do this without using javascript.

Create the "ApplicationUserFollowProfile"

Requires #5 to be implemented

  • In the server project, under the AutoMapper profiles, create a new one named "ApplicationUserFollowProfile"
  • Add the respective mapping setup, check the rest of the mapping profiles to grasp an idea of the patten

Create the table GroupMember

Requires #42 to be implemented

Create a new table named GroupMember, with the following columns

  • GroupId
  • MemberApplicationUserId
  • IOriginatorInfo interface columns

Create the GroupModerator table

Create the table "GroupModerator" with the following columns

  • GroupModeratorId (BIGINT, NOT NULL, PK_GroupModerator, IDENTITY)
  • GroupId (BIGINT, NOT NULL, Foreign Key to Group)
  • ModeratorApplicationUserId (BIGINT, NOT NULL, Foreign Key to ApplicationUser)
  • IOriginatorInfo interface columns

Add the .NET 7 Blazor Loading indicator

Blazor in .NET 7 introduce a loading indicator approach when first loading the app.
It is located in the index.html and works using the css classes in the app.css file.

Introduce that technique in the Blazor Webassembly app for this project.

Create the basis for supporting Speech Recognition

Add support Speech Recognition for the whole system.

In the Blazor Web Assembly App, use the Web Speech API
https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API#speech_recognition

In the MAuI App the solution use a MAUI native feature is available,
otherwise verify if the Web Speech API would work.

The functionality needs to be implemented in the form of an agnostic Service interface, with custom classes implementing the platform specific functionality, similar to how IGeoLocationServic is currently implemented.

The following classes may work for this

  • iOS & MAC: Speech.SFSpeechRecognizer
  • Android: Android.Speech.SpeechRecognizer
  • Windows: Windows.Media.SpeechRecognition.SpeechRecognizer

Useful videos

Create the Follow shared models

Requires #4 to be implemented

  • In the project "FairPlaySocial.Models", add a new folder named "ApplicationUserFollow"
  • Add two new classes into that folder: "CreateApplicationUserFollowModel", "ApplicationUserFollowModel"
  • Add the respective columns to each of those models, check the rest of the models to grasp an idea of the pattern

Add support for posting Polls

Create the table Poll, with the following columns

  • PollId BIG INT NOT NULL IDENTITY
  • Text NVARCHAR(50) NOT NULL
  • DurationDays TINYINT NOT NULL
  • OwnerApplicationUserId Foreing Key to ApplicationUser.ApplicationUserId
    Add the IOriginatorInfo interface columns

Create a new table PollOption with the following columns

  • PollOptionId BIG INT NOT NULL IDENTITY
  • PollId BIG INT Foreign Key to Poll.PollId
  • Text NVARCHAR(20) NOT NULL
  • Add the IOriginatorInfo interface columns

In the Post table, add the following column

  • PollId, BIGINT NULLABLE Foreing Key to Poll.PollId

Create the table PollResponse with the following columns

  • PollResponseId BIGINT NOT NULLABLE IDENTITY
  • PollOptionId BIG INT Foreign Key to PollOption.PollOptionId
  • RespondentApplicationUserId Foreign Key to ApplicationUser.ApplicationUserId
  • Add IOriginatorInfo interface columns

Regenerate the data access

Create the models: PollModel, CreatePollModel, PollOptionModel, CreatePollOptionModel

To the CreatePostModel, add a new property Poll of type CreatePollModel

In the Create Post Page, add a new option to create a poll, along with 4 options (possible answers)

Modify the PostComponent so that if renders the Poll if there is one available.
When a user click the post option radio button, update the poll response, using an endpoint
public async Task<IActionResult> PollResponseController.CreatePollResponseAsync(CreatePollResponseModel createPollResponseModel, CancellationToken cancellationToken)
You will need to create the respective client service for that endpoint

If there is already a response from the same user to the same poll, the existent response will be deleted by the endpoint before adding the new one.

When viewing posts, it should show the % of answers for each option.
Once the user has chosen an option in the poll, if the user clicks on any of the options, it will show a modal listing the users who chose that option.

For the moment, we will not allow to edit the selected option in polls

Fill the list of forbidden urls

FairPlaySocial already has a small feature to deny creating posts with Forbidden Urls.
There is a table "ForbiddenUrl" and a class "ForbiddenUrlService".
The urls must be the shortest form of the url, without protocol

Currently, the table is empty, we need to start filling the list with 2 types of urls

  • Dangerous domains: (links containing spyware, malware, viruses)
  • Adult domain: links containing adult content

In the Post-Deployment script, add the lines to insert the Forbidden Urls.

Once the list is filled, it is required to test users cannot create posts containing any forbidden url.

Note: Research if it is feasible to create a custom validator reading a test file embedded in the assembly, containing the list of forbidden sites, this will help to avoid doing a roundtrip to check for forbidden urls.

Create the service "ReportService"

Create a new service named "ReportService", with the following methods

  • GetDailyCreatedPosts: it must return the average # of reports created for each day of the week
    e.g.
    • Mondays: 15642 posts created in average
    • Tuesdays: 5642 posts created in average
    • Wednesdays: 6542 posts created in average
    • Thursdays: 427 posts created in average
    • Fridays: 49 856 posts created in average
    • Saturdays: 3567 posts created in average
    • Sundays: 98654 posts created in average
  • GetHourlyCreatedPosts
  • GetRegionByIpCreatedPosts
  • GetRegionBySharedGeoLocationCreatedPosts

Create the service GroupService

Create a new partial class named "GroupService"
Set the attribute

  • ServiceOfEntity

Register the service in the Dependency Injection container for the Web API

Crete the MyFollowController

Requires #6 to be implemented

In the server project add a new class named "MyFollowController"

[Route("api/[controller]")]
[ApiController]
[Authorize(Roles = Constants.Roles.User)]
public class MyFollowController : ControllerBase
{
   private readonly IMapper mapper;
   private readonly ICurrentUserProvider currentUserProvider;
   private readonly ApplicationUserFollowService applicationUserFollowService;

    public MyFollowController(IMapper mapper, ICurrentUserProvider currentUserProvider,
        ApplicationUserFollowService applicationUserFollowService)
    {
        this.mapper = mapper;
        this.currentUserProvider = currentUserProvider;
        this.applicationUserFollowService = applicationUserFollowService;
    }
}

The class must implement two endpoints

[HttpPost("[action]")]
public async Task FollowUserAsync(long userToFollowApplicationUserId, CancellationToken cancellationToken)
{
}

[HttpPost("[action]")]
public async Task UnFollowUserAsync(long userToUnFollowApplicationUserId, CancellationToken cancellationToken)
{
}

** Note: Use the applicationUserFollowService service injected in the class to insert and delete the respective database record

Add Localization for the Azure AD Login Flow

The system uses Azure AD B2C Flows for login.
Azure AD B2C allows to pass a parameter for localization

  • "ui_locales=en"

We want to be able to send that parameter based on the value of the blazor culture cookie.

.NET 7 allows sending additional parameters for the login process, using InteractiveRequestOptions along with NavigationManager.NavigateToLogin.

We need to verify if that will work for our need.

https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/additional-scenarios?view=aspnetcore-7.0

Note: There is a change this is not currently supported

Research best way to delete posts with replies

Currently, the system is only allowing to delete posts if these don't have any replies.
Enabling deleting posts with replies brings additional considerations.
Deleting posts with comments requires recursive functionality and respecting foreign keys.
We need to find a way to do this through Entity Framework, using something like Recursive Projections that translate into SQL.
Note: Enabling cascade delete is not an option

Research the options not requiring creating manual queries, nor SQL SERVER behavior.

After all options have been evaluated, if none is good enough we will end up creating a stored procedure, and mapping it, the stored procedure will internally have a recursive CTE to do the delete of the post's' replies hierarchy.

Add the Localization Resources for the menu items

In the Index Page, in the Shared UI project, add the respective resource keys for the Menu Items text.
Follow the naming convention currently used , locate the code in the code behind of the Index Page
#region Resource Keys

After the resource keys have been added, modify the "OnInitializedAsync" method so that it sets the text using the Localizer

Prohibit created posts with duplicate tags

Currently, when creating new posts, these can be created sending the same value for Tag1, Tag2, and Tag3.
Create a Custom Validator that will forbid doing this so that the value cannot be duplicate among these proeprties.

Create a new controller named "MyGroupController"

Requires #48

  • Create a new Web API controller named "MyGroupController", set it as a partial class.
  • Add the authorization attribute for the Role=User (Use the existent constants)

Make sure to create the require models

  • CreateGroupModel
  • GroupModel

Create the ApplicationUserFollow table

In the database project, create a new table named "ApplicationUserFollow", with the following columns

  • ApplicationUserFollowId (Primary Key named PK_ApplicationUserFollow, BIGINT, NOT NULLABLE, IDENTITY)
  • FollowerApplicationUserId (Foreing Key to ApplicationUser.ApplicationUserId)
  • FollowedApplicationUserId (Foreing Key to ApplicationUser.ApplicationUserId)

Add the auditing columns used in the ErrorLog table

Recreate the Data Access (Use EF Core Power Tools Reverse Engineerig), remember to create the class ApplicationUserFollow.partial and make it implement the IOriginatorInfo interface

Create the table PostReach

Create the table "PostReach" with the following columns

  • PostReachId (BIGINT, NOT NULL, PK_PostReach, IDENTITY)
  • ReachedByApplicationUserId (BIG INT, NOT NULL, Foreign Key to ApplicationUser)
  • IOriginatorInfo interface columns

Create the ApplicationUserFollowService

Requires task #3 to be implemented

In the project "FairPlaySocial.Services", add a new partial class named "ApplicationUserFollowService"

[ServiceOfEntity:nameof(ApplicationUserFollow), primeryKeyType:typeof(long)]
public partial class ApplicationUserFollowService
{
}

Create a new client service named "MyGroupClientService"

Requires #49

  • Create a new partial class named "MyGroupClientService"
  • Register the client service in the platform agonistic class
  • In the existent controller add the create method with the following signature
[HttpPost("[action]")]
public async Task<GroupModel?> CreateMyGroupAsync(CreateGroupModel createGroupModel, CancellationToken cancellationToken)
  • Implement the creation code, you can check sample from the other controllers with the work "My"
  • Add the client service respective method
  • Create the required Automapper profile class "GroupProfile"

Fix the value for post creation time

When displaying posts, a numeric value is being shown to indicate how long ago the post was created, currently, the value is not working correctly, it is using TimeSpan.Hours instead of TimeSpan.TotalHours and TimeSpan.Minutes instead of TimeSpan.TotalMinutes.

Also we want to avoid showing huge numbers, apply the following rule

  • Post with less than 1 hour of existence: Display as ##m
  • Post with between 1 and 24 hours of existence: Display as ##h
  • Post with more than 24 hours of existence: Display as ##d

Create a table named "PostVisibility"

Create a table named "PostVisibility" with the following columns

  • PostVisibilityId (Identity)
  • Name (Unique Index)
  • Description

Modify the Post Deployment script to insert the default data
Id - Name - Description
1 - Public - Visible to everyone
2 - Subscribers - Visible to subscribers only

Recreate the Data Access

Apply recommendations from Visual Studio Code Analyzer

Note: For this task, ignore the MAUI project.

Apply recommendations from Visual Studio Code Analyzer, make sure to run it multiple times after apply the recommendations, since, initially, not all of them may show up.

image

image

Add support for 1 image upload when creting a post

  • In the Database project, add a new column to the table Post, the column must be named PhotoId, not nullable, bigint, and must be a foreign key to Photo.PhotoId.
  • Recreate the Data Access using EF Core Power Tools Reverse Engineering option
  • In the CreateMyPost.razor page support uploading a new photo using the already created component ImagePicker.razor
  • Modify the file CreatePostModel.cs, include the following property
[Required]
public CreatePhotoModel? Photo { get; set; }
  • Modify the PostProfile.cs to support the automatic mapping of the new photo related fields

Create the test class "MyFeedClientService_Tests"

  • Create a new test class named "MyFeedClientService_Tests"
  • Add a test method named "Test_GetMyHomeFeedAsync"
  • Add the logic to test the method "GetMyHomeFeedAsync" in the MyFeedClientService class, to insert the pre-required test data, use the method CreateMyPostAsync in the MyPostClientService class

Create the MyFollowClientService

Requires #7 to be implemented

In the ClientServices project, add a new class named "MyFollowClientService"

public class MyFollowClientService
{
   private readonly HttpClientService httpClientService;

   public MyFollowClientService(HttpClientService httpClientService)
   {
      this.httpClientService=httpClientService;
   }

   public async Task FollowUserAsync(long userToFollowApplicationUserId, CancellationToken cancellationToken)
   {
   }

   public async Task UnFollowUserAsync(long userToUnFollowApplicationUserId, CancellationToken cancellationToken)
   {
   }
}

Note: Implement the respective calls to the server endpoints, check the other client services classes to grasp an idea of the pattern.

Implement preview generation when sharing URLs

Most social networks, when sharing post with URLs, generate a preview of the linked URL, we want to achieve that to generate a preview when sharing a url.

Research the use of the library Blazor.AngleSharp, as well as the LICENSE

The following article shows some examples
https://www.jerriepelser.com/blog/extracting-open-graph-protocol-data/

Note: Simply using HttpClient.GetAsync cannot fully achieve what we want, especially with SPAs systems, which modify the html after the initial response, we need to use some kind of navigator that would even execute javascript, this however brings security concerns.

Make the component "Feed.razor" scroll to top when receiving a new notification.

Before doing this change, research if .NET 7 "JSImport/JSExport" is feasible to be used for this task.
https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/import-export-interop?view=aspnetcore-7.0

Currently, the component "Feed", is not scrolling to the top when a new post is received, however, we want to scroll to top in the event of a new notification.
If it is possible to avoid javascript, that would be preferable, if not, the functionality must be implemented using Isolated Javascript within a file named "Feed.razor.js"

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.