mirror of
https://github.com/RetroShare/RSNewWebUI.git
synced 2026-09-14 11:05:47 +05:00
lint: apply eslint --fix to the new code
master gained an eslint config in 35c5c17 and the code added here predates
it, so `npm run lint` fails on this branch. This commit is the mechanical
part only, produced by `eslint app --fix` with no hand editing:
object-shorthand, quote style, trailing whitespace, prefer-const.
Twenty-two problems are left because they need a decision rather than a
rewrite rule, the two worth looking at first being real:
boards/board_view.js:499,503 'forumId' is not defined (no-undef)
`renderComment` calls `util.voteForPost(forumId, ...)` for the up and down
vote buttons, but no `forumId` exists in that scope - it looks like it came
over from the forums code. Voting on a board comment therefore throws
ReferenceError and silently does nothing.
The other twenty are unused bindings left behind by the refactors
(`get64Num`, `loadLobbyDetails`, `Message`, `SubscribedLobbies`,
`PublicLobbies`, `LayoutSingle` in chat.js, `closePopup` in
board_kanban.js, `bsubscribed`/`bposts`/`createDate`/`lastActivity` in
boards_util.js, `displaycomment` in channel_view.js) plus a few dead
assignments. `npm run lint` lists them all.
Drop this commit if you would rather keep the diff to your own changes.
This commit is contained in:
parent
0d072650ee
commit
d5fb6a532b
@ -123,7 +123,7 @@ function PhotoViewModal() {
|
||||
function navigate(photoList, newIndex) {
|
||||
currentIndex = newIndex;
|
||||
m.render(getPhotoOverlay(), m(PhotoViewModal, {
|
||||
photoList: photoList,
|
||||
photoList,
|
||||
photoIndex: currentIndex,
|
||||
}));
|
||||
}
|
||||
@ -225,8 +225,8 @@ function openPhotoModal(photoList, photoIndex) {
|
||||
justifyContent: 'center',
|
||||
});
|
||||
m.render(overlay, m(PhotoViewModal, {
|
||||
photoList: photoList,
|
||||
photoIndex: photoIndex,
|
||||
photoList,
|
||||
photoIndex,
|
||||
}));
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ function BoardCard() {
|
||||
m(
|
||||
'h4.board-card__title',
|
||||
{
|
||||
title: title,
|
||||
title,
|
||||
tabindex: 0,
|
||||
onclick: (e) => {
|
||||
e.stopPropagation();
|
||||
@ -537,7 +537,7 @@ function Toolbar() {
|
||||
function openCommentsModal(item, msgId, forumId) {
|
||||
const tab = m.route.param().tab || 'Subscribed';
|
||||
m.route.set('/boards/:tab/:mGroupId/:mMsgId', {
|
||||
tab: tab,
|
||||
tab,
|
||||
mGroupId: forumId,
|
||||
mMsgId: msgId,
|
||||
});
|
||||
@ -607,7 +607,7 @@ function BoardView() {
|
||||
// Top Toolbar with Pagination
|
||||
m(Toolbar, {
|
||||
key: 'toolbar-node',
|
||||
viewMode: viewMode,
|
||||
viewMode,
|
||||
onViewModeChange: (newMode) => {
|
||||
viewMode = newMode;
|
||||
m.redraw();
|
||||
@ -618,8 +618,8 @@ function BoardView() {
|
||||
filterText = text;
|
||||
currentPage = 1;
|
||||
},
|
||||
currentPage: currentPage,
|
||||
totalPages: totalPages,
|
||||
currentPage,
|
||||
totalPages,
|
||||
onPageChange: (newPage) => {
|
||||
currentPage = newPage;
|
||||
m.redraw();
|
||||
@ -642,9 +642,9 @@ function BoardView() {
|
||||
const itemKey = item.key || item.msgId || item.mMsgId || index;
|
||||
return m(BoardCard, {
|
||||
key: `card-${itemKey}`,
|
||||
item: item,
|
||||
viewMode: viewMode,
|
||||
forumId: forumId,
|
||||
item,
|
||||
viewMode,
|
||||
forumId,
|
||||
onOpenComments: onOpenComments || ((itemObj, mId, fId) => openCommentsModal(itemObj, mId, fId)),
|
||||
onOpenPhoto: (clickedItem) => {
|
||||
const photoIdx = modalPhotos.findIndex((pi) => {
|
||||
|
||||
@ -134,7 +134,7 @@ function BoardView() {
|
||||
const itemObj = plist[key] || {};
|
||||
const p = itemObj.post || itemObj;
|
||||
const meta = p.mMeta || {};
|
||||
|
||||
|
||||
let thumb = '';
|
||||
if (p.mImage && p.mImage.mData && p.mImage.mData.base64) {
|
||||
thumb = p.mImage.mData.base64;
|
||||
@ -158,12 +158,12 @@ function BoardView() {
|
||||
: (p.mCommentCount !== undefined ? p.mCommentCount : (p.commentCount !== undefined ? p.commentCount : 0)));
|
||||
|
||||
return {
|
||||
key: key,
|
||||
key,
|
||||
msgId: key,
|
||||
title: titleText,
|
||||
thumbnail: thumb,
|
||||
notes: notesText,
|
||||
commentCount: commentCount,
|
||||
commentCount,
|
||||
post: p,
|
||||
};
|
||||
});
|
||||
@ -257,7 +257,7 @@ function BoardView() {
|
||||
m('.posts__heading', m('h3', 'Posts')),
|
||||
m(boardKanban.BoardView, {
|
||||
forumId: v.attrs.id,
|
||||
items: items,
|
||||
items,
|
||||
})
|
||||
),
|
||||
]),
|
||||
|
||||
@ -35,7 +35,7 @@ function plainText(value) {
|
||||
.replace(/</gi, '<')
|
||||
.replace(/>/gi, '>')
|
||||
.replace(/"/gi, '"')
|
||||
.replace(/'/gi, "'")
|
||||
.replace(/'/gi, '\'')
|
||||
.replace(/\n\s*\n+/g, '\n')
|
||||
.trim();
|
||||
}
|
||||
@ -144,7 +144,7 @@ async function updateDisplayBoards(keyid, details) {
|
||||
posts.forEach((post) => {
|
||||
const msgId = (post.mMeta && post.mMeta.mMsgId) ? post.mMeta.mMsgId : post.mMsgId;
|
||||
if (msgId) {
|
||||
Data.Posts[keyid][msgId] = { post: post, isSearched: true };
|
||||
Data.Posts[keyid][msgId] = { post, isSearched: true };
|
||||
}
|
||||
});
|
||||
m.redraw();
|
||||
@ -260,9 +260,9 @@ async function voteForPost(postGrpId, postMsgId, voteType, voterId = null) {
|
||||
}
|
||||
|
||||
const res = await rs.rsJsonApiRequest('/rsPosted/voteForPost', {
|
||||
postGrpId: postGrpId,
|
||||
postMsgId: postMsgId,
|
||||
authorId: authorId,
|
||||
postGrpId,
|
||||
postMsgId,
|
||||
authorId,
|
||||
vote: voteType,
|
||||
});
|
||||
|
||||
|
||||
@ -170,13 +170,13 @@ function pollHashStatus(localpath) {
|
||||
const info = data.info;
|
||||
const sizeNum = info.size.xint64 || parseInt(info.size.xstr64) || info.size;
|
||||
const fileLink = `<a href="retroshare://file?name=${encodeURIComponent(info.name)}&size=${sizeNum}&hash=${info.hash}">${info.name}</a> (${rs.formatBytes(sizeNum)})`;
|
||||
|
||||
|
||||
const textarea = document.querySelector('.chat-hub-textarea');
|
||||
if (textarea) {
|
||||
const val = textarea.value;
|
||||
textarea.value = val ? val + '\n' + fileLink : fileLink;
|
||||
}
|
||||
|
||||
|
||||
ChatHubState.showAttachModal = false;
|
||||
ChatHubState.isHashing = false;
|
||||
ChatHubState.attachPath = '';
|
||||
@ -1021,7 +1021,7 @@ const ChatRoomDetailView = () => {
|
||||
}));
|
||||
} else if (typeof room.gxs_ids === 'object') {
|
||||
participants = Object.keys(room.gxs_ids).map((key) => ({
|
||||
key: key,
|
||||
key,
|
||||
name: rs.userList.username(key) || key
|
||||
}));
|
||||
}
|
||||
@ -1344,7 +1344,7 @@ const Layout = {
|
||||
ChatHubState.showCreateRoomModal && m('.attach-modal-overlay', [
|
||||
m('.attach-modal', [
|
||||
m('h4', 'Create New Chat Room'),
|
||||
|
||||
|
||||
m('.form-field', { style: 'display: flex; flex-direction: column; gap: 0.25rem;' }, [
|
||||
m('label', { style: 'font-weight: bold; font-size: 0.9rem; color: #475569;' }, 'Room Name:'),
|
||||
m('input[type=text]', {
|
||||
@ -1354,7 +1354,7 @@ const Layout = {
|
||||
style: 'padding: 0.5rem; border: 1px solid #cbd5e1; border-radius: 0.25rem; font-size: 0.9rem;'
|
||||
})
|
||||
]),
|
||||
|
||||
|
||||
m('.form-field', { style: 'display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.5rem;' }, [
|
||||
m('label', { style: 'font-weight: bold; font-size: 0.9rem; color: #475569;' }, 'Topic:'),
|
||||
m('input[type=text]', {
|
||||
@ -1372,7 +1372,7 @@ const Layout = {
|
||||
onchange: (e) => { ChatHubState.newRoomIdentity = e.target.value; },
|
||||
style: 'padding: 0.5rem; border: 1px solid #cbd5e1; border-radius: 0.25rem; font-size: 0.9rem; background-color: #ffffff;'
|
||||
}, [
|
||||
ChatHubState.ownGxsIdentities && ChatHubState.ownGxsIdentities.map(id => {
|
||||
ChatHubState.ownGxsIdentities && ChatHubState.ownGxsIdentities.map((id) => {
|
||||
const details = ChatHubState.gxsDetails[id];
|
||||
const name = details ? (details.mNickname || details.mGroupName) : id;
|
||||
return m('option', { value: id }, name);
|
||||
@ -1414,7 +1414,7 @@ const Layout = {
|
||||
let flags = 0;
|
||||
if (isPublic) flags |= 4;
|
||||
if (isSigned) flags |= 8;
|
||||
|
||||
|
||||
rs.rsJsonApiRequest('/rsChats/createChatLobby', {
|
||||
lobby_name: name,
|
||||
lobby_identity: identity,
|
||||
|
||||
@ -46,7 +46,7 @@ Data.refreshGpgDetails = async function () {
|
||||
)
|
||||
.catch(() => {})
|
||||
.then(() => {
|
||||
let avatar = '';
|
||||
const avatar = '';
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const gpgId = (data.gpg_id || '').toLowerCase();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user