Marks a list of forums as read.
344411
def mark_forums_read(self, forums, user):
        
        if not forums or not user.is_authenticated:
            return

        forums = sorted(forums, key=lambda f: f.level)

        # Update all forum tracks to the current date for the considered forums
        for forum in forums:
            forum_track = ForumReadTrack.objects.get_or_create(forum=forum, user=user)[0]
            forum_track.save()
        # Delete all the unnecessary topic tracks
        TopicReadTrack.objects.filter(topic__forum__in=forums, user=user).delete()
        # Update parent forum tracks
        self._update_parent_forum_tracks(forums[0], user)
551105
private void readTheListUninterruptibly() {
    boolean interrupted = false;
    try {
      while (true) {
        try {
          readTheList();
          return;
        } catch (InterruptedIOException e) {
          Thread.interrupted(); // Temporarily clear the interrupted state.
          interrupted = true;
        } catch (IOException e) {
          Platform.get().log(Platform.WARN, "Failed to read public suffix list", e);
          return;
        }
      }
    } finally {
      if (interrupted) {
        Thread.currentThread().interrupt(); // Retain interrupted status.
      }
    }
  }
72338
private void addAndSortReaders(List<ProviderInfo<MessageBodyReader<?>>> newReaders, boolean forceSort) {
        Comparator<ProviderInfo<MessageBodyReader<?>>> comparator = null;
        if (!customComparatorAvailable(MessageBodyReader.class)) {
            comparator = new MessageBodyReaderComparator(readerMediaTypesMap);
        }

        messageReaders.addAndSortProviders(newReaders, comparator, forceSort);
    }
985344
public function actionMarkSeen()
    {
        if (Thread::podiumMarkAllSeen()) {
            $this->success(Yii::t('podium/flash', 'All unread threads have been marked as seen.'));
            return $this->redirect(['forum/index']);
        }
        $this->error(Yii::t('podium/flash', 'Sorry! There was an error while marking threads as seen. Contact administrator about this problem.'));
        return $this->redirect(['forum/unread-posts']);
    }
168077
public function markAsRead()
    {
        if (is_null($this->read_at)) {
            $this->forceFill(array(
                'read_at' => $this->freshTimestamp()
            ));

            $this->save();
        }
    }
1155716
def posts(self):
        """"""
        rev = int(self.db.get('site:rev'))
        if rev != self.revision:
            self.reload_site()

        return self._posts
82185
def post(self, request, pk):
        
        self.forum = get_object_or_404(Forum, pk=pk)
        return self.mark_topics_read(request, pk)
353953
protected function fill_forum_cache($forumids) {
        global $DB;

        $requiredfields = [
                'id',
                'course',
                'forcesubscribe',
                'type',
            ];
        list($in, $params) = $DB->get_in_or_equal($forumids);
        $this->forums = $DB->get_records_select('forum', "id $in", $params, '', implode(', ', $requiredfields));
        foreach ($this->forums as $id => $forum) {
            \mod_forum\subscriptions::fill_subscription_cache($id);
            \mod_forum\subscriptions::fill_discussion_subscription_cache($id);
        }
    }
1090668
def recurseforumcontents(parser, token):
    
    bits = token.contents.split()
    forums_contents_var = template.Variable(bits[1])

    template_nodes = parser.parse(('endrecurseforumcontents',))
    parser.delete_first_token()

    return RecurseTreeForumVisibilityContentNode(template_nodes, forums_contents_var)
474109
def list_rooms(self, message):
        """"""
        context = {"rooms": self.available_rooms.values(), }
        self.say(rendered_template("rooms.html", context), message=message, html=True)
230851
def list_user_messages_view(request, targetUsername):
    '''  '''
    targetUser = get_object_or_404(User, username=targetUsername)
    targetProfile = get_object_or_404(UserProfile, user=targetUser)
    user_messages = Message.objects.filter(owner=targetProfile)
    thread_pks = list(set([i.thread.pk for i in user_messages]))
    threads = Thread.objects.filter(pk__in=thread_pks)
    page_name = "Threads {0} has posted in".format(targetUser.get_full_name())
    return render_to_response('list_threads.html', {
        'page_name': page_name,
        'threads': threads,
        'targetUsername': targetUsername,
        }, context_instance=RequestContext(request))
87267
def mark_read(request, message_id, dispatch_id, hashed, redirect_to=None):
    
    if redirect_to is None:
        redirect_to = get_static_url('img/sitemessage/blank.png')

    return _generic_view(
        'handle_mark_read_request', sig_mark_read_failed,
        request, message_id, dispatch_id, hashed, redirect_to=redirect_to
    )
719765
public void markListDelivered(List list)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "markListDelivered", list);

    int len = list.size();
    for (int i = 0; i < len; i++)
    {
      AIValueTick valueTick = (AIValueTick) list.get(i);
      valueTick.setDelivered(true);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "markListDelivered");

  }
54362
def get_target_forums_for_moved_topics(self, user):
        
        return [f for f in self._get_forums_for_user(user, ['can_move_topics', ]) if f.is_forum]
1250392
def mark_notifications_as_read(self, last_read_at=datetime.datetime.utcnow()):
        
        assert isinstance(last_read_at, datetime.datetime)
        put_parameters = {
            "last_read_at": last_read_at.strftime('%Y-%m-%dT%H:%M:%SZ')
        }

        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            "/notifications",
            input=put_parameters
        )
1160055
def mark_as_read(self, request, pk):
        
        if self.top_level_forum is not None:
            forums = request.forum_permission_handler.get_readable_forums(
                self.top_level_forum.get_descendants(include_self=True), request.user,
            )
        else:
            forums = request.forum_permission_handler.get_readable_forums(
                Forum.objects.all(), request.user,
            )

        # Marks forums as read
        track_handler.mark_forums_read(forums, request.user)

        if len(forums):
            messages.success(request, self.success_message)

        return HttpResponseRedirect(self.get_top_level_forum_url())
573505
public function printCategoriesForums()
    {
        Container::get('hooks')->fire('model.index.print_categories_forums_start');

        // Get list of forums and topics with new posts since last visit
        if (!User::get()->is_guest) {
            $new_topics = $this->getNewPosts();
        }

        $query['select'] = [
            'cid' => 'c.id',
            'c.cat_name',
            'fid' => 'f.id',
            'f.forum_name',
            'f.forum_desc',
            'f.redirect_url',
            'f.moderators',
            'f.num_topics',
            'f.num_posts',
            'f.last_post',
            'f.last_post_id',
            'f.last_poster'
        ];
//        $query['where'] = array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );
//        $query['order_by'] = array('c.disp_position', 'c.id', 'f.disp_position');

        $query = DB::forTable('categories')
            ->table_alias('c')
            ->select_many($query['select'])
            ->inner_join(DB::prefix().'forums', ['c.id', '=', 'f.cat_id'], 'f')
            ->left_outer_join(
                DB::prefix().'forum_perms',
                '(`fp`.`forum_id`=`f`.`id` AND `fp`.`group_id`='. User::get()->g_id.')',
                'fp'
            )
//            ->left_outer_join(DB::prefix().'forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')
//            ->left_outer_join(DB::prefix().'forum_perms', array('fp.group_id', '=',
// User::get()->g_id), null, true)
//            ->where_any_is($query['where'])
            ->where_raw('(`fp`.`read_forum` IS NULL OR `fp`.`read_forum`=1)')
            ->orderByExpr('`c`.`disp_position`, `c`.`id`, `f`.`disp_position`');
//            ->order_by_many($query['order_by']);

        $query = Container::get('hooks')->fireDB('model.index.query_print_categories_forums', $query);

        $query = $query->find_result_set();

        $index_data = [];
        $i = 0;
        foreach ($query as $cur_forum) {
            if ($i == 0) {
                $cur_forum->cur_category = 0;
                $cur_forum->forum_count_formatted = 0;
            }

            if (isset($cur_forum->cur_category)) {
                $cur_cat = $cur_forum->cur_category;
            } else {
                $cur_cat = 0;
            }

            if ($cur_forum->cid != $cur_cat) {
                // A new category since last iteration?
                $cur_forum->forum_count_formatted = 0;
                $cur_forum->cur_category = $cur_forum->cid;
            }

            ++$cur_forum->forum_count_formatted;

            $cur_forum->item_status = ($cur_forum->forum_count_formatted % 2 == 0) ? 'roweven' : 'rowodd';
            $forum_field_new = '';
            $cur_forum->icon_type = 'icon';

            // Are there new posts since our last visit?
            if (isset($new_topics[$cur_forum->fid])) {
                $cur_forum->item_status .= ' inew';
                $forum_field_new = '<span class="newtext">[ <a href="'.
                    Router::pathFor('quickSearch', ['show' => 'new&amp;fid='.$cur_forum->fid]).'">'.
                    __('New posts').'</a> ]</span>';
                $cur_forum->icon_type = 'icon icon-new';
            }

            // Is this a redirect forum?
            if ($cur_forum->redirect_url != '') {
                $cur_forum->forum_field = '<span class="redirtext">'.__('Link to').'</span> <a href="'.
                    Utils::escape($cur_forum->redirect_url).'" title="'.__('Link to').' '.
                    Utils::escape($cur_forum->redirect_url).'">'.
                    Utils::escape($cur_forum->forum_name).'</a>';
                $cur_forum->num_topics_formatted = $cur_forum->num_posts_formatted = '-';
                $cur_forum->item_status .= ' iredirect';
                $cur_forum->icon_type = 'icon';
            } else {
                $forum_name = Url::slug($cur_forum->forum_name);
                $cur_forum->forum_field = '<a href="'.
                    Router::pathFor('Forum', ['id' => $cur_forum->fid, 'name' => $forum_name]).'">'.
                    Utils::escape($cur_forum->forum_name).'</a>'.(!empty($forum_field_new) ? ' '.
                        $forum_field_new : '');
                $cur_forum->num_topics_formatted = $cur_forum->num_topics;
                $cur_forum->num_posts_formatted = $cur_forum->num_posts;
            }

            if ($cur_forum->forum_desc != '') {
                $cur_forum->forum_field .= "\n\t\t\t\t\t\t\t\t".'<div class="forumdesc">'.
                    $cur_forum->forum_desc.'</div>';
            }

            // If there is a last_post/last_poster
            if ($cur_forum->last_post != '') {
                $cur_forum->last_post_formatted = '<a href="'.
                    Router::pathFor('viewPost', ['pid' => $cur_forum->last_post_id]).'#p'.
                    $cur_forum->last_post_id.'">'.
                    Container::get('utils')->timeFormat($cur_forum->last_post).'</a><br /><span class="byuser">'.
                    __('by').' '.Utils::escape($cur_forum->last_poster).'</span>';
            } elseif ($cur_forum->redirect_url != '') {
                $cur_forum->last_post_formatted = '- - -';
            } else {
                $cur_forum->last_post_formatted = __('Never');
            }

            if ($cur_forum->moderators != '') {
                $mods_array = unserialize($cur_forum->moderators);
                $moderators = [];

                foreach ($mods_array as $mod_username => $mod_id) {
                    if (User::get()->g_view_users == '1') {
                        $moderators[] = '<a href="'.Router::pathFor('userProfile', ['id' => $mod_id]).'">'.
                            Utils::escape($mod_username).'</a>';
                    } else {
                        $moderators[] = Utils::escape($mod_username);
                    }
                }

                $cur_forum->moderators_formatted = "\t\t\t\t\t\t\t\t".'<p class="modlist">(<em>'.
                    __('Moderated by').'</em> '.implode(', ', $moderators).')</p>'."\n";
            } else {
                $cur_forum->moderators_formatted = '';
            }

//            $index_data[] = $cur_forum;
            $index_data[$cur_forum->cid][] = $cur_forum;
            ++$i;
        }

        $index_data = Container::get('hooks')->fire('model.index.print_categories_forums', $index_data);

        return $index_data;
    }