Skip to content

Commit

Permalink
Merge branch 'master' into fatima/INF-1224
Browse files Browse the repository at this point in the history
  • Loading branch information
sohailfatima authored Jan 30, 2024
2 parents db8d116 + 88a985d commit f203975
Show file tree
Hide file tree
Showing 32 changed files with 1,306 additions and 1,314 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VER }}
- name: Install dependencies
Expand Down
13 changes: 9 additions & 4 deletions src/components/FilterBar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/forbid-prop-types */
import React, { useMemo, useState } from 'react';
import React, { useCallback, useMemo, useState } from 'react';
import PropTypes from 'prop-types';

import { capitalize, toString } from 'lodash';
Expand Down Expand Up @@ -93,10 +93,15 @@ const FilterBar = ({
},
];

const handleFilterToggle = useCallback((event) => {
onFilterChange(event);
setOpen(false);
}, [onFilterChange]);

return (
<Collapsible.Advanced
open={isOpen}
onToggle={() => setOpen(!isOpen)}
onToggle={setOpen}
className="filter-bar collapsible-card-lg border-0"
>
<Collapsible.Trigger className="collapsible-trigger border-0">
Expand Down Expand Up @@ -126,7 +131,7 @@ const FilterBar = ({
name={value.name}
className="d-flex flex-column list-group list-group-flush"
value={selectedFilters[value.name]}
onChange={onFilterChange}
onChange={handleFilterToggle}
>
{value.filters.map(filterName => {
const element = allFilters.find(obj => obj.id === filterName);
Expand Down Expand Up @@ -159,7 +164,7 @@ const FilterBar = ({
name="cohort"
className="d-flex flex-column list-group list-group-flush w-100"
value={selectedFilters.cohort}
onChange={onFilterChange}
onChange={handleFilterToggle}
>
<ActionItem
id="all-groups"
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationBar/CourseTabsNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const CourseTabsNavigation = ({
}, [courseId]);

return (
<div id="courseTabsNavigation" className={classNames('course-tabs-navigation px-4', className)}>
<div id="courseTabsNavigation" className={classNames('course-tabs-navigation px-4 bg-white', className)}>
{!!tabs.length && (
<Tabs
className="nav-underline-tabs"
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/common/AuthorLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const AuthorLabel = ({
data-testid="learner-posts-link"
id="learner-posts-link"
to={generatePath(Routes.LEARNERS.POSTS, { learnerUsername: author, courseId })}
className="text-decoration-none"
className="text-decoration-none text-reset"
style={{ width: 'fit-content' }}
>
{!alert && authorName}
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/common/HoverCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const HoverCard = ({

return (
<div
className="flex-fill justify-content-end align-items-center hover-card mr-n4 position-absolute"
className="flex-fill justify-content-end align-items-center hover-card bg-white mr-n4 position-absolute"
data-testid={`hover-card-${id}`}
id={`hover-card-${id}`}
>
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/discussions-home/DiscussionsHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const DiscussionsHome = () => {
<main className="container-fluid d-flex flex-column p-0 w-100" id="main" tabIndex="-1">
{!enableInContextSidebar && <CourseTabsNavigation activeTab="discussion" courseId={courseId} />}
<div
className={classNames('header-action-bar', {
className={classNames('header-action-bar bg-white position-sticky', {
'shadow-none border-light-300 border-bottom': enableInContextSidebar,
})}
ref={postActionBarRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useParams } from 'react-router-dom';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';

import FilterBar from '../../../components/FilterBar';
import { PostsStatusFilter, ThreadType } from '../../../data/constants';
import { selectCourseCohorts } from '../../cohorts/data/selectors';
import { fetchCourseCohorts } from '../../cohorts/data/thunks';
import { selectUserHasModerationPrivileges, selectUserIsGroupTa } from '../../data/selectors';
Expand Down Expand Up @@ -58,10 +59,16 @@ const LearnerPostFilterBar = () => {
}
} else if (name === 'status') {
if (postFilter.status !== value) {
const postType = (value === PostsStatusFilter.UNANSWERED && ThreadType.QUESTION)
|| (value === PostsStatusFilter.UNRESPONDED && ThreadType.DISCUSSION)
|| postFilter.postType;

dispatch(setPostFilter({
...postFilter,
postType,
status: value,
}));

filterContentEventProperties.statusFilter = value;
}
} else if (name === 'orderBy') {
Expand Down
7 changes: 2 additions & 5 deletions src/discussions/learners/learner/LearnerFilterBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,13 @@ const LearnerFilterBar = () => {
},
);
}
setOpen(false);
}, []);

const handleOnToggle = useCallback(() => {
setOpen(!isOpen);
}, [isOpen]);

return (
<Collapsible.Advanced
open={isOpen}
onToggle={handleOnToggle}
onToggle={setOpen}
className="filter-bar collapsible-card-lg border-0"
>
<Collapsible.Trigger className="collapsible-trigger border-0">
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/post-comments/PostCommentsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const PostCommentsView = () => {
)
)}
<div
className="discussion-comments d-flex flex-column card border-0 post-card-margin post-card-padding on-focus"
className="discussion-comments d-flex flex-column card border-0 post-card-margin post-card-padding on-focus mx-4 mt-4 mb-0"
>
<Post handleAddResponseButton={handleAddResponseButton} />
{!closed && (
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/post-comments/comments/CommentsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CommentsView = ({ endorsed }) => {

const handleDefinition = useCallback((message, commentsLength) => (
<div
className="comment-line mx-4 my-14px text-gray-700 font-style"
className="comment-line line-height-24 mx-4 my-14px text-gray-700 font-style"
role="heading"
aria-level="2"
>
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/post-comments/comments/comment/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const Comment = ({
) : (
!isClosed && isUserPrivilegedInPostingRestriction && (inlineReplies.length >= 5) && (
<Button
className="d-flex flex-grow mt-2 font-size-14 font-style font-weight-500 text-primary-500"
className="d-flex flex-grow mt-2 font-size-14 font-style font-weight-500 text-primary-500 add-comment-btn rounded-0"
variant="plain"
style={{ height: '36px' }}
onClick={handleAddCommentReply}
Expand Down
6 changes: 4 additions & 2 deletions src/discussions/posts/data/slices.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ const threadsSlice = createSlice({
...(state.threadsInTopic[payload.topicId] || []),
payload.id,
];
// Temporarily add it to the top of the list so it's visible
state.pages[0] = [payload.id].concat(state.pages[0] || []);
if (!payload.anonymousToPeers) {
// Temporarily add it to the top of the list so it's visible
state.pages[0] = [payload.id].concat(state.pages[0] || []);
}
state.avatars = { ...state.avatars, ...payload.avatars };
state.redirectToThread = { topicId: payload.topicId, threadId: payload.id };
state.threadDraft = null;
Expand Down
7 changes: 2 additions & 5 deletions src/discussions/posts/post-filter-bar/PostFilterBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,9 @@ const PostFilterBar = () => {
}

sendTrackEvent('edx.forum.filter.content', filterContentEventProperties);
setOpen(false);
}, [currentFilters, currentSorting, dispatch, selectedCohort]);

const handleToggle = useCallback(() => {
setOpen(!isOpen);
}, [isOpen]);

useEffect(() => {
if (userHasModerationPrivileges && isEmpty(cohorts)) {
dispatch(fetchCourseCohorts(courseId));
Expand Down Expand Up @@ -183,7 +180,7 @@ const PostFilterBar = () => {
return (
<Collapsible.Advanced
open={isOpen}
onToggle={handleToggle}
onToggle={setOpen}
className="filter-bar collapsible-card-lg border-0"
>
<Collapsible.Trigger className="collapsible-trigger border-0">
Expand Down
34 changes: 16 additions & 18 deletions src/i18n/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@
"discussions.authors.label.ta": "أستاذ مساعد",
"discussions.learner.loadMostPosts": "تواريخ تعطيل نشطة حاليا. لا يمكن النشر في المناقشات خلال هذه الفترة.",
"discussions.post.anonymous.author": "مجهول",
"discussion.blackoutBanner.information": "Posting in discussions is disabled by the course team",
"discussion.blackoutBanner.information": "تم تعطيل النشر في المناقشات بواسطة فريق الدورة التدريبية",
"discussions.editor.image.warning.message": "لن تظهر الصور التي يزيد عرضها أو ارتفاعها عن 999 بكسل عند عرض المنشور أو الرد او التعليق باستخدام مناقشات المساق المضمّنة",
"discussions.editor.image.warning.title": "تحذير!",
"discussions.editor.image.warning.dismiss": "حسنًا",
"navigation.course.tabs.label": "مواد المساق",
"discussions.topics.backAlt": "العودة إلى قائمة المواضيع",
"discussions.topics.discussions": "{count, plural, =0 {Discussion} one {# Discussion} other {# Discussions} }",
"discussions.topics.questions": "{count, plural, =0 {Question} one {# Question} other {# Questions} }",
"discussions.topics.discussions": "{العدد، الجمع، =0 { المحادثة } واحد {# المحادثة } آخر {# المحادثات } }",
"discussions.topics.questions": "{عد، جمع، =0 {سؤال} واحد {# سؤال} آخر {# أسئلة} }",
"discussions.topics.reported": "تم الإبلاغ عن {reported}",
"discussions.topics.previouslyReported": "تم الإبلاغ عن {previouslyReported} من قبل",
"discussions.topics.find.label": "البحث في المواضيع",
"discussions.topics.unnamed.section.label": "قسم بدون اسم",
"discussions.topics.unnamed.subsection.label": "قسم فرعي بدون اسم",
"discussions.subtopics.unnamed.topic.label": "موضوع لم يذكر اسمه",
"discussions.topics.title": "لا يوجد موضوع",
"discussions.topics.createTopic": "Please contact you admin to create a topic",
"discussions.topics.createTopic": "يرجى الاتصال بك المسؤول لإنشاء موضوع",
"discussions.topics.nothing": "لا شيء هنا حتى الان",
"discussions.topics.archived.label": "مؤرشف",
"discussions.learner.reported": "تم الإبلاغ عن {reported}",
Expand All @@ -59,19 +59,19 @@
"discussions.learner.mostActivity": "الأكثر نشاطًا",
"discussions.learner.reportedActivity": "النشاطات المبلغ عنها",
"discussions.learner.recentActivity": "الأحدث نشاطًا",
"discussions.learner.sortFilterStatus": "All learners sorted by {sort, select, flagged {reported activity} activity {most activity} other {{sort}} }",
"discussions.learner.sortFilterStatus": "تم ترتيب كل الطلّاب حسب {sort, Select, flagled {reportedactivity} النشاط {الأكثر نشاطًا} Other { {sort} } }",
"discussion.learner.allActivity": "كل النشاط",
"discussion.learner.posts": "المنشورات",
"discussions.comments.comment.addComment": "Add comment",
"discussions.comments.comment.addComment": "إضافة تعليق",
"discussions.comments.comment.addResponse": "إضافة رد",
"discussions.comments.comment.abuseFlaggedMessage": "تم إبلاغ الطاقم عن هذا المحتوى لمراجعته.",
"discussions.actions.back.alt": "العودة إلى القائمة",
"discussions.comments.comment.responseCount": "{num, plural, =0 {No responses} one {Showing # response} other {Showing # responses} }",
"discussions.comments.comment.endorsedResponseCount": "{num, plural, =0 {No endorsed responses} one {Showing # endorsed response} other {Showing # endorsed responses} }",
"discussions.comments.comment.responseCount": "{num, plural, =0 {لا يوجد ردود} واحد {يظهر # رد} آخر {يظهر # ردود} }",
"discussions.comments.comment.endorsedResponseCount": "{num, plural, =0 {لا توجد ردود معتمدة} واحدة {يتم عرض # ردود معتمدة} أخرى {يتم عرض # ردود معتمدة} }",
"discussions.comments.comment.loadMoreComments": "تحميل المزيد من التعليقات",
"discussions.comments.comment.loadMoreResponses": "تحميل المزيد من الردود",
"discussions.comments.comment.visibility": "This post is visible to {group, select, null {Everyone} other {{group}} }.",
"discussions.comments.comment.postedTime": "{postType, select, discussion {Discussion} question {Question} other {{postType}} } posted {relativeTime} by",
"discussions.comments.comment.visibility": "هذا المنشور مرئي لـ {group, Select, null {Everyone}other { {group} } }.",
"discussions.comments.comment.postedTime": "{postType, Select, المحادثة {المحادثة} سؤال {سؤال} آخر { {postType} } } تم النشر بواسطة {relativeTime}",
"discussions.comments.comment.commentTime": "تم النشر {relativeTime}",
"discussions.comments.comment.answer": "الإجابة",
"discussions.comments.comment.answeredlabel": "تم تعليمها كمُجابة من طرف",
Expand Down Expand Up @@ -99,7 +99,7 @@
"discussions.post.closedBy": "تم إقفال المنشور من طرف",
"discussion.comment.time": "منذ {time}",
"discussion.thread.notFound": "المناقشة غير موجودة",
"discussions.comment.sortFilterStatus": "{sort, select, false {Oldest first} true {Newest first} other {{sort}} }",
"discussions.comment.sortFilterStatus": "{فرز، تحديد، خطأ {الأقدم أولاً} صحيح {الأحدث أولاً} أخرى { {sort} } }",
"discussions.topics.sort.message": "مرتبة حسب {sortBy}",
"discussions.topics.sort.lastActivity": "الأحدث نشاطًا",
"discussions.topics.sort.commentCount": "الاكثر نشاطًا",
Expand All @@ -109,10 +109,8 @@
"tour.action.advance": "التالي",
"tour.action.dismiss": "تجاهل",
"tour.action.end": "حسنًا",
"tour.body.notRespondedFilter": "يمكنك الآن تصفية المناقشات للعثور على مشاركات بدون رد.",
"tour.title.notRespondedFilter": "خيار تصفية جديد!",
"tour.body.responseSortTour": "Responses and comments are now sorted by newest first. Please use this option to change the sort order",
"tour.title.responseSortTour": "فرز الردود!",
"tour.example.title": "جولة المثال",
"tour.example.body": "هذه جولة نموذجية",
"learn.course.tabs.navigation.overflow.menu": "المزيد...",
"discussions.navigation.breadcrumbMenu.allTopics": "المواضيع",
"discussions.navigation.breadcrumbMenu.showAll": "عرض الكل",
Expand Down Expand Up @@ -154,10 +152,10 @@
"discussions.post.editReason": "السبب",
"discussions.post.postWithoutPreview": "المعاينة غير متاحة",
"discussions.post.follow.description": "أنت تتابع هذا المنشور/الرد",
"discussions.post.unfollow.description": "you are not following this post",
"discussions.post.unfollow.description": "أنت لا تتابع هذا المنصب",
"discussions.app.title": "المناقشات",
"discussions.posts.actionBar.searchAllPosts": "البحث في كافّة المنشورات",
"discussions.posts.actionBar.search": "{page, select, topics {Search topics} posts {Search all posts} learners {Search learners} myPosts {Search all posts} other {{page}} }",
"discussions.posts.actionBar.search": "{صفحة، حدد المواضيع {بحث في المواضيع} مشاركات {بحث في كل المشاركات} الطلّاب {بحث الطلّاب } myPosts {بحث في كل المشاركات} أخرى { {page} } }",
"discussions.actionBar.searchInfo": "{num، plural, =0 {لا توجد نتائج} one {تم إظهار نتيجة واحدة} two {تم إظهار نتيجتين} few {تم إظهار # نتائج} many {تم إظهار # نتيجة} other {تم إظهار # نتائج}} لـ\"{text}\"",
"discussions.actionBar.searchRewriteInfo": "لم يعثر على نتائج لـ \"{searchString}\". {num، plural, =0 {لا توجد نتائج} one {تم إظهار نتيجة واحدة} two {تم إظهار نتيجتين} few {تم إظهار # نتائج} many {تم إظهار # نتيجة} other {تم إظهار # نتائج}} لـ\"{textSearchRewrite}\" ",
"discussions.actionBar.searchInfoSearching": "البحث جارٍ...",
Expand Down Expand Up @@ -207,5 +205,5 @@
"discussions.posts.sort.lastActivity": "الأحدث نشاطًا",
"discussions.posts.sort.commentCount": "الأكثر نشاطًا",
"discussions.posts.sort.voteCount": "الأكثر إعجابًا",
"discussions.posts.sort-filter.sortFilterStatus": "{own, select, false {All} true {Own} other {{own}} } {status, select, statusAll {} statusUnread {unread} statusFollowing {followed} statusReported {reported} statusUnanswered {unanswered} statusUnresponded {unresponded} other {{status}} } {type, select, discussion {discussions} question {questions} all {posts} other {{type}} } {cohortType, select, all {} group {in {cohort}} other {{cohortType}} } sorted by {sort, select, lastActivityAt {recent activity} commentCount {most activity} voteCount {most likes} other {{sort}} }"
"discussions.posts.sort-filter.sortFilterStatus": "{خاص، حدد، خطأ {الكل} صحيح {ملكي} آخر { {own} } } {الحالة، حدد، الحالة الكل {} الحالة غير مقروءة {غير مقروءة} الحالة التالية {followed} الحالة المُبلغ عنها {المُبلغ عنها} الحالة غير المُجيبة {unanswered} الحالة غير المُستجيبة {unresponded} أخرى { {status} } } {نوع، حدد، المحادثة { المحادثات } سؤال {أسئلة} جميع {المشاركات} أخرى { {type} } } {cohortType، حدد، الكل {} المجموعة {in {فوج} } أخرى { {cohortType} } } مرتبة حسب {فرز، تحديد، LastActivityAt { النشاط الأخير} تعليق عدد {أكثر الأنشطة} عدد الأصوات {أكثر الإعجابات} أخرى { {sort} } }"
}
Loading

0 comments on commit f203975

Please sign in to comment.