WIP allow blog comment
This commit is contained in:
3519
src/Yavsc.Server/Migrations/20250705112955_commentAllowed.Designer.cs
generated
Normal file
3519
src/Yavsc.Server/Migrations/20250705112955_commentAllowed.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
54
src/Yavsc.Server/Migrations/20250705112955_commentAllowed.cs
Normal file
54
src/Yavsc.Server/Migrations/20250705112955_commentAllowed.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Yavsc.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class commentAllowed : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "Comment",
|
||||||
|
table: "CircleAuthorizationToBlogPost",
|
||||||
|
type: "boolean",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Avatar",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
type: "character varying(512)",
|
||||||
|
maxLength: 512,
|
||||||
|
nullable: true,
|
||||||
|
defaultValue: "/images/Users/icon_user.png",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(512)",
|
||||||
|
oldMaxLength: 512,
|
||||||
|
oldDefaultValue: "/images/Users/icon_user.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Comment",
|
||||||
|
table: "CircleAuthorizationToBlogPost");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Avatar",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
type: "character varying(512)",
|
||||||
|
maxLength: 512,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "/images/Users/icon_user.png",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "character varying(512)",
|
||||||
|
oldMaxLength: 512,
|
||||||
|
oldNullable: true,
|
||||||
|
oldDefaultValue: "/images/Users/icon_user.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -303,6 +303,9 @@ namespace Yavsc.Migrations
|
|||||||
b.Property<long>("BlogPostId")
|
b.Property<long>("BlogPostId")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<bool>("Comment")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.HasKey("CircleId", "BlogPostId");
|
b.HasKey("CircleId", "BlogPostId");
|
||||||
|
|
||||||
b.HasIndex("BlogPostId");
|
b.HasIndex("BlogPostId");
|
||||||
@ -338,7 +341,6 @@ namespace Yavsc.Migrations
|
|||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.Property<string>("Avatar")
|
b.Property<string>("Avatar")
|
||||||
.IsRequired()
|
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasMaxLength(512)
|
.HasMaxLength(512)
|
||||||
.HasColumnType("character varying(512)")
|
.HasColumnType("character varying(512)")
|
||||||
@ -3393,8 +3395,7 @@ namespace Yavsc.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
|
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("AccountBalance")
|
b.Navigation("AccountBalance");
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("BankInfo");
|
b.Navigation("BankInfo");
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ namespace Yavsc.Models.Access
|
|||||||
|
|
||||||
public class CircleAuthorizationToBlogPost : ICircleAuthorization
|
public class CircleAuthorizationToBlogPost : ICircleAuthorization
|
||||||
{
|
{
|
||||||
public long CircleId { get; set; }
|
public long CircleId { get; set; }
|
||||||
public long BlogPostId { get; set; }
|
public long BlogPostId { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[ForeignKey("BlogPostId")]
|
[ForeignKey("BlogPostId")]
|
||||||
@ -17,7 +17,10 @@ namespace Yavsc.Models.Access
|
|||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[ForeignKey("CircleId")]
|
[ForeignKey("CircleId")]
|
||||||
public virtual Circle Allowed { get; set; }
|
public virtual Circle Allowed { get; set; }
|
||||||
|
|
||||||
|
public bool Comment { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,6 @@ namespace Yavsc.Models
|
|||||||
[InverseProperty("Owner"), JsonIgnore]
|
[InverseProperty("Owner"), JsonIgnore]
|
||||||
public virtual List<ChatConnection> Connections { get; set; }
|
public virtual List<ChatConnection> Connections { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User's circles
|
/// User's circles
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -50,8 +50,9 @@ public class PermissionHandler : IAuthorizationHandler
|
|||||||
{
|
{
|
||||||
if (resource is BlogPost blogPost)
|
if (resource is BlogPost blogPost)
|
||||||
{
|
{
|
||||||
if (blogPost.ACL.Count==0)
|
return
|
||||||
return true;
|
applicationDbContext.blogSpotPublications
|
||||||
|
.Any(p=>p.BlogpostId == blogPost.Id);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<h2 > Blog post edition </h2>
|
<h2 >Blog post</h2>
|
||||||
<label><input type="checkbox" id="vcbtn" />Editer le code source Markdown</label>
|
<label><input type="checkbox" id="vcbtn" />Editer le code source Markdown</label>
|
||||||
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
<div asp-validation-summary="All" class="text-danger"></div>
|
||||||
@ -100,7 +100,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Publish" class="col-md-2 control-label"></label>
|
<label asp-for="Publish" class="col-md-2 control-label"></label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input asp-for="Publish" class="form-control" />
|
<input type="checkbox" asp-for="Publish" class="form-control" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -118,5 +118,3 @@
|
|||||||
<div>
|
<div>
|
||||||
<a asp-action="Index">Back to List</a>
|
<a asp-action="Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
using Yavsc.Migrations;
|
|
||||||
|
Reference in New Issue
Block a user