Flagged questions disappear from every student-facing surface (search, exam simulation sampling, the missed-question review queue, bookmarks, direct fetch) while staying published - flagging and unpublishing are now separate, reversible actions with their own audit trail (who flagged it, when, why). Backend-only for now: SUPER-only flag/unflag/ list endpoints, no client UI. Includes a one-time CLI sweep (flag-media-questions) to flag every existing question with an image so they can be reviewed.
18 lines
491 B
C#
18 lines
491 B
C#
using QuestionsApi.Services;
|
|
using Xunit;
|
|
|
|
namespace QuestionsApi.Tests;
|
|
|
|
public sealed class QuestionVisibilityTests
|
|
{
|
|
[Theory]
|
|
[InlineData(true, false, true)]
|
|
[InlineData(true, true, false)]
|
|
[InlineData(false, false, false)]
|
|
[InlineData(false, true, false)]
|
|
public void IsVisibleToStudent_MatchesTruthTable(bool isPublished, bool isFlagged, bool expected)
|
|
{
|
|
Assert.Equal(expected, QuestionVisibility.IsVisibleToStudent(isPublished, isFlagged));
|
|
}
|
|
}
|