mirror of https://gitlab.com/bashrc2/epicyon
Separate moderator and editor roles
parent
0a2f9776c6
commit
f2913b47ed
|
@ -6760,6 +6760,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '/' in currNickname:
|
if '/' in currNickname:
|
||||||
currNickname = currNickname.split('/')[0]
|
currNickname = currNickname.split('/')[0]
|
||||||
moderator = isModerator(baseDir, currNickname)
|
moderator = isModerator(baseDir, currNickname)
|
||||||
|
editor = isEditor(baseDir, currNickname)
|
||||||
msg = \
|
msg = \
|
||||||
htmlInboxNews(self.server.defaultTimeline,
|
htmlInboxNews(self.server.defaultTimeline,
|
||||||
self.server.recentPostsCache,
|
self.server.recentPostsCache,
|
||||||
|
@ -6780,7 +6781,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._isMinimal(nickname),
|
self._isMinimal(nickname),
|
||||||
self.server.YTReplacementDomain,
|
self.server.YTReplacementDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
self.server.newswire, moderator,
|
self.server.newswire,
|
||||||
|
moderator, editor,
|
||||||
self.server.positiveVoting)
|
self.server.positiveVoting)
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
self._set_headers('text/html', len(msg),
|
self._set_headers('text/html', len(msg),
|
||||||
|
|
|
@ -5373,7 +5373,7 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str:
|
||||||
|
|
||||||
def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
|
def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
|
||||||
httpPrefix: str, translate: {},
|
httpPrefix: str, translate: {},
|
||||||
iconsDir: str, moderator: bool) -> str:
|
iconsDir: str, editor: bool) -> str:
|
||||||
"""Returns html content for the left column
|
"""Returns html content for the left column
|
||||||
"""
|
"""
|
||||||
htmlStr = ''
|
htmlStr = ''
|
||||||
|
@ -5409,7 +5409,7 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
|
||||||
if editImageClass == 'leftColEdit':
|
if editImageClass == 'leftColEdit':
|
||||||
htmlStr += '\n <center>\n'
|
htmlStr += '\n <center>\n'
|
||||||
|
|
||||||
if moderator:
|
if editor:
|
||||||
# show the edit icon
|
# show the edit icon
|
||||||
htmlStr += \
|
htmlStr += \
|
||||||
' <a href="' + \
|
' <a href="' + \
|
||||||
|
@ -5563,7 +5563,7 @@ def htmlNewswire(newswire: str, nickname: str, moderator: bool,
|
||||||
|
|
||||||
def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
|
def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
|
||||||
httpPrefix: str, translate: {},
|
httpPrefix: str, translate: {},
|
||||||
iconsDir: str, moderator: bool,
|
iconsDir: str, moderator: bool, editor: bool,
|
||||||
newswire: {}, positiveVoting: bool) -> str:
|
newswire: {}, positiveVoting: bool) -> str:
|
||||||
"""Returns html content for the right column
|
"""Returns html content for the right column
|
||||||
"""
|
"""
|
||||||
|
@ -5601,7 +5601,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
|
||||||
if editImageClass == 'rightColEdit':
|
if editImageClass == 'rightColEdit':
|
||||||
htmlStr += '\n <center>\n'
|
htmlStr += '\n <center>\n'
|
||||||
|
|
||||||
if moderator:
|
if editor:
|
||||||
if os.path.isfile(baseDir + '/accounts/newswiremoderation.txt'):
|
if os.path.isfile(baseDir + '/accounts/newswiremoderation.txt'):
|
||||||
# show the edit icon highlighted
|
# show the edit icon highlighted
|
||||||
htmlStr += \
|
htmlStr += \
|
||||||
|
@ -5654,6 +5654,7 @@ def htmlTimeline(defaultTimeline: str,
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
newswire: {}, moderator: bool,
|
newswire: {}, moderator: bool,
|
||||||
|
editor: bool,
|
||||||
positiveVoting: bool) -> str:
|
positiveVoting: bool) -> str:
|
||||||
"""Show the timeline as html
|
"""Show the timeline as html
|
||||||
"""
|
"""
|
||||||
|
@ -5753,6 +5754,10 @@ def htmlTimeline(defaultTimeline: str,
|
||||||
if not moderator:
|
if not moderator:
|
||||||
moderator = isModerator(baseDir, nickname)
|
moderator = isModerator(baseDir, nickname)
|
||||||
|
|
||||||
|
# is the user a site editor?
|
||||||
|
if not editor:
|
||||||
|
editor = isEditor(baseDir, nickname)
|
||||||
|
|
||||||
# benchmark 2
|
# benchmark 2
|
||||||
timeDiff = int((time.time() - timelineStartTime) * 1000)
|
timeDiff = int((time.time() - timelineStartTime) * 1000)
|
||||||
if timeDiff > 100:
|
if timeDiff > 100:
|
||||||
|
@ -5959,7 +5964,7 @@ def htmlTimeline(defaultTimeline: str,
|
||||||
leftColumnStr = \
|
leftColumnStr = \
|
||||||
getLeftColumnContent(baseDir, nickname, domainFull,
|
getLeftColumnContent(baseDir, nickname, domainFull,
|
||||||
httpPrefix, translate, iconsDir,
|
httpPrefix, translate, iconsDir,
|
||||||
moderator)
|
editor)
|
||||||
tlStr += ' <td valign="top" class="col-left">' + \
|
tlStr += ' <td valign="top" class="col-left">' + \
|
||||||
leftColumnStr + ' </td>\n'
|
leftColumnStr + ' </td>\n'
|
||||||
# center column containing posts
|
# center column containing posts
|
||||||
|
@ -6288,7 +6293,8 @@ def htmlTimeline(defaultTimeline: str,
|
||||||
# right column
|
# right column
|
||||||
rightColumnStr = getRightColumnContent(baseDir, nickname, domainFull,
|
rightColumnStr = getRightColumnContent(baseDir, nickname, domainFull,
|
||||||
httpPrefix, translate, iconsDir,
|
httpPrefix, translate, iconsDir,
|
||||||
moderator, newswire, positiveVoting)
|
moderator, editor,
|
||||||
|
newswire, positiveVoting)
|
||||||
tlStr += ' <td valign="top" class="col-right">' + \
|
tlStr += ' <td valign="top" class="col-right">' + \
|
||||||
rightColumnStr + ' </td>\n'
|
rightColumnStr + ' </td>\n'
|
||||||
tlStr += ' </tr>\n'
|
tlStr += ' </tr>\n'
|
||||||
|
@ -6345,7 +6351,7 @@ def htmlShares(defaultTimeline: str,
|
||||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||||
False, YTReplacementDomain,
|
False, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6372,7 +6378,7 @@ def htmlInbox(defaultTimeline: str,
|
||||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6399,7 +6405,7 @@ def htmlBookmarks(defaultTimeline: str,
|
||||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6426,7 +6432,7 @@ def htmlEvents(defaultTimeline: str,
|
||||||
httpPrefix, projectVersion, manuallyApproveFollowers,
|
httpPrefix, projectVersion, manuallyApproveFollowers,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6448,7 +6454,7 @@ def htmlInboxDMs(defaultTimeline: str,
|
||||||
nickname, domain, port, inboxJson, 'dm', allowDeletion,
|
nickname, domain, port, inboxJson, 'dm', allowDeletion,
|
||||||
httpPrefix, projectVersion, False, minimal,
|
httpPrefix, projectVersion, False, minimal,
|
||||||
YTReplacementDomain, showPublishedDateOnly,
|
YTReplacementDomain, showPublishedDateOnly,
|
||||||
newswire, False, positiveVoting)
|
newswire, False, False, positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
def htmlInboxReplies(defaultTimeline: str,
|
def htmlInboxReplies(defaultTimeline: str,
|
||||||
|
@ -6470,7 +6476,7 @@ def htmlInboxReplies(defaultTimeline: str,
|
||||||
allowDeletion, httpPrefix, projectVersion, False,
|
allowDeletion, httpPrefix, projectVersion, False,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6493,7 +6499,7 @@ def htmlInboxMedia(defaultTimeline: str,
|
||||||
allowDeletion, httpPrefix, projectVersion, False,
|
allowDeletion, httpPrefix, projectVersion, False,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6516,7 +6522,7 @@ def htmlInboxBlogs(defaultTimeline: str,
|
||||||
allowDeletion, httpPrefix, projectVersion, False,
|
allowDeletion, httpPrefix, projectVersion, False,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, False,
|
newswire, False, False,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6529,7 +6535,7 @@ def htmlInboxNews(defaultTimeline: str,
|
||||||
httpPrefix: str, projectVersion: str,
|
httpPrefix: str, projectVersion: str,
|
||||||
minimal: bool, YTReplacementDomain: str,
|
minimal: bool, YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
newswire: {}, moderator: bool,
|
newswire: {}, moderator: bool, editor: bool,
|
||||||
positiveVoting: bool) -> str:
|
positiveVoting: bool) -> str:
|
||||||
"""Show the news timeline as html
|
"""Show the news timeline as html
|
||||||
"""
|
"""
|
||||||
|
@ -6540,7 +6546,7 @@ def htmlInboxNews(defaultTimeline: str,
|
||||||
allowDeletion, httpPrefix, projectVersion, False,
|
allowDeletion, httpPrefix, projectVersion, False,
|
||||||
minimal, YTReplacementDomain,
|
minimal, YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
newswire, moderator,
|
newswire, moderator, editor,
|
||||||
positiveVoting)
|
positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6562,7 +6568,7 @@ def htmlModeration(defaultTimeline: str,
|
||||||
nickname, domain, port, inboxJson, 'moderation',
|
nickname, domain, port, inboxJson, 'moderation',
|
||||||
allowDeletion, httpPrefix, projectVersion, True, False,
|
allowDeletion, httpPrefix, projectVersion, True, False,
|
||||||
YTReplacementDomain, showPublishedDateOnly,
|
YTReplacementDomain, showPublishedDateOnly,
|
||||||
newswire, False, positiveVoting)
|
newswire, False, False, positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
def htmlOutbox(defaultTimeline: str,
|
def htmlOutbox(defaultTimeline: str,
|
||||||
|
@ -6586,7 +6592,7 @@ def htmlOutbox(defaultTimeline: str,
|
||||||
allowDeletion, httpPrefix, projectVersion,
|
allowDeletion, httpPrefix, projectVersion,
|
||||||
manuallyApproveFollowers, minimal,
|
manuallyApproveFollowers, minimal,
|
||||||
YTReplacementDomain, showPublishedDateOnly,
|
YTReplacementDomain, showPublishedDateOnly,
|
||||||
newswire, False, positiveVoting)
|
newswire, False, False, positiveVoting)
|
||||||
|
|
||||||
|
|
||||||
def htmlIndividualPost(recentPostsCache: {}, maxRecentPosts: int,
|
def htmlIndividualPost(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
|
|
Loading…
Reference in New Issue