Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/SIL.XForge.Scripture/Controllers/ParatextController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -167,8 +166,8 @@ public async Task<ActionResult> JoinProjectAsync(string projectId)
[HttpGet("projects")]
public async Task<ActionResult<IEnumerable<ParatextProject>>> GetAsync()
{
Attempt<UserSecret> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret userSecret))
Attempt<UserSecret?> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret? userSecret))
return NoContent();
try
{
Expand Down Expand Up @@ -207,8 +206,8 @@ public async Task<ActionResult<TextSnapshot>> GetSnapshotAsync(
DateTime timestamp
)
{
Attempt<UserSecret> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret userSecret))
Attempt<UserSecret?> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret? userSecret))
{
return Forbid();
}
Expand Down Expand Up @@ -249,8 +248,8 @@ public async Task<ActionResult<IAsyncEnumerable<DocumentRevision>>> GetRevisionH
int chapter
)
{
Attempt<UserSecret> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret userSecret))
Attempt<UserSecret?> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret? userSecret))
{
return Forbid();
}
Expand Down Expand Up @@ -281,8 +280,8 @@ int chapter
[ProducesResponseType(typeof(IEnumerable<ParatextNote>), StatusCodes.Status200OK)]
public async Task<ActionResult<IEnumerable<ParatextNote>>> GetNotesAsync(string projectId)
{
Attempt<UserSecret> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret userSecret))
Attempt<UserSecret?> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret? userSecret))
{
return Forbid();
}
Expand Down Expand Up @@ -387,10 +386,10 @@ public async Task<ActionResult<string>> SyncAsync(string projectId)
[HttpGet("username")]
public async Task<ActionResult<string>> UsernameAsync()
{
Attempt<UserSecret> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret userSecret))
Attempt<UserSecret?> attempt = await _userSecrets.TryGetAsync(_userAccessor.UserId);
if (!attempt.TryResult(out UserSecret? userSecret))
return NoContent();
string username = _paratextService.GetParatextUsername(userSecret);
string? username = _paratextService.GetParatextUsername(userSecret);
return Ok(username);
}
}
5 changes: 2 additions & 3 deletions src/SIL.XForge.Scripture/Migrator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;
using System.Diagnostics;
using System.IO;
Expand All @@ -14,7 +13,7 @@ public static class Migrator
public static void RunMigrations(string environment)
{
string version = Product.Version;
string projectPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string? projectPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

string migratorPath = Path.Join(projectPath, "RealtimeServer", "lib", "cjs", "scriptureforge", "migrator.js");

Expand All @@ -28,7 +27,7 @@ public static void RunMigrations(string environment)
var startTime = DateTime.Now;
Console.WriteLine($"[{startTime:o}] Starting migrator");

using var process = Process.Start(startInfo);
using Process process = Process.Start(startInfo)!;
while (!process.StandardOutput.EndOfStream)
{
Console.WriteLine(process.StandardOutput.ReadLine());
Expand Down
3 changes: 1 addition & 2 deletions src/SIL.XForge.Scripture/Models/AudioTiming.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

public class AudioTiming
{
public string TextRef { get; set; }
public string? TextRef { get; set; }
public double From { get; set; }
public double To { get; set; }

Expand Down
5 changes: 2 additions & 3 deletions src/SIL.XForge.Scripture/Models/EditorTabPersistData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

/// <summary>
Expand All @@ -9,12 +8,12 @@ public class EditorTabPersistData
/// <summary>
/// Corresponds to EditorTabType.
/// </summary>
public string TabType { get; set; }
public string? TabType { get; set; }

/// <summary>
/// Which tab group this tab belongs to.
/// </summary>
public string GroupId { get; set; }
public string? GroupId { get; set; }

/// <summary>
/// Whether the tab is selected within its group.
Expand Down
5 changes: 2 additions & 3 deletions src/SIL.XForge.Scripture/Models/InviteeStatus.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

public class InviteeStatus
{
public string Email { get; set; }
public string Role { get; set; }
public string? Email { get; set; }
public string? Role { get; set; }
public bool Expired { get; set; }
}
3 changes: 1 addition & 2 deletions src/SIL.XForge.Scripture/Models/Like.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

public class Like
{
public string OwnerRef { get; set; }
public string? OwnerRef { get; set; }
}
15 changes: 7 additions & 8 deletions src/SIL.XForge.Scripture/Models/Note.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

/// <summary>Represents a project note.</summary>
public class Note : Comment
{
public string ThreadId { get; set; }
public string? ThreadId { get; set; }

/// <summary>Type of note, such as "" for a normal note, or "conflict" for a conflict note.</summary>
public string Type { get; set; }
public string? Type { get; set; }

/// <summary>
/// Type of conflict, if a conflict note. For example, "verseText". If it is not a conflict note, this
/// may read "unknownConflictType".
/// </summary>
public string ConflictType { get; set; }
public string Status { get; set; }
public string? ConflictType { get; set; }
public string? Status { get; set; }
public int? TagId { get; set; }
public string Reattached { get; set; }
public string? Reattached { get; set; }

/// <summary>
/// Who this note is assigned to. This may be a <see cref="ParatextUserProfile" /> OpaqueUserId,
/// or a category such as team or unassigned.
/// </summary>
public string Assignment { get; set; }
public string? Assignment { get; set; }

/// <summary>
/// Content of note. Contains XML. Corresponds to `Contents` element, which is not always present in the
Expand All @@ -34,7 +33,7 @@ public class Note : Comment
/// Change difference accepted from a conflict, if any. Contains encoded XML. Not always present, in
/// Notes XML file.
/// </summary>
public string AcceptedChangeXml { get; set; }
public string? AcceptedChangeXml { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the note is editable in Scripture Forge.
Expand Down
3 changes: 1 addition & 2 deletions src/SIL.XForge.Scripture/Models/NoteSyncMetricInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

/// <summary>
Expand All @@ -14,7 +13,7 @@ public NoteSyncMetricInfo(int added, int deleted, int updated, int removed)

public int Removed { get; set; }

public static NoteSyncMetricInfo operator +(NoteSyncMetricInfo a, NoteSyncMetricInfo b)
public static NoteSyncMetricInfo? operator +(NoteSyncMetricInfo? a, NoteSyncMetricInfo? b)
{
if (a is null || b is null)
{
Expand Down
21 changes: 10 additions & 11 deletions src/SIL.XForge.Scripture/Models/NoteThread.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System.Collections.Generic;
using SIL.XForge.Models;

Expand All @@ -8,23 +7,23 @@ public class NoteThread : ProjectData
{
public static string GetDocId(string sfProjectId, string dataId) => $"{sfProjectId}:{dataId}";

public string DataId { get; set; }
public string ThreadId { get; set; }
public VerseRefData VerseRef { get; set; }
public string? DataId { get; set; }
public string? ThreadId { get; set; }
public VerseRefData? VerseRef { get; set; }
public List<Note> Notes { get; set; } = [];
public string OriginalSelectedText { get; set; }
public string OriginalContextBefore { get; set; }
public string OriginalContextAfter { get; set; }
public TextAnchor Position { get; set; }
public string ParatextUser { get; set; }
public string? OriginalSelectedText { get; set; }
public string? OriginalContextBefore { get; set; }
public string? OriginalContextAfter { get; set; }
public TextAnchor? Position { get; set; }
public string? ParatextUser { get; set; }
public bool? PublishedToSF { get; set; }
public string Status { get; set; }
public string? Status { get; set; }

/// <summary>
/// Who this note thread is assigned to. This may be a <see cref="ParatextUserProfile" /> OpaqueUserId,
/// or a category such as team or unassigned.
/// </summary>
public string Assignment { get; set; }
public string? Assignment { get; set; }

/// <summary>
/// The Biblical Term this note is for. Null if not for a Biblical Term.
Expand Down
7 changes: 3 additions & 4 deletions src/SIL.XForge.Scripture/Models/OnboardingRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;
using System.Collections.Generic;
using SIL.XForge.Models;
Expand Down Expand Up @@ -31,7 +30,7 @@ public class OnboardingRequest : IIdentifiable
/// <summary>
/// The resolution of this request: "unresolved' (default), "approved", "declined", or "outsourced".
/// </summary>
public string Resolution { get; set; }
public string? Resolution { get; set; }

/// <summary>
/// Gets the status of this request based on assignee and resolution.
Expand Down Expand Up @@ -83,12 +82,12 @@ public class OnboardingRequestSummary
/// <summary>
/// The resolution of this request. See <see cref="OnboardingRequest.Resolution"/>.
/// </summary>
public string Resolution { get; set; }
public string? Resolution { get; set; }

/// <summary>
/// The status of this request. See <see cref="OnboardingRequest.Status"/>.
/// </summary>
public string Status { get; set; }
public string? Status { get; set; }

public static OnboardingRequestSummary FromRequest(OnboardingRequest request) =>
new OnboardingRequestSummary
Expand Down
5 changes: 2 additions & 3 deletions src/SIL.XForge.Scripture/Models/ParatextResource.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;
using System.Globalization;
using System.Text;
Expand Down Expand Up @@ -73,7 +72,7 @@ public class ParatextResource : ParatextProject
/// <remarks>
/// This is used to see if the manifest has changed.
/// </remarks>
public string ManifestChecksum { get; set; }
public string? ManifestChecksum { get; set; }

/// <summary>
/// Gets or sets the permissions checksum.
Expand All @@ -84,7 +83,7 @@ public class ParatextResource : ParatextProject
/// <remarks>
/// This is used to see if the permissions have changed.
/// </remarks>
public string PermissionsChecksum { get; set; }
public string? PermissionsChecksum { get; set; }

/// <inheritdoc/>
public override string ToString()
Expand Down
9 changes: 4 additions & 5 deletions src/SIL.XForge.Scripture/Models/Question.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;
using System.Collections.Generic;
using SIL.XForge.Models;
Expand All @@ -7,10 +6,10 @@ namespace SIL.XForge.Scripture.Models;

public class Question : ProjectData
{
public string DataId { get; set; }
public VerseRefData VerseRef { get; set; }
public string Text { get; set; }
public string AudioUrl { get; set; }
public string? DataId { get; set; }
public VerseRefData? VerseRef { get; set; }
public string? Text { get; set; }
public string? AudioUrl { get; set; }
public List<Answer> Answers { get; set; } = [];
public bool IsArchived { get; set; }
public DateTime? DateArchived { get; set; }
Expand Down
5 changes: 2 additions & 3 deletions src/SIL.XForge.Scripture/Models/ResourceConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;

namespace SIL.XForge.Scripture.Models;
Expand All @@ -9,7 +8,7 @@ namespace SIL.XForge.Scripture.Models;
public class ResourceConfig
{
public DateTime CreatedTimestamp { get; set; }
public string ManifestChecksum { get; set; }
public string PermissionsChecksum { get; set; }
public string? ManifestChecksum { get; set; }
public string? PermissionsChecksum { get; set; }
public int Revision { get; set; }
}
3 changes: 1 addition & 2 deletions src/SIL.XForge.Scripture/Models/SFProjectUserConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System;
using System.Collections.Generic;
using SIL.XForge.Models;
Expand All @@ -9,7 +8,7 @@ public class SFProjectUserConfig : ProjectData
{
public static string GetDocId(string projectId, string userId) => $"{projectId}:{userId}";

public string SelectedTask { get; set; }
public string? SelectedTask { get; set; }
public int? SelectedBookNum { get; set; }
public int? SelectedChapterNum { get; set; }

Expand Down
3 changes: 1 addition & 2 deletions src/SIL.XForge.Scripture/Models/SyncMetricInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

/// <summary>
Expand All @@ -20,7 +19,7 @@ public SyncMetricInfo(int added, int deleted, int updated)
public int Deleted { get; set; }
public int Updated { get; set; }

public static SyncMetricInfo operator +(SyncMetricInfo a, SyncMetricInfo b)
public static SyncMetricInfo? operator +(SyncMetricInfo? a, SyncMetricInfo? b)
{
if (a is null || b is null)
{
Expand Down
3 changes: 1 addition & 2 deletions src/SIL.XForge.Scripture/Models/TextAnchor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
namespace SIL.XForge.Scripture.Models;

/// <summary>
Expand All @@ -19,7 +18,7 @@ public class TextAnchor
public int Start { get; set; } = 0;
public int Length { get; set; } = 0;

public override bool Equals(object other)
public override bool Equals(object? other)
{
if (other is not TextAnchor compared)
return false;
Expand Down
7 changes: 3 additions & 4 deletions src/SIL.XForge.Scripture/Models/TextAudio.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#nullable disable warnings
using System.Collections.Generic;
using SIL.Scripture;
using SIL.XForge.Models;
Expand All @@ -10,8 +9,8 @@ public class TextAudio : ProjectData
public static string GetDocId(string projectId, int book, int chapter) =>
$"{projectId}:{Canon.BookNumberToId(book)}:{chapter}:target";

public string DataId { get; set; }
public string? DataId { get; set; }
public List<AudioTiming> Timings { get; set; } = [];
public string MimeType { get; set; }
public string AudioUrl { get; set; }
public string? MimeType { get; set; }
public string? AudioUrl { get; set; }
}
Loading
Loading