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 32 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
2 changes: 1 addition & 1 deletion lemmy-translations
Submodule lemmy-translations updated 54 files
+0 −13 .woodpecker.yml
+1 −3 README.md
+16 −16 email/fi.json
+11 −11 email/it.json
+16 −16 email/ko.json
+16 −16 email/pt.json
+486 −486 translations/ar.json
+78 −78 translations/as.json
+393 −393 translations/bg.json
+106 −106 translations/bn.json
+309 −309 translations/ca.json
+373 −373 translations/cs.json
+28 −28 translations/cy.json
+281 −478 translations/da.json
+357 −357 translations/de.json
+463 −463 translations/el.json
+481 −490 translations/en.json
+475 −478 translations/eo.json
+475 −478 translations/es.json
+439 −439 translations/eu.json
+297 −297 translations/fa.json
+467 −467 translations/fi.json
+376 −376 translations/fr.json
+330 −330 translations/ga.json
+455 −455 translations/gl.json
+35 −35 translations/got.json
+64 −64 translations/hi.json
+414 −414 translations/hu.json
+398 −398 translations/id.json
+419 −419 translations/it.json
+415 −458 translations/ja.json
+227 −227 translations/ka.json
+440 −440 translations/ko.json
+278 −278 translations/lt.json
+182 −182 translations/ml.json
+15 −15 translations/mnc.json
+43 −43 translations/nb_NO.json
+393 −393 translations/nl.json
+412 −412 translations/oc.json
+478 −478 translations/pl.json
+414 −414 translations/pt.json
+460 −464 translations/pt_BR.json
+410 −410 translations/ru.json
+28 −28 translations/sk.json
+239 −239 translations/sq.json
+56 −56 translations/sr_Latn.json
+360 −360 translations/sv.json
+139 −139 translations/th.json
+250 −250 translations/tr.json
+323 −323 translations/uk.json
+376 −376 translations/vi.json
+379 −379 translations/zh.json
+396 −396 translations/zh_Hant.json
+140 −140 translators.json
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "lemmy-ui",
"version": "0.17.1",
"version": "0.17.3",
"description": "An isomorphic UI for lemmy",
"repository": "https://github.com/LemmyNet/lemmy-ui",
SleeplessOne1917 marked this conversation as resolved.
Show resolved Hide resolved
"license": "AGPL-3.0",
"author": "Dessalines <[email protected]>",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/shared/components/community/create-community.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Component } from "inferno";
import { Redirect } from "inferno-router";
import { CommunityView, GetSiteResponse } from "lemmy-js-client";
import { Subscription } from "rxjs";
import { i18n } from "../../i18next";
import { UserService } from "../../services/UserService";
import {
enableNsfw,
isBrowser,
Expand Down Expand Up @@ -48,6 +50,7 @@ export class CreateCommunity extends Component<any, CreateCommunityState> {
render() {
return (
<div className="container-lg">
{!UserService.Instance.myUserInfo && <Redirect to="/login" />}
SleeplessOne1917 marked this conversation as resolved.
Show resolved Hide resolved
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
Expand Down
1 change: 0 additions & 1 deletion src/shared/components/modlog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,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: 3 additions & 1 deletion src/shared/components/post/create-post.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from "inferno";
import { Redirect } from "inferno-router";
import { RouteComponentProps } from "inferno-router/dist/Route";
import {
GetCommunity,
Expand All @@ -12,7 +13,7 @@ import {
import { Subscription } from "rxjs";
import { InitialFetchRequest, PostFormParams } from "shared/interfaces";
import { i18n } from "../../i18next";
import { WebSocketService } from "../../services";
import { UserService, WebSocketService } from "../../services";
import {
Choice,
QueryParams,
Expand Down Expand Up @@ -143,6 +144,7 @@ export class CreatePost extends Component<

return (
<div className="container-lg">
{!UserService.Instance.myUserInfo && <Redirect to="/login" />}
SleeplessOne1917 marked this conversation as resolved.
Show resolved Hide resolved
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
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 @@ -14,6 +14,7 @@ import {
FeaturePost,
Language,
LockPost,
MarkPostAsRead,
PersonView,
PostView,
PurgePerson,
Expand Down Expand Up @@ -610,6 +611,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 @@ -750,6 +752,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 @@ -1497,6 +1518,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.props.post_view.post;
Expand Down
11 changes: 9 additions & 2 deletions src/shared/components/post/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,20 @@ export class Post extends Component<any, PostState> {
op == UserOperation.RemovePost ||
op == UserOperation.LockPost ||
op == UserOperation.FeaturePost ||
op == UserOperation.SavePost
op == UserOperation.SavePost ||
op == UserOperation.MarkPostAsRead
) {
const data = wsJsonToRes<PostResponse>(msg);
const res = this.state.postRes;
if (res) {
res.post_view = data.post_view;
this.setState(this.state);
this.setState(prevState => {
if (prevState.postRes) {
prevState.postRes.post_view = data.post_view;
}

return prevState;
});
setupTippy();
}
} else if (
Expand Down
1 change: 1 addition & 0 deletions src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ export function editPostRes(data: PostView, post: PostView) {
post.post.body = data.post.body;
post.post.locked = data.post.locked;
post.saved = data.saved;
post.read = data.read;
}
}

Expand Down
Loading