diff --git a/GanjooRazor/Areas/User/Pages/Edits.cshtml b/GanjooRazor/Areas/User/Pages/Edits.cshtml
new file mode 100644
index 00000000..a444c378
--- /dev/null
+++ b/GanjooRazor/Areas/User/Pages/Edits.cshtml
@@ -0,0 +1,176 @@
+@page
+@model GanjooRazor.Areas.User.Pages.EditsModel
+@using RMuseum.Models.Ganjoor
+@using RMuseum.Services.Implementation
+@{
+ Layout = "_Layout";
+ ViewData["Title"] = "ویرایشهای من";
+ await GanjooRazor.Utils.GanjoorSessionChecker.ApplyPermissionsToViewData(Request, Response, ViewData);
+ string color = "gray";
+}
+
@ViewData["Title"]
+@if (Model.LastError != "")
+{
+ @Model.LastError
+}
+else
+{
+
+ @foreach (var paginationLink in Model.PaginationLinks)
+ {
+ if (!string.IsNullOrEmpty(paginationLink.Url))
+ {
+ @paginationLink.Name
+ }
+ else
+ {
+ @paginationLink.Name
+ }
+ }
+
+
+ @foreach (var correction in Model.Corrections)
+ {
+ if (color == "gray")
+ color = "white";
+ else
+ color = "gray";
+
+
+
+
+ | مشاهدهٔ متن شعر یا بخش |
+
+
+
+ | متن اولیه |
+ تغییرات من |
+ نتیجهٔ بررسی |
+
+
+ @if (correction.Title != null)
+ {
+
+ |
+ @correction.OriginalTitle
+ |
+
+ @correction.Title
+ |
+
+ @if (correction.Result == CorrectionReviewResult.Approved)
+ {
+ @CorrectionReviewResultConvertor.GetString(correction.Result)
+ }
+ else
+ @if (correction.Result == CorrectionReviewResult.Approved)
+ {
+ @CorrectionReviewResultConvertor.GetString(correction.Result)
+ }
+ else
+ {
+ @CorrectionReviewResultConvertor.GetString(correction.Result)
+ }
+ |
+
+ }
+ @if (correction.Rhythm != null)
+ {
+
+ |
+ @correction.OriginalRhythm
+ |
+
+ @correction.Rhythm
+ |
+
+ @if (correction.RhythmResult == CorrectionReviewResult.Approved)
+ {
+ @CorrectionReviewResultConvertor.GetString(correction.RhythmResult)
+ }
+ else
+ @if (correction.RhythmResult == CorrectionReviewResult.Approved)
+ {
+ @CorrectionReviewResultConvertor.GetString(correction.RhythmResult)
+ }
+ else
+ {
+ @CorrectionReviewResultConvertor.GetString(correction.RhythmResult)
+ }
+ |
+
+ }
+ @if (correction.VerseOrderText != null)
+ @foreach (var verse in correction.VerseOrderText)
+ {
+
+ |
+ @verse.OriginalText
+ |
+
+ @verse.Text
+ |
+
+ @if (verse.Result == CorrectionReviewResult.Approved)
+ {
+ @CorrectionReviewResultConvertor.GetString(verse.Result)
+ }
+ else
+ @if (verse.Result == CorrectionReviewResult.Approved)
+ {
+ @CorrectionReviewResultConvertor.GetString(verse.Result)
+ }
+ else
+ {
+ @CorrectionReviewResultConvertor.GetString(verse.Result)
+ }
+ |
+
+ }
+ @if (!string.IsNullOrEmpty(correction.Note))
+ {
+
+ | یادداشت: |
+
+ @correction.Note
+ |
+
+ }
+
+
+ |
+ @if (correction.Reviewed)
+ {
+ ویرایش مجدد
+ }
+ else
+ {
+ مشاهده
+ }
+ |
+
+
+
+
+
+
+
+
+ }
+
+
+ @foreach (var paginationLink in Model.PaginationLinks)
+ {
+ if (!string.IsNullOrEmpty(paginationLink.Url))
+ {
+ @paginationLink.Name
+ }
+ else
+ {
+ @paginationLink.Name
+ }
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/GanjooRazor/Areas/User/Pages/Edits.cshtml.cs b/GanjooRazor/Areas/User/Pages/Edits.cshtml.cs
new file mode 100644
index 00000000..55de5007
--- /dev/null
+++ b/GanjooRazor/Areas/User/Pages/Edits.cshtml.cs
@@ -0,0 +1,135 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Threading.Tasks;
+using DNTPersianUtils.Core;
+using GanjooRazor.Utils;
+using GSpotifyProxy.Models;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using RMuseum.Models.Ganjoor.ViewModels;
+using RSecurityBackend.Models.Generic;
+
+namespace GanjooRazor.Areas.User.Pages
+{
+ [IgnoreAntiforgeryToken(Order = 1001)]
+ public class EditsModel : PageModel
+ {
+ //
+ /// Last Error
+ ///
+ public string LastError { get; set; }
+
+ ///
+ /// pagination links
+ ///
+ public List PaginationLinks { get; set; }
+
+ ///
+ /// Corrections
+ ///
+ public List Corrections { get; set; }
+ public async Task OnGetAsync()
+ {
+ LastError = "";
+ using (HttpClient secureClient = new HttpClient())
+ if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ {
+ {
+ int pageNumber = 1;
+ if (!string.IsNullOrEmpty(Request.Query["page"]))
+ {
+ pageNumber = int.Parse(Request.Query["page"]);
+ }
+ var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/corrections/mine?PageNumber={pageNumber}&PageSize=20");
+ if (!response.IsSuccessStatusCode)
+ {
+ LastError = await response.Content.ReadAsStringAsync();
+ return Page();
+ }
+ response.EnsureSuccessStatusCode();
+
+ Corrections = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
+
+ string paginnationMetadata = response.Headers.GetValues("paging-headers").FirstOrDefault();
+ if (!string.IsNullOrEmpty(paginnationMetadata))
+ {
+ PaginationMetadata paginationMetadata = JsonConvert.DeserializeObject(paginnationMetadata);
+ PaginationLinks = new List();
+ if (paginationMetadata.totalPages > 1)
+ {
+ if (paginationMetadata.currentPage > 3)
+ {
+ PaginationLinks.Add
+ (
+ new NameIdUrlImage()
+ {
+ Name = "صفحهٔ اول",
+ Url = "/User/Edits/?page=1"
+ }
+ );
+ }
+ for (int i = (paginationMetadata.currentPage - 2); i <= (paginationMetadata.currentPage + 2); i++)
+ {
+ if (i >= 1 && i <= paginationMetadata.totalPages)
+ {
+ if (i == paginationMetadata.currentPage)
+ {
+
+ PaginationLinks.Add
+ (
+ new NameIdUrlImage()
+ {
+ Name = i.ToPersianNumbers(),
+ }
+ );
+ }
+ else
+ {
+
+ PaginationLinks.Add
+ (
+ new NameIdUrlImage()
+ {
+ Name = i.ToPersianNumbers(),
+ Url = $"/User/Edits/?page={i}"
+ }
+ );
+ }
+ }
+ }
+ if (paginationMetadata.totalPages > (paginationMetadata.currentPage + 2))
+ {
+
+ PaginationLinks.Add
+ (
+ new NameIdUrlImage()
+ {
+ Name = "... ",
+ }
+ );
+
+ PaginationLinks.Add
+ (
+ new NameIdUrlImage()
+ {
+ Name = "صفحهٔ آخر",
+ Url = $"/User/Edits/?page={paginationMetadata.totalPages}"
+ }
+ );
+ }
+ }
+ }
+
+ }
+ }
+ else
+ {
+ LastError = "لطفا از گنجور خارج و مجددا به آن وارد شوید.";
+ }
+ return Page();
+ }
+ }
+}
diff --git a/GanjooRazor/Pages/Shared/_Layout.cshtml b/GanjooRazor/Pages/Shared/_Layout.cshtml
index 255d659c..2423cbf6 100644
--- a/GanjooRazor/Pages/Shared/_Layout.cshtml
+++ b/GanjooRazor/Pages/Shared/_Layout.cshtml
@@ -306,6 +306,10 @@
اعلانهای من
+
+ ویرایشهای من
+
+
@if (ViewData.ContainsKey("ganjoor-songrevu"))
{
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index 7832fd65..abf26692 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -8794,6 +8794,18 @@
+
+
+ تبدیلگر CorrectionReviewResult
+
+
+
+
+ تبدیل به رشته
+
+
+
+
donation service
diff --git a/RMuseum/Services/Implementation/CorrectionReviewResultConvertor.cs b/RMuseum/Services/Implementation/CorrectionReviewResultConvertor.cs
new file mode 100644
index 00000000..41500a79
--- /dev/null
+++ b/RMuseum/Services/Implementation/CorrectionReviewResultConvertor.cs
@@ -0,0 +1,35 @@
+using RMuseum.Models.Ganjoor;
+
+namespace RMuseum.Services.Implementation
+{
+ ///
+ /// تبدیلگر CorrectionReviewResult
+ ///
+ public static class CorrectionReviewResultConvertor
+ {
+ ///
+ /// تبدیل به رشته
+ ///
+ ///
+ ///
+ public static string GetString(CorrectionReviewResult reviewResult)
+ {
+ switch(reviewResult)
+ {
+ case CorrectionReviewResult.Approved:
+ return "تأیید میشود";
+ case CorrectionReviewResult.NotChanged:
+ return "تغییری نکرده";
+ case CorrectionReviewResult.RejectedBecauseWrong:
+ return "درست نیست";
+ case CorrectionReviewResult.RejectedBecauseVariant:
+ return "مربوط به نسخهٔ دیگری است";
+ case CorrectionReviewResult.RejectedBecauseUnnecessaryChange:
+ return "تغییر سلیقهای یا بی دلیل است";
+ case CorrectionReviewResult.Rejected:
+ return "به دلیل دیگری رد میشود";
+ }
+ return "بررسی نشده";
+ }
+ }
+}
diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs
index 8dd47653..82c03443 100644
--- a/RMuseum/Services/Implementation/GanjoorService.cs
+++ b/RMuseum/Services/Implementation/GanjoorService.cs
@@ -1420,28 +1420,38 @@ namespace RMuseum.Services.Implementation
where dbCorrection.UserId == userId
orderby dbCorrection.Id descending
select
- new GanjoorPoemCorrectionViewModel()
- {
- Id = dbCorrection.Id,
- PoemId = dbCorrection.PoemId,
- UserId = dbCorrection.UserId,
- VerseOrderText = dbCorrection.VerseOrderText == null ? null : dbCorrection.VerseOrderText.ToArray(),
- Title = dbCorrection.Title,
- OriginalTitle = dbCorrection.OriginalTitle,
- Rhythm = dbCorrection.Rhythm,
- OriginalRhythm = dbCorrection.OriginalRhythm,
- Note = dbCorrection.Note,
- Date = dbCorrection.Date,
- Reviewed = dbCorrection.Reviewed,
- Result = dbCorrection.Result,
- RhythmResult = dbCorrection.RhythmResult,
- UserNickname = string.IsNullOrEmpty(dbCorrection.User.NickName) ? dbCorrection.User.Id.ToString() : dbCorrection.User.NickName
- };
+ dbCorrection;
- (PaginationMetadata, GanjoorPoemCorrectionViewModel[]) paginatedResult =
- await QueryablePaginator.Paginate(source, paging);
+ (PaginationMetadata PagingMeta, GanjoorPoemCorrection[] Items) dbPaginatedResult =
+ await QueryablePaginator.Paginate(source, paging);
- return new RServiceResult<(PaginationMetadata, GanjoorPoemCorrectionViewModel[])>(paginatedResult);
+ List list = new List();
+ foreach (var dbCorrection in dbPaginatedResult.Items)
+ {
+ list.Add
+ (
+ new GanjoorPoemCorrectionViewModel()
+ {
+ Id = dbCorrection.Id,
+ PoemId = dbCorrection.PoemId,
+ UserId = dbCorrection.UserId,
+ VerseOrderText = dbCorrection.VerseOrderText == null ? null : dbCorrection.VerseOrderText.ToArray(),
+ Title = dbCorrection.Title,
+ OriginalTitle = dbCorrection.OriginalTitle,
+ Rhythm = dbCorrection.Rhythm,
+ OriginalRhythm = dbCorrection.OriginalRhythm,
+ Note = dbCorrection.Note,
+ Date = dbCorrection.Date,
+ Reviewed = dbCorrection.Reviewed,
+ Result = dbCorrection.Result,
+ RhythmResult = dbCorrection.RhythmResult,
+ UserNickname = string.IsNullOrEmpty(dbCorrection.User.NickName) ? dbCorrection.User.Id.ToString() : dbCorrection.User.NickName
+ }
+ );
+ }
+
+ return new RServiceResult<(PaginationMetadata, GanjoorPoemCorrectionViewModel[])>
+ ((dbPaginatedResult.PagingMeta, list.ToArray()));
}
///