Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mark post as read button #1135

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fec9200
Fix issue with empty markdown content not nulling DB. Fixes #924 (#925)
dessalines Feb 17, 2023
a5569bb
Remove buggy navbar search. Fixes #921 (#950)
dessalines Feb 21, 2023
b9fbfab
Do local community checks for buttons. Fixes #918 (#948)
dessalines Feb 21, 2023
7721d41
Fixing line formatting. (#947)
dessalines Feb 21, 2023
cc76092
Adding a warning for deselecting the undetermined language. (#945)
dessalines Feb 21, 2023
0375d71
Let any mod feature and lock posts. Fixes #875 (#944)
dessalines Feb 21, 2023
e5ced4f
Check to make sure post is correct. Fixes #934 (#949)
dessalines Feb 21, 2023
79cbeac
Adding reports send email to admins option (#932)
dessalines Feb 17, 2023
53c2de0
Upgrading deps (#951)
dessalines Feb 21, 2023
e58d61b
Adding ban_from_community to be more clear. Fixes #872 (#943)
dessalines Feb 21, 2023
a119ba5
v0.17.2-rc.1
dessalines Feb 21, 2023
abb6d80
Only show the determined warning for multiple. (#952)
dessalines Feb 22, 2023
81493f9
v0.17.2-rc.2
dessalines Feb 22, 2023
9e58f65
v0.17.2
dessalines Feb 22, 2023
70f285f
I18 quality of life change (#973)
SleeplessOne1917 Apr 3, 2023
a2bcc37
Handle when logged out (#986)
SleeplessOne1917 May 3, 2023
8fe83a2
Get rid of "No Results" showing while search is still loading. (#997)
SleeplessOne1917 May 4, 2023
d52c549
Add content warning to modlog and fix modlog routing bug (#994)
SleeplessOne1917 May 4, 2023
c2325ba
Adding a warning for deselecting the undetermined language. (#945)
dessalines Feb 21, 2023
91b3616
Fixing some outdated docs links. Fixes #1006 (#1007)
dessalines May 11, 2023
c164881
Show parent comment for comment link. Fixes #1030 (#1032)
dessalines May 22, 2023
1717b5c
Show language on posts and comments (#1026)
SleeplessOne1917 May 21, 2023
d6d249c
Remove "banned" badge from posts and comments (fixes 899) (#1011)
Nutomic May 12, 2023
ade413c
Dont preselect new post language (#1008)
Nutomic May 13, 2023
078e940
Merge pull request #1036 from LemmyNet/language-tag-changes
SleeplessOne1917 May 28, 2023
c5006cc
v0.17.3
dessalines Jun 1, 2023
32f5120
Fix isoData can contain user generated content (#1114)
0xDEADCADE Jun 8, 2023
28c43a2
Try sanitize 1.
dessalines Jun 8, 2023
55d26fc
Fixing quotes.
dessalines Jun 9, 2023
cab3abb
Add mark as read button in PostListing
ItsEcholot Jun 9, 2023
fd97cb4
Merge branch 'main' into mark-post-as-read
SleeplessOne1917 Jun 10, 2023
e8ddaa7
Merge branch 'main' into feature/mark-post-as-read-button
SleeplessOne1917 Jun 11, 2023
535e9fe
Merge branch 'main' into feature/mark-post-as-read-button
ItsEcholot Jun 17, 2023
761862c
Merge branch 'main' into feature/mark-post-as-read-button
ItsEcholot Jun 17, 2023
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
4 changes: 2 additions & 2 deletions src/shared/components/community/communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { InitialFetchRequest } from "../../interfaces";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
QueryParams,
RouteDataResponse,
editCommunity,
getPageFromString,
getQueryParams,
getQueryString,
myAuth,
myAuthRequired,
numToSI,
QueryParams,
RouteDataResponse,
setIsoData,
showLocal,
} from "../../utils";
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/community/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
QueryParams,
RouteDataResponse,
commentsToFlatNodes,
communityRSSUrl,
editComment,
Expand All @@ -79,8 +77,10 @@ import {
getQueryString,
myAuth,
postToCommentSortType,
QueryParams,
relTags,
restoreScrollPosition,
RouteDataResponse,
saveScrollPosition,
setIsoData,
setupTippy,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/home/admin-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import { InitialFetchRequest } from "../../interfaces";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
RouteDataResponse,
capitalizeFirstLetter,
fetchThemeList,
myAuthRequired,
removeFromEmojiDataModel,
RouteDataResponse,
setIsoData,
showLocal,
toast,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/home/instances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { i18n } from "../../i18next";
import { InitialFetchRequest } from "../../interfaces";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import { RouteDataResponse, relTags, setIsoData } from "../../utils";
import { relTags, RouteDataResponse, setIsoData } from "../../utils";
import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon";

Expand Down
9 changes: 4 additions & 5 deletions src/shared/components/modlog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {
ModBanView,
ModFeaturePostView,
ModLockPostView,
ModlogActionType,
ModRemoveCommentView,
ModRemoveCommunityView,
ModRemovePostView,
ModTransferCommunityView,
ModlogActionType,
Person,
} from "lemmy-js-client";
import moment from "moment";
Expand All @@ -33,11 +33,9 @@ import { InitialFetchRequest } from "../interfaces";
import { FirstLoadService } from "../services/FirstLoadService";
import { HttpService, RequestState } from "../services/HttpService";
import {
Choice,
QueryParams,
RouteDataResponse,
amAdmin,
amMod,
Choice,
debounce,
fetchLimit,
fetchUsers,
Expand All @@ -48,6 +46,8 @@ import {
getUpdatedSearchId,
myAuth,
personToChoice,
QueryParams,
RouteDataResponse,
setIsoData,
} from "../utils";
import { HtmlTags } from "./common/html-tags";
Expand Down Expand Up @@ -747,7 +747,6 @@ export class Modlog extends Component<
title={this.documentTitle}
path={this.context.router.route.match.url}
/>

<div>
<div
className="alert alert-warning text-sm-start text-xs-center"
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/person/inbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import {
PersonMentionView,
PrivateMessageReportResponse,
PrivateMessageResponse,
PrivateMessageView,
PrivateMessagesResponse,
PrivateMessageView,
PurgeComment,
PurgeItemResponse,
PurgePerson,
Expand All @@ -50,7 +50,6 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
RouteDataResponse,
commentsToFlatNodes,
editCommentReply,
editMention,
Expand All @@ -62,6 +61,7 @@ import {
myAuth,
myAuthRequired,
relTags,
RouteDataResponse,
setIsoData,
toast,
updatePersonBlock,
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/person/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
QueryParams,
RouteDataResponse,
canMod,
capitalizeFirstLetter,
editComment,
Expand All @@ -74,8 +72,10 @@ import {
myAuth,
myAuthRequired,
numToSI,
QueryParams,
relTags,
restoreScrollPosition,
RouteDataResponse,
saveScrollPosition,
setIsoData,
setupTippy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
RouteDataResponse,
editRegistrationApplication,
fetchLimit,
myAuthRequired,
RouteDataResponse,
setIsoData,
setupTippy,
} from "../../utils";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/person/reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import { HttpService, UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { RequestState } from "../../services/HttpService";
import {
RouteDataResponse,
amAdmin,
editCommentReport,
editPostReport,
editPrivateMessageReport,
fetchLimit,
myAuthRequired,
RouteDataResponse,
setIsoData,
} from "../../utils";
import { CommentReport } from "../comment/comment-report";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/person/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { i18n, languages } from "../../i18next";
import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import {
Choice,
capitalizeFirstLetter,
Choice,
communityToChoice,
debounce,
elementUrl,
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/post/create-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import {
} from "../../services/HttpService";
import {
Choice,
QueryParams,
RouteDataResponse,
enableDownvotes,
enableNsfw,
getIdFromString,
getQueryParams,
myAuth,
QueryParams,
RouteDataResponse,
setIsoData,
} from "../../utils";
import { HtmlTags } from "../common/html-tags";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/post/post-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { PostFormParams } from "../../interfaces";
import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import {
Choice,
archiveTodayUrl,
capitalizeFirstLetter,
Choice,
communityToChoice,
debounce,
fetchCommunities,
Expand Down
35 changes: 35 additions & 0 deletions src/shared/components/post/post-listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
FeaturePost,
Language,
LockPost,
MarkPostAsRead,
PersonView,
PostView,
PurgePerson,
Expand Down Expand Up @@ -666,6 +667,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
return (
<>
{this.saveButton}
{this.markReadButton}
{this.crossPostButton}
{mobile && this.showMoreButton}
{(!mobile || this.state.showAdvanced) && (
Expand Down Expand Up @@ -822,6 +824,25 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
);
}

get markReadButton() {
const read = this.props.post_view.read;
const label = read ? i18n.t("mark read") : i18n.t("mark unread");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't put spaces in the translation strings. Use mark_read and mark_unread instead.

return (
<button
className="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleMarkReadPostClick)}
data-tippy-content={label}
aria-label={label}
>
<Icon
icon="file-text"
classes={classNames({ "text-warning": read })}
inline
/>
</button>
);
}

get crossPostButton() {
return (
<Link
Expand Down Expand Up @@ -1515,6 +1536,20 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
});
}

handleMarkReadPostClick(i: PostListing) {
const auth = myAuth();
if (auth) {
const read =
i.props.post_view.read == undefined ? true : !i.props.post_view.read;
const form: MarkPostAsRead = {
post_id: i.props.post_view.post.id,
read,
auth,
};
WebSocketService.Instance.send(wsClient.markPostAsRead(form));
SleeplessOne1917 marked this conversation as resolved.
Show resolved Hide resolved
}
}

get crossPostParams(): PostFormParams {
const queryParams: PostFormParams = {};
const { name, url } = this.postView.post;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { InitialFetchRequest } from "../../interfaces";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
RouteDataResponse,
getRecipientIdFromProps,
myAuth,
RouteDataResponse,
setIsoData,
toast,
} from "../../utils";
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ import { CommentViewType, InitialFetchRequest } from "../interfaces";
import { FirstLoadService } from "../services/FirstLoadService";
import { HttpService, RequestState } from "../services/HttpService";
import {
Choice,
QueryParams,
RouteDataResponse,
capitalizeFirstLetter,
Choice,
commentsToFlatNodes,
communityToChoice,
debounce,
Expand All @@ -45,7 +43,9 @@ import {
myAuth,
numToSI,
personToChoice,
QueryParams,
restoreScrollPosition,
RouteDataResponse,
saveScrollPosition,
setIsoData,
showLocal,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/services/HistoryService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { History, createBrowserHistory } from "history";
import { createBrowserHistory, History } from "history";

export class HistoryService {
static #_instance: HistoryService;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import emojiShortName from "emoji-short-name";
import {
BlockCommunityResponse,
BlockPersonResponse,
CommentAggregates,
Comment as CommentI,
CommentAggregates,
CommentReplyView,
CommentReportView,
CommentSortType,
Expand Down