### Problem

Currently, the OpenStreetMap user profile page lacks a comprehensive 
contribution activity feed similar to those seen on platforms like GitHub. This 
means users cannot easily track or showcase their activity across changeset 
edits, note interactions, diary entries, and GPS trace uploads. This gap limits 
the visibility of a user's contributions and engagement within the community.

### Description

This is proposal for adding a user activity feed to the OpenStreetMap profile 
page to provide a detailed view of contributions. This would enhance user 
interaction by showcasing a summary of recent actions in a structured and 
engaging format.

**Technical Proposal**
The implementation will be split into multiple Pull Requests (PRs) for 
incremental development:

**PR-1-1: Database Schema Setup**
- **Add `user_activities` table**:
  - Define columns: `id`, `user_id` (indexed), `activity_type`, `object_type`, 
`object_id`, `metadata`, `created_at` (indexed).
- **Tests**:
  - Write tests to ensure the schema setup functions correctly.
- **Data Retention Policy**:
  - Establish an archival policy for data older than a specified period (e.g., 
one year).

**PR-1-2: Model Layer - UserActivity Model and Basic Tracking Logic**
- **Create `UserActivity` Model**:
  - Define core associations (`belongs_to :user`) and basic validations.
- **Model Callbacks for Logging**:
  - Implement `after_create` and `after_update` callbacks in relevant models 
(`Changeset`, `Note`, `DiaryEntry`, `GPSTrace`) for logging actions.
- **Shared Logic**:
  - Create an `ActivityTrackable` concern for models needing activity tracking 
logic.
- **Tests**:
  - Ensure the concern and model validations are covered by comprehensive tests.

**PR-2: Controller Layer - User Activity Controller**
- **Create `UserActivityController`**:
  - Implement an `index` action to fetch user activities with support for 
pagination, filtering, and sorting.
- **Querying**:
  - Utilize scopes in the `UserActivity` model for efficient filtering and 
preloading of data.
- **Tests**:
  - Write controller tests to validate that scoped queries return correct 
results.

**PR-3: Frontend Layer - Activity Feed Display**
- **Implement Activity Feed Partial**:
  - Create a partial to display user activities in the profile section with a 
standardized format.
- **Integration Tests**:
  - Conduct view tests to confirm the feed works as expected.
- **Pagination**:
  - Implement infinite scroll or use cursor-based pagination to maintain 
consistency across the section.

### Screenshots

<img width="625" alt="Screenshot 2024-10-31 at 09 43 43" 
src="https://github.com/user-attachments/assets/14e22309-3410-460d-90d4-9e56ce59278a";>

This is the fast mockup i came up with. Could be modified to fit our use case a 
bit better according to feedback:

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5298
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to