Skip to content

Commit

Permalink
fix(models): remove duplicate locked area in post
Browse files Browse the repository at this point in the history
Do not parse blocked type and author type locked area when parsing
post footer.
  • Loading branch information
realth000 committed Jan 14, 2025
1 parent f21d4c3 commit 8e1b843
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/shared/models/locked.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ class Locked extends Equatable {
bool allowWithPurchase = true,
bool allowWithReply = true,
bool allowWithAuthor = true,
bool allowWithBlocked = true,
}) : _info = _buildLockedFromNode(
element,
allowWithPoints: allowWithPoints,
allowWithPurchase: allowWithPurchase,
allowWithReply: allowWithReply,
allowWithAuthor: allowWithAuthor,
allowWithBlocked: allowWithBlocked,
);

static final _re =
Expand Down Expand Up @@ -213,6 +215,7 @@ class Locked extends Equatable {
required bool allowWithPurchase,
required bool allowWithReply,
required bool allowWithAuthor,
required bool allowWithBlocked,
}) {
if (allowWithAuthor &&
element.childNodes.length == 1 &&
Expand Down Expand Up @@ -246,7 +249,7 @@ class Locked extends Equatable {
final pid = match?.namedGroup('pid');

if (tid == null || pid == null || price == null || purchasedCount == null) {
if (element.innerText.contains('该帖被管理员或版主屏蔽')) {
if (allowWithBlocked && element.innerText.contains('该帖被管理员或版主屏蔽')) {
return const _LockedInfo.banned();
}

Expand Down
2 changes: 2 additions & 0 deletions lib/shared/models/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ class Post with PostMappable {
e,
allowWithPoints: false,
allowWithReply: false,
allowWithAuthor: false,
allowWithBlocked: false,
),
)
.toList();
Expand Down

0 comments on commit 8e1b843

Please sign in to comment.