mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
Added the language to the user profile and fixed a putin bug
This commit is contained in:
parent
e1265046b5
commit
282f5a5d4e
10 changed files with 2403 additions and 9 deletions
|
@ -72,7 +72,7 @@ namespace Ombi.Core.Engine.V2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the task so we can get the data later on if we have a IMDBID
|
// Setup the task so we can get the data later on if we have a IMDBID
|
||||||
Task<TraktShow> traktInfoTask = new Task<TraktShow>(() => null);
|
Task<TraktShow> traktInfoTask = null;
|
||||||
if (show.externals?.imdb.HasValue() ?? false)
|
if (show.externals?.imdb.HasValue() ?? false)
|
||||||
{
|
{
|
||||||
traktInfoTask = Cache.GetOrAdd("GetExtendedTvInfoTrakt" + show.externals?.imdb,
|
traktInfoTask = Cache.GetOrAdd("GetExtendedTvInfoTrakt" + show.externals?.imdb,
|
||||||
|
@ -167,6 +167,8 @@ namespace Ombi.Core.Engine.V2
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<SearchFullInfoTvShowViewModel> GetExtraInfo(Task<TraktShow> showInfoTask, SearchFullInfoTvShowViewModel model)
|
private async Task<SearchFullInfoTvShowViewModel> GetExtraInfo(Task<TraktShow> showInfoTask, SearchFullInfoTvShowViewModel model)
|
||||||
|
{
|
||||||
|
if (showInfoTask != null)
|
||||||
{
|
{
|
||||||
var result = await showInfoTask;
|
var result = await showInfoTask;
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
@ -177,7 +179,7 @@ namespace Ombi.Core.Engine.V2
|
||||||
model.Trailer = result.Trailer?.AbsoluteUri ?? string.Empty;
|
model.Trailer = result.Trailer?.AbsoluteUri ?? string.Empty;
|
||||||
model.Certification = result.Certification;
|
model.Certification = result.Certification;
|
||||||
model.Homepage = result.Homepage?.AbsoluteUri ?? string.Empty;
|
model.Homepage = result.Homepage?.AbsoluteUri ?? string.Empty;
|
||||||
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace Ombi.Store.Entities
|
||||||
|
|
||||||
public string EmbyConnectUserId { get; set; }
|
public string EmbyConnectUserId { get; set; }
|
||||||
|
|
||||||
|
public string Language { get; set; }
|
||||||
|
|
||||||
public int? MovieRequestLimit { get; set; }
|
public int? MovieRequestLimit { get; set; }
|
||||||
public int? EpisodeRequestLimit { get; set; }
|
public int? EpisodeRequestLimit { get; set; }
|
||||||
public int? MusicRequestLimit { get; set; }
|
public int? MusicRequestLimit { get; set; }
|
||||||
|
|
1155
src/Ombi.Store/Migrations/OmbiMySql/20200610223540_UserProfile.Designer.cs
generated
Normal file
1155
src/Ombi.Store/Migrations/OmbiMySql/20200610223540_UserProfile.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations.OmbiMySql
|
||||||
|
{
|
||||||
|
public partial class UserProfile : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Language",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Language",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -269,6 +269,9 @@ namespace Ombi.Store.Migrations.OmbiMySql
|
||||||
b.Property<int?>("EpisodeRequestLimit")
|
b.Property<int?>("EpisodeRequestLimit")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Language")
|
||||||
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
b.Property<DateTime?>("LastLoggedIn")
|
b.Property<DateTime?>("LastLoggedIn")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
@ -592,6 +595,9 @@ namespace Ombi.Store.Migrations.OmbiMySql
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedDate")
|
||||||
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
b.Property<string>("Description")
|
b.Property<string>("Description")
|
||||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||||
|
|
||||||
|
|
1154
src/Ombi.Store/Migrations/OmbiSqlite/20200610223651_UserProfile.Designer.cs
generated
Normal file
1154
src/Ombi.Store/Migrations/OmbiSqlite/20200610223651_UserProfile.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,22 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations.OmbiSqlite
|
||||||
|
{
|
||||||
|
public partial class UserProfile : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Language",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Language",
|
||||||
|
table: "AspNetUsers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -268,6 +268,9 @@ namespace Ombi.Store.Migrations.OmbiSqlite
|
||||||
b.Property<int?>("EpisodeRequestLimit")
|
b.Property<int?>("EpisodeRequestLimit")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Language")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime?>("LastLoggedIn")
|
b.Property<DateTime?>("LastLoggedIn")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
|
|
@ -286,6 +286,21 @@ namespace Ombi.Controllers.V1
|
||||||
return await GetUserWithRoles(user);
|
return await GetUserWithRoles(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the current users language
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost("language")]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<IActionResult> SetCurrentUserLanguage([FromBody] UserLanguage model)
|
||||||
|
{
|
||||||
|
var username = User.Identity.Name.ToUpper();
|
||||||
|
var user = await UserManager.Users.FirstOrDefaultAsync(x => x.NormalizedUserName == username);
|
||||||
|
user.Language = model.Lang;
|
||||||
|
|
||||||
|
await UserManager.UpdateAsync(user);
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user by the user id.
|
/// Gets the user by the user id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
12
src/Ombi/Models/Identity/UserLanguage.cs
Normal file
12
src/Ombi/Models/Identity/UserLanguage.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ombi.Models.Identity
|
||||||
|
{
|
||||||
|
public class UserLanguage
|
||||||
|
{
|
||||||
|
public string Lang { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue